diff --git a/.github/workflows/build-job.yml b/.github/workflows/build-job.yml index 329f993b7..ec1c9ddbb 100644 --- a/.github/workflows/build-job.yml +++ b/.github/workflows/build-job.yml @@ -37,7 +37,6 @@ jobs: - uses: ./.github/actions/micromamba - # --- Mac SDK Hack --- - name: SDK install and symlink (Mac) if: contains(inputs.runner_generate, 'mac') run: | @@ -63,19 +62,10 @@ jobs: run: | OUTPUT=`micromamba run -n cpp-py-bindgen python -c'import toml; print(toml.load("ocp.toml")["output_folder"])'` echo "OUTPUT=$OUTPUT" >> $GITHUB_OUTPUT - - - name: Restore OCP_src cache - id: cache-ocp-src-restore - uses: actions/cache/restore@v4 - with: - path: ${{ steps.conf.outputs.OUTPUT }} - key: OCP-src-${{ inputs.platform }}- - - # --- Generation Logic --- # Windows Special Case (Running on Linux targeting Windows) - name: Generate (Windows on Linux) - if: inputs.platform == 'Windows' && steps.cache-ocp-src-restore.outputs.cache-hit != 'true' + if: inputs.platform == 'Windows' run: | micromamba create --yes --platform win-64 --no-deps --prefix ./occt occt=7.9.2 micromamba run -n cpp-py-bindgen cmake -S . -B . -G Ninja \ @@ -90,7 +80,7 @@ jobs: # Standard Case (Linux/Mac) - name: Generate (Standard) - if: inputs.platform != 'Windows' && steps.cache-ocp-src-restore.outputs.cache-hit != 'true' + if: inputs.platform != 'Windows' run: | micromamba run -n cpp-py-bindgen cmake -S . -B . -G Ninja \ -DPython_ROOT_DIR=$CONDA_PREFIX \ @@ -100,30 +90,18 @@ jobs: cmake --build . ls -lRht - - name: Cache OCP_src - id: cache-ocp-src-save - uses: actions/cache/save@v4 - with: - path: ${{ steps.conf.outputs.OUTPUT }} - key: ${{ steps.cache-ocp-src-restore.outputs.cache-primary-key }} - - name: Copy pkl output - if: steps.cache-ocp-src-restore.outputs.cache-hit != 'true' - shell: bash -l {0} run: | mkdir -p ${{ steps.conf.outputs.OUTPUT }}_pkl cp *.pkl ${{ steps.conf.outputs.OUTPUT }}_pkl/ - # --- Artifact Upload --- - name: Upload Sources - # if: steps.cache-ocp-src-restore.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: OCP_src_${{ inputs.platform }} path: ${{ steps.conf.outputs.OUTPUT }} - name: Upload Pickles - if: steps.cache-ocp-src-restore.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: OCP_pkl_${{ inputs.platform }} @@ -154,14 +132,6 @@ jobs: with: submodules: true - # rely on source artifact?? - # - name: Restore OCP_src cache - # id: cache-ocp-src-restore - # uses: actions/cache/restore@v4 - # with: - # path: ${{ steps.conf.outputs.OUTPUT }} - # key: OCP-src-${{ inputs.platform }}- - # --- Download Artifacts --- - name: Download Source Artifact uses: actions/download-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 12fef27a1..563fe1814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,131 +1,170 @@ -cmake_minimum_required( VERSION 3.29 ) -project( OCP ) - -set( N_PROC 2 CACHE STRING "Number of processes used for generating code") -set( DLL_EXT dll CACHE STRING "DLL suffix") -set( MSVC_VER 16 CACHE STRING "MSVC version to download for win generation") -set( OCCT_LIB_DIR CACHE PATH "Location of OCCT sos/dlls") - -find_package( OpenGL REQUIRED ) -find_package( LLVM REQUIRED ) -find_package( VTK REQUIRED - COMPONENTS - CommonCore - WrappingPythonCore - RenderingCore - RenderingOpenGL2 - CommonDataModel - CommonExecutionModel - freetype -) +cmake_minimum_required(VERSION 3.29) +project(OCP) + +set(N_PROC + 2 + CACHE STRING "Number of processes used for generating code") +set(DLL_EXT + dll + CACHE STRING "DLL suffix") +set(MSVC_VER + 16 + CACHE STRING "MSVC version to download for win generation") +set(OCCT_LIB_DIR CACHE PATH "Location of OCCT sos/dlls") + +find_package(OpenGL REQUIRED) +find_package(LLVM REQUIRED) +find_package( + VTK REQUIRED + COMPONENTS CommonCore + WrappingPythonCore + RenderingCore + RenderingOpenGL2 + CommonDataModel + CommonExecutionModel + freetype) message(STATUS "VTK ${VTK_VERSION} found") -find_package( RapidJSON REQUIRED ) -find_package( Clang REQUIRED ) +find_package(RapidJSON REQUIRED) +find_package(Clang REQUIRED) -set( Python_FIND_VIRTUALENV FIRST ) -find_package( Python COMPONENTS Interpreter Development REQUIRED ) +set(Python_FIND_VIRTUALENV FIRST) +find_package( + Python + COMPONENTS Interpreter Development + REQUIRED) # find OCCT and dump symbols -if( EXISTS ${OCCT_LIB_DIR}) - file(GLOB occt_libs LIST_DIRECTORIES false ${OCCT_LIB_DIR}/*.${DLL_EXT} ) - message(STATUS Found OCCT libs: ${occt_libs}) +if(EXISTS ${OCCT_LIB_DIR}) + file( + GLOB occt_libs + LIST_DIRECTORIES false + ${OCCT_LIB_DIR}/*.${DLL_EXT}) + message(STATUS Found OCCT libs: ${occt_libs}) else() - find_package( OpenCASCADE REQUIRED ) - - foreach(target ${OpenCASCADE_LIBRARIES} ) - get_target_property(loc ${target} IMPORTED_LOCATION_RELEASE) - list( APPEND occt_libs ${loc} ) - endforeach() + find_package( + OpenCASCADE REQUIRED + ) + + foreach(target ${OpenCASCADE_LIBRARIES}) + get_target_property(loc ${target} IMPORTED_LOCATION_RELEASE) + list(APPEND occt_libs ${loc}) + endforeach() endif() -execute_process( - COMMAND - ${Python_EXECUTABLE} - ${CMAKE_SOURCE_DIR}/dump_symbols.py - "${occt_libs}" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -) +execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/dump_symbols.py + "${occt_libs}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -get_target_property( LIBCLANG_PATH libclang IMPORTED_LOCATION_RELEASE ) -get_target_property( VTK_INCLUDE_DIR VTK::CommonCore INTERFACE_INCLUDE_DIRECTORIES ) +get_target_property(LIBCLANG_PATH libclang IMPORTED_LOCATION_RELEASE) +get_target_property(VTK_INCLUDE_DIR VTK::CommonCore + INTERFACE_INCLUDE_DIRECTORIES) # for some reason I get multiple generator expressions string(REPLACE ">" ">;" VTK_INCLUDE_DIR ${VTK_INCLUDE_DIR}) list(GET VTK_INCLUDE_DIR 0 VTK_INCLUDE_DIR) -message( STATUS "Include dirs: ${VTK_INCLUDE_DIR}") -message( STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") +message(STATUS "Include dirs: ${VTK_INCLUDE_DIR}") +message(STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") # OSX if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - list( APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i /opt/usr/local/include/ ) + list(APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i + /opt/usr/local/include/) -# Linux-like + # Linux-like elseif(NOT PLATFORM STREQUAL "Windows") - foreach( inc IN LISTS CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) - list( APPEND CXX_INCLUDES -i ${inc}/ ) - endforeach() + foreach(inc IN LISTS CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND CXX_INCLUDES -i ${inc}/) + endforeach() -# X-generation from Linux to Windows + # X-generation from Linux to Windows else() - # download part of msvc 16 and winsdk - if( NOT EXISTS ${CMAKE_BINARY_DIR}/msvc ) - execute_process( - COMMAND - ${Python_EXECUTABLE} - ${CMAKE_SOURCE_DIR}/extern/msvc-wine/vsdownload.py - --major ${MSVC_VER} - --accept-license - --dest msvc - Win10SDK_10.0.19041 - Microsoft.VisualCpp.CRT.Headers - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - endif() - - list( APPEND CXX_INCLUDES -i ${CMAKE_BINARY_DIR}/msvc/VC/Tools/MSVC/14.29.30133/include ) - list( APPEND CXX_INCLUDES -i ${CMAKE_BINARY_DIR}/msvc/Windows\ Kits/10/Include/10.0.19041.0/ucrt/ ) - list( APPEND CXX_INCLUDES -i ${CMAKE_SOURCE_DIR}/extern/include/ ) + # download part of msvc 16 and winsdk + if(NOT EXISTS ${CMAKE_BINARY_DIR}/msvc) + execute_process( + COMMAND + ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/extern/msvc-wine/vsdownload.py + --major ${MSVC_VER} --accept-license --dest msvc Win10SDK_10.0.19041 + Microsoft.VisualCpp.CRT.Headers + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + endif() + + list(APPEND CXX_INCLUDES -i + ${CMAKE_BINARY_DIR}/msvc/VC/Tools/MSVC/14.29.30133/include) + list(APPEND CXX_INCLUDES -i + ${CMAKE_BINARY_DIR}/msvc/Windows\ Kits/10/Include/10.0.19041.0/ucrt/) + list(APPEND CXX_INCLUDES -i ${CMAKE_SOURCE_DIR}/extern/include/) endif() if(PLATFORM) - message( STATUS "Requested platform: ${PLATFORM}") + message(STATUS "Requested platform: ${PLATFORM}") else() - message( STATUS "Platform not specified.") - - if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(PLATFORM Windows) - elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(PLATFORM OSX) - else() - set(PLATFORM Linux) - endif() + message(STATUS "Platform not specified.") + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(PLATFORM Windows) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(PLATFORM OSX) + else() + set(PLATFORM Linux) + endif() endif() -set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap ) +set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap) + +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/tmp.pkl + COMMAND + ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" + ${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i + ${VTK_INCLUDE_DIR}/ + # -i ${OPENGL_INCLUDE_DIRS} + -i ${RapidJSON_INCLUDE_DIRS} -i + ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ -p + ${CMAKE_SOURCE_DIR} ${CXX_INCLUDES} parse ${CMAKE_SOURCE_DIR}/ocp.toml + tmp.pkl ${PLATFORM} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_SOURCE_DIR}/ocp.toml + USES_TERMINAL + COMMENT "Running pywrap - parse") + +add_custom_target(pywrap_parse ALL DEPENDS ${CMAKE_BINARY_DIR}/tmp.pkl) add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/OCP/CMakeLists.txt - COMMAND - ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" - ${Python_EXECUTABLE} - -m bindgen - -n ${N_PROC} - -l ${LIBCLANG_PATH} - -i ${VTK_INCLUDE_DIR}/ - -i ${OPENGL_INCLUDE_DIRS} - -i ${RapidJSON_INCLUDE_DIRS} - -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ - -p ${CMAKE_SOURCE_DIR} - ${CXX_INCLUDES} - all ${CMAKE_SOURCE_DIR}/ocp.toml ${PLATFORM} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DEPENDS ${CMAKE_SOURCE_DIR}/ocp.toml - USES_TERMINAL - COMMENT "Running pywrap" -) - -add_custom_target(pywrap ALL DEPENDS ${CMAKE_BINARY_DIR}/OCP/CMakeLists.txt ) + OUTPUT ${CMAKE_BINARY_DIR}/tmp_filtered.pkl + COMMAND + ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" + ${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i + ${VTK_INCLUDE_DIR}/ + # -i ${OPENGL_INCLUDE_DIRS} + -i ${RapidJSON_INCLUDE_DIRS} -i + ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ -p + ${CMAKE_SOURCE_DIR} ${CXX_INCLUDES} transform ${CMAKE_SOURCE_DIR}/ocp.toml + ${PLATFORM} tmp.pkl tmp_filtered.pkl + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_BINARY_DIR}/tmp.pkl + USES_TERMINAL + COMMENT "Running pywrap - transform") + +add_custom_target(pywrap_transform ALL + DEPENDS ${CMAKE_BINARY_DIR}/tmp_filtered.pkl) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/OCP/CMakeLists.txt + COMMAND + ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" + ${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i + ${VTK_INCLUDE_DIR}/ + # -i ${OPENGL_INCLUDE_DIRS} + -i ${RapidJSON_INCLUDE_DIRS} -i + ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION_MAJOR}/include/ -p + ${CMAKE_SOURCE_DIR} ${CXX_INCLUDES} generate ${CMAKE_SOURCE_DIR}/ocp.toml + ${PLATFORM} tmp_filtered.pkl + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_BINARY_DIR}/tmp_filtered.pkl + USES_TERMINAL + COMMENT "Running pywrap - generate") + +add_custom_target(pywrap_generate ALL + DEPENDS ${CMAKE_BINARY_DIR}/OCP/CMakeLists.txt) diff --git a/OCP_specific.inc b/OCP_specific.inc index 8fd597715..9e01f3b12 100644 --- a/OCP_specific.inc +++ b/OCP_specific.inc @@ -39,10 +39,14 @@ inline void register_default_constructor(py::module m, const char* name){ }; template -inline void copy_if_copy_constructible(T& t1, T& t2){ +inline void copy_if_assignable(T& t1, T& t2){ - if constexpr (std::is_copy_constructible::value){ - t1 = t2; + if constexpr (std::is_assignable::value){ + t1 = t2; + } + else + { + throw py::type_error("Cannot assign, function wrapper not working properly."); } }; diff --git a/environment.devenv.yml b/environment.devenv.yml index 154576d57..2832bb91d 100644 --- a/environment.devenv.yml +++ b/environment.devenv.yml @@ -2,7 +2,7 @@ name: cpp-py-bindgen channels: - conda-forge dependencies: - - occt=7.9.3=all* + - occt=8.0.0=all* - pybind11=2.13.* - python={{ get_env("PYTHON_VERSION", default="3.13") }} - cmake >3.24 diff --git a/ocp.toml b/ocp.toml index ce5a38533..42db4646b 100644 --- a/ocp.toml +++ b/ocp.toml @@ -30,6 +30,7 @@ modules = [ "Quantity", "Storage", "FSD", +"MMgt", "TCollection", "TColStd", "Message", @@ -268,7 +269,6 @@ modules = [ "RWStepGeom", "RWStepRepr", "RWStepShape", -"RWMesh", "StepBasic", "StepGeom", "StepRepr", @@ -334,10 +334,10 @@ modules = [ "Vrml", "VrmlAPI", "RWGltf", -"IVtk", -"IVtkOCC", -"IVtkTools", -"IVtkVTK", +# "IVtk", +# "IVtkOCC", +# "IVtkTools", +# "IVtkVTK", "DE", "IMeshTools", "IMeshData", @@ -360,16 +360,37 @@ exclude = ["Standard_Handle.hxx","Standard", "Standard_MemoryUtils.hxx", "BRepMesh_NURBSRangeSplitter.hxx","BRepMesh_SphereRangeSplitter.hxx", "BRepMesh_TorusRangeSplitter.hxx","BRepMesh_UVParamRangeSplitter.hxx","OpenGl_GLESExtensions.hxx", "IVtk_IShapePickerAlgo.hxx","ProjLib_HCompProjectedCurve.hxx","ProjLib_HProjectedCurve.hxx", - "OSD_StreamBuffer.hxx" + "OSD_StreamBuffer.hxx","IntSurf_Allocator.hxx","Extrema_GGenExtCC.hxx", + "NCollection_ForwardRange.hxx", + "Graphic3d_MapIteratorOfMapOfStructure.hxx", + "TObj_Container.hxx", + "BOPDS_DataMapOfIntegerListOfPaveBlock.hxx", + "BOPDS_VectorOfListOfPaveBlock.hxx", + "BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx", + "BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx", ] # "BVH_Box.hxx","BVH_tools.hxx" exceptions = ["Standard_Failure"] +exclude_collection = [ +"Shared_Map_constStandard_Transient", +"Shared_IndexedMap_SelectMgr_EntityOwner", +"List_BRepCheck_Status", +"HArray1_StepDimTol_GeometricToleranceModifier", +"DataMap_TopoDS_Shape_RWMesh_NodeAttributes", +"Map_Graphic3d_Structure", +"Shared_Map_const Standard_Transient", +"Vec3_size_t", +"Vec2_unsigned int", +"Sequence_const gp_Pnt2d", +] + +collection_pattern = "NCollection" module_mapping = "lambda x: Path(x).splitpath()[-1].split('.')[0].split('_')[0]" -byref_types = ["Standard_Real","Standard_Integer","Standard_Boolean"] +byref_types = ["Standard_Real","Standard_Integer","Standard_Boolean","int","double","bool"] byref_types_smart_ptr = ["opencascade::handle", "handle", "Handle"] parsing_header = '''#pragma clang diagnostic ignored "-Wmacro-redefined" @@ -424,7 +445,7 @@ class Adaptor3d_Surface; [Attributes] - __version__ = "7.9.3.1" + __version__ = "8.0.0.0" [Modules] @@ -467,6 +488,38 @@ void register_template_NCollection_Vector(py::object &m, const char *name){ exclude_constructors = [3] + [Modules.NCollection.Templates.NCollection_DataMap] + + exclude_methods = ["Bound", "Seek", "ChangeSeek", "Contained"] + + [Modules.NCollection.Templates.NCollection_IndexedDataMap] + + exclude_methods = ["Seek", "ChangeSeek", "Contained"] + + [Modules.NCollection.Templates.NCollection_Map] + + exclude_methods = ["Contained"] + + [Modules.NCollection.Templates.NCollection_IndexedMap] + + exclude_methods = ["Contained"] + + [Modules.NCollection.Templates.NCollection_FlatDataMap] + + exclude_methods = ["Contained"] + + [Modules.NCollection.Templates.NCollection_FlatMap] + + exclude_methods = ["Contained"] + + [Modules.NCollection.Templates.NCollection_OrderedDataMap] + + exclude_methods = ["Contained"] + + [Modules.NCollection.Templates.NCollection_OrderedMap] + + exclude_methods = ["Contained"] + [Modules.NCollection.parsing_headers] "NCollection_CellFilter.hxx" = """#include @@ -492,26 +545,26 @@ void register_template_NCollection_Vector(py::object &m, const char *name){ [Modules.TCollection] - exclude_methods = ["TCollection_ExtendedString::ToUTF8CString"] - include_body_post = """py::implicitly_convertible(); -py::implicitly_convertible();""" - - [[Modules.TCollection.Classes.TCollection_HAsciiString.additional_constructors]] - - body = "[](const std::string &s){ return TCollection_HAsciiString(s.c_str()); }" - help = "std::strings based constructor" - arguments = ["aString"] - - [[Modules.TCollection.Classes.TCollection_AsciiString.additional_constructors]] - - body = "[](const std::string &s){ return TCollection_AsciiString(s.c_str()); }" - help = "std::strings based constructor" - arguments = ["aString"] + exclude_methods = ["TCollection_ExtendedString::ToUTF8CString", + "TCollection_AsciiString::operator+", + "TCollection_AsciiString::operator=", + "TCollection_AsciiString::operator==", + "TCollection_AsciiString::operator!=", + "TCollection_AsciiString::operator<", + "TCollection_AsciiString::operator>", + "TCollection_AsciiString::operator+=", + "TCollection_AsciiString::operator+", ] [Modules.TColStd] exclude_typedefs = ["TColStd_DataMapOfIntegerTransient","TColStd","TColStd_DataMapOfTransientTransient","TColStd_IndexedDataMapOfTransientTransient"] + include_header_pre = """ + #include "NCollection_tmpl.hxx" + """ + + custom_deps = ["NCollection","TCollection"] + [Modules.Plugin] exclude_typedefs = ["Plugin","Plugin_MapOfFunctions"] @@ -539,8 +592,6 @@ py::implicitly_convertible();""" include_header_pre = "#include " - exclude_typedefs = ["TopoDS_ListOfShape"] - [Modules.TopoDS.Classes.TopoDS_Shape.additional_methods.__bool__] body = "[]( const TopoDS_Shape & self ){ return !self.IsNull();}" @@ -615,7 +666,8 @@ py::implicitly_convertible();""" [Modules.HLRBRep] - exclude_classes = ["HLRBRep_CLPropsATool",] + exclude_classes = ["HLRBRep_CLPropsATool","HLRBRep_TheCSFunctionOfInterCSurf"] + exclude_methods = ["HLRBRep_TheCSFunctionOfInterCSurf::AuxillarySurface"] # return as const pointer (i.e. ... * const) [Modules.HLRBRep.parsing_headers] @@ -674,9 +726,9 @@ py::implicitly_convertible();""" [Modules.BRepFill.parsing_headers] - "BRepFill_Sweep.hxx" = "#include " "BRepFill_TrimShellCorner.hxx" = """#include #include """ + "BRepFill_Sweep.hxx" = """#include """ [Modules.ChFi3d] #error: invalid use of incomplete type ‘class Geom_BSplineCurve’ @@ -787,6 +839,7 @@ struct NSOpenGLContext {};""" [Modules.AIS] + # exclude_methods = ["AIS_InteractiveContext::EntityOwners"] include_header_pre = """#include #include auto OptionsForAttach = [](){return AIS_Manipulator::OptionsForAttach();};""" @@ -809,6 +862,8 @@ auto OptionsForAttach = [](){return AIS_Manipulator::OptionsForAttach();};""" exclude_typedefs = ["Select3D_IndexedMapOfEntity","Graphic3d_Vec3d","Select3D_BndBox3d"] #couldn't deduce template parameter ‘Hasher’ + # exclude_methods = ["Select3D_SensitiveFace::GetPoints","Select3D_SensitivePoly::Points3D", "Select3D_InteriorSensitivePointSet::GetPoints"] + [Modules.Select3D.Classes.Select3D_SensitiveCircle] exclude_constructors = [0,1] #missing vftable @@ -975,8 +1030,6 @@ struct NSOpenGLContext {};""" [Modules.ShapeFix] - include_header_pre_top = "#include " - [Modules.ShapeFix.parsing_headers] "ShapeFix_Solid.hxx" = "#include " @@ -1104,12 +1157,6 @@ struct __GLXFBConfigRec {};""" exclude_classes = ["StepData_EnumTool"] - [Modules.StepData.Classes.StepData_SelectType.additional_methods.SetValue] - - body = "[](StepData_SelectType &self , py::object& ent){self.SetValue(cast_pyobject(ent));}" - help = "SetValue supporting python objects" - arguments = ["ent"] - [Modules.LDOM] exclude_classes = ["LDOMString","LDOM_MemManager","LDOM_BasicText"] @@ -1127,6 +1174,7 @@ struct __GLXFBConfigRec {};""" [Modules.ShapeAnalysis] exclude_classes = ["ShapeAnalysis_BoxBndTreeSelector"] + # exlcude_methods = ["ShapeAnalysis_FreeBounds::ConnectEdgesToWires", "ShapeAnalysis_FreeBounds::ConnectWiresToWires","ShapeAnalysis_FreeBounds::SplitWires"] [Modules.V3d] @@ -1224,7 +1272,7 @@ using std::char_traits; using std::basic_istream; using rapidjson::BasicOStreamWrapper;""" - exclude_methods = ["RWGltf_GltfMaterialMap::AddGlbImages"] + exclude_methods = ["RWGltf_GltfMaterialMap::AddGlbImages", "RWGltf_GltfJsonParser::SetStream"] exclude_typedefs = ["RWGltf_GltfFaceList"] [Modules.RWGltf.parsing_headers] @@ -1239,9 +1287,6 @@ using rapidjson::BasicOStreamWrapper;""" "BRepApprox_SurfaceTool.hxx" = "#include " "BRepApprox_TheMultiLineToolOfApprox.hxx" = """ #include - #include - #include - #include """ [Modules.IntPatch] @@ -1250,11 +1295,6 @@ using rapidjson::BasicOStreamWrapper;""" "IntPatch_PolyhedronTool.hxx" = "#include " - [Modules.ShapeConstruct] - - [Modules.ShapeConstruct.parsing_headers] - - "ShapeConstruct_ProjectCurveOnSurface.hxx" = "#include " [Modules.HLRAlgo] @@ -1295,22 +1335,12 @@ using rapidjson::BasicOStreamWrapper;""" [Modules.Interface] + # exclude_methods = ["Interface_IntList::Internals", "Interface_STAT::Internals"] + [Modules.Interface.parsing_headers] "Interface_ValueInterpret.hxx" = "#include " - [Modules.Interface.Classes.Interface_InterfaceModel.additional_methods.AddEntity] - - body = "[](Interface_InterfaceModel &self , py::object& ent){self.AddEntity(cast_pyobject(ent));}" - help = "AddEntity supporting python objects" - arguments = ["anent"] - - [Modules.Interface.Classes.Interface_InterfaceModel.additional_methods.AddWithRefs] - - body = "[](Interface_InterfaceModel &self , py::object& ent){self.AddWithRefs(cast_pyobject(ent));}" - help = "AddWithRefs supporting python objects" - arguments = ["anent"] - [Modules.IVtkVTK] include_header_pre = """#include @@ -1354,18 +1384,12 @@ using rapidjson::BasicOStreamWrapper;""" include_header_pre = """ #include #include - #include - #include - #include """ [Modules.GeomInt.parsing_headers] "GeomInt_TheMultiLineToolOfWLApprox.hxx" = """ #include - #include - #include - #include """ [Modules.StepToGeom] @@ -1386,6 +1410,8 @@ using rapidjson::BasicOStreamWrapper;""" [Modules.BRepTopAdaptor] + exclude_classes = ["BRepTopAdaptor_FClass2d"] + [Modules.BRepTopAdaptor.parsing_headers] "BRepTopAdaptor_HVertex.hxx" = "#include " @@ -1412,6 +1438,8 @@ using rapidjson::BasicOStreamWrapper;""" [Modules.IGESGeom] + # exclude_methods = ["IGESGeom_SplineSurface::Polynomials"] + module_parsing_header = "#include " [Modules.IGESGraph] @@ -1424,6 +1452,8 @@ using rapidjson::BasicOStreamWrapper;""" [Modules.GeomConvert] + # exclude_methods = ["GeomConvert::ConcatG1","GeomConvert::ConcatC1","GeomConvert::C0BSplineToC1BSplineCurve","GeomConvert::C0BSplineToArrayOfC1BSplineCurve",] + [Modules.GeomConvert.parsing_headers] "GeomConvert_SurfToAnaSurf.hxx" = "class Geom_Curve; class gp_Ax3;" @@ -1527,7 +1557,60 @@ using rapidjson::BasicOStreamWrapper;""" [Modules.StepAP214] include_header_pre = "#include " + # + # [Modules.AppDef] + # + # exclude_methods = ["AppDef_SmoothCriterion::GetCurve","AppDef_LinearCriteria::GetCurve"] + # + # [Modules.BRepGProp] + # + # exclude_methods = ["BRepGProp_Face::GetUKnots", "BRepGProp_Face::GetTKnots", "BRepG_MeshCinert::PreparePolygon"] + # + # # [Modules.BSplCLib] + # # + # # exclude_methods =["BSplCLib::MergeBSplineKnots"] + # + # [Modules.Convert] + # + # exclude_methods = [ + # "Convert_CompPolynomialToPoles::Poles","Convert_CompPolynomialToPoles::Knots","Convert_CompPolynomialToPoles::Multiplicities", + # "Convert_ConicToBSplineCurve::BuildCosAndSin" + # ] + # + # [Modules.FEmTool] + # + # exclude_methods = ["FEmTool_Assembly::GetAssemblyTable"] + # + # [Modules.Geom2dConvert] + # + # exclude_methods = ["Geom2dConvert::ConcatG1","Geom2dConvert::ConcatC1","Geom2dConvert::C0BSplineToC1BSplineCurve","Geom2dConvert::C0BSplineToArrayOfC1BSplineCurve",] + # + # [Modules.GeomLib] + # + # exclude_methods = ["GeomLib::RemovePointsFromArray", "GeomLib::DensifyArray1OfReal"] + # + # [Modules.IntCurveSurface] + # + # exclude_methods = ["IntCurveSurface_TheHCurveTool::SamplePars"] + # + # [Modules.Plate] + # + # exclude_methods = ["Plate_Plate::CoefPol"] + # + # + # [Modules.ShapeExtend] + # + # exclude_methods = ["ShapeExtend::DispatchList"] + # + # + [Modules.math] + + exclude_methods = ["math_Matrix::operator="] # move assignemnt operator... + + [Modules.TopTools] - [Modules.RWMesh] + include_header_pre = """ + #include "NCollection_tmpl.hxx" + #include + """ - include_header_pre = "#include " diff --git a/opencascade/AIS.hxx b/opencascade/AIS.hxx index 7a69ed3b0..2abff513e 100644 --- a/opencascade/AIS.hxx +++ b/opencascade/AIS.hxx @@ -48,7 +48,7 @@ //! (equivalent to None.) If you want to give a particular type and signature to your interactive //! object, you must redefine the two virtual methods: Type and Signature. In the C++ inheritance //! structure of the package, each class representing a specific Interactive Object inherits -//! AIS_InteractiveObject. Among these inheriting classes, AIS_Relation functions as the abstract +//! AIS_InteractiveObject. Among these inheriting classes, PrsDim_Relation functions as the abstract //! mother class for tinheriting classes defining display of specific relational constraints and //! types of dimension. Some of these include: //! - display of constraints based on relations of symmetry, tangency, parallelism and diff --git a/opencascade/AIS_Animation.hxx b/opencascade/AIS_Animation.hxx index 485542dea..8fefc48a4 100644 --- a/opencascade/AIS_Animation.hxx +++ b/opencascade/AIS_Animation.hxx @@ -22,11 +22,11 @@ //! Structure defining current animation progress. struct AIS_AnimationProgress { - Standard_Real Pts; //!< global presentation timestamp - Standard_Real LocalPts; //!< presentation within current animation - // clang-format off - Standard_Real LocalNormalized; //!< normalized position within current animation within 0..1 range - // clang-format on + double Pts; //!< global presentation timestamp + double LocalPts; //!< presentation within current animation + // clang-format off + double LocalNormalized; //!< normalized position within current animation within 0..1 range + // clang-format on AIS_AnimationProgress() : Pts(-1.0), @@ -36,8 +36,6 @@ struct AIS_AnimationProgress } }; -DEFINE_STANDARD_HANDLE(AIS_Animation, Standard_Transient) - //! Class represents a basic animation class. //! AIS_Animation can be used as: //! @@ -82,56 +80,57 @@ public: Standard_EXPORT AIS_Animation(const TCollection_AsciiString& theAnimationName); //! Destruct object, clear arguments - Standard_EXPORT virtual ~AIS_Animation(); + Standard_EXPORT ~AIS_Animation() override; //! Animation name. const TCollection_AsciiString& Name() const { return myName; } public: //! @return start time of the animation in the timeline - Standard_Real StartPts() const { return myPtsStart; } + double StartPts() const { return myPtsStart; } //! Sets time limits for animation in the animation timeline - void SetStartPts(const Standard_Real thePtsStart) { myPtsStart = thePtsStart; } + void SetStartPts(const double thePtsStart) { myPtsStart = thePtsStart; } //! @return duration of the animation in the timeline - Standard_Real Duration() const { return Max(myOwnDuration, myChildrenDuration); } + double Duration() const { return (std::max)(myOwnDuration, myChildrenDuration); } //! Update total duration considering all animations on timeline. Standard_EXPORT void UpdateTotalDuration(); //! Return true if duration is defined. - Standard_Boolean HasOwnDuration() const { return myOwnDuration > 0.0; } + bool HasOwnDuration() const { return myOwnDuration > 0.0; } //! @return own duration of the animation in the timeline - Standard_Real OwnDuration() const { return myOwnDuration; } + double OwnDuration() const { return myOwnDuration; } //! Defines duration of the animation. - void SetOwnDuration(const Standard_Real theDuration) { myOwnDuration = theDuration; } + void SetOwnDuration(const double theDuration) { myOwnDuration = theDuration; } //! Add single animation to the timeline. //! @param theAnimation input animation - Standard_EXPORT void Add(const Handle(AIS_Animation)& theAnimation); + Standard_EXPORT void Add(const occ::handle& theAnimation); //! Clear animation timeline - remove all animations from it. Standard_EXPORT void Clear(); //! Return the child animation with the given name. - Standard_EXPORT Handle(AIS_Animation) Find(const TCollection_AsciiString& theAnimationName) const; + Standard_EXPORT occ::handle Find( + const TCollection_AsciiString& theAnimationName) const; //! Remove the child animation. - Standard_EXPORT Standard_Boolean Remove(const Handle(AIS_Animation)& theAnimation); + Standard_EXPORT bool Remove(const occ::handle& theAnimation); //! Replace the child animation. - Standard_EXPORT Standard_Boolean Replace(const Handle(AIS_Animation)& theAnimationOld, - const Handle(AIS_Animation)& theAnimationNew); + Standard_EXPORT bool Replace(const occ::handle& theAnimationOld, + const occ::handle& theAnimationNew); //! Clears own children and then copy child animations from another object. //! Copy also Start Time and Duration values. - Standard_EXPORT void CopyFrom(const Handle(AIS_Animation)& theOther); + Standard_EXPORT void CopyFrom(const occ::handle& theOther); //! Return sequence of child animations. - const NCollection_Sequence& Children() const { return myAnimations; } + const NCollection_Sequence>& Children() const { return myAnimations; } public: //! Start animation with internally defined timer instance. @@ -147,29 +146,29 @@ public: //! @param thePlaySpeed playback speed (1.0 means normal speed) //! @param theToUpdate flag to update defined animations to specified start position //! @param theToStopTimer flag to pause timer at the starting position - Standard_EXPORT virtual void StartTimer(const Standard_Real theStartPts, - const Standard_Real thePlaySpeed, - const Standard_Boolean theToUpdate, - const Standard_Boolean theToStopTimer = Standard_False); + Standard_EXPORT virtual void StartTimer(const double theStartPts, + const double thePlaySpeed, + const bool theToUpdate, + const bool theToStopTimer = false); //! Update single frame of animation, update timer state //! @return current time of timeline progress. - Standard_EXPORT virtual Standard_Real UpdateTimer(); + Standard_EXPORT virtual double UpdateTimer(); //! Return elapsed time. - Standard_Real ElapsedTime() const { return !myTimer.IsNull() ? myTimer->ElapsedTime() : 0.0; } + double ElapsedTime() const { return !myTimer.IsNull() ? myTimer->ElapsedTime() : 0.0; } //! Return playback timer. - const Handle(Media_Timer)& Timer() const { return myTimer; } + const occ::handle& Timer() const { return myTimer; } //! Set playback timer. - void SetTimer(const Handle(Media_Timer)& theTimer) { myTimer = theTimer; } + void SetTimer(const occ::handle& theTimer) { myTimer = theTimer; } public: //! Start animation. This method changes status of the animation to Started. //! This status defines whether animation is to be performed in the timeline or not. //! @param theToUpdate call Update() method - Standard_EXPORT virtual void Start(const Standard_Boolean theToUpdate); + Standard_EXPORT virtual void Start(const bool theToUpdate); //! Pause the process timeline. Standard_EXPORT virtual void Pause(); @@ -185,7 +184,7 @@ public: //! Update single frame of animation, update timer state //! @param[in] thePts the time moment within [0; Duration()] //! @return True if timeline is in progress - Standard_EXPORT virtual Standard_Boolean Update(const Standard_Real thePts); + Standard_EXPORT virtual bool Update(const double thePts); protected: //! Process one step of the animation according to the input time progress, including all @@ -205,15 +204,15 @@ protected: }; protected: - Handle(Media_Timer) myTimer; + occ::handle myTimer; - TCollection_AsciiString myName; //!< animation name - NCollection_Sequence myAnimations; //!< sequence of child animations + TCollection_AsciiString myName; //!< animation name + NCollection_Sequence> myAnimations; //!< sequence of child animations AnimationState myState; //!< animation state - started, stopped of paused - Standard_Real myPtsStart; //!< time of start in the timeline - Standard_Real myOwnDuration; //!< duration of animation excluding children - Standard_Real myChildrenDuration; //!< duration of animation including children + double myPtsStart; //!< time of start in the timeline + double myOwnDuration; //!< duration of animation excluding children + double myChildrenDuration; //!< duration of animation including children }; #endif // _AIS_Animation_HeaderFile diff --git a/opencascade/AIS_AnimationAxisRotation.hxx b/opencascade/AIS_AnimationAxisRotation.hxx index 5e5fc66a2..bd244fc29 100644 --- a/opencascade/AIS_AnimationAxisRotation.hxx +++ b/opencascade/AIS_AnimationAxisRotation.hxx @@ -29,21 +29,21 @@ public: //! @param[in] theAxis rotation axis //! @param[in] theAngleStart rotation angle at the start of animation //! @param[in] theAngleEnd rotation angle at the end of animation - Standard_EXPORT AIS_AnimationAxisRotation(const TCollection_AsciiString& theAnimationName, - const Handle(AIS_InteractiveContext)& theContext, - const Handle(AIS_InteractiveObject)& theObject, - const gp_Ax1& theAxis, - const Standard_Real theAngleStart, - const Standard_Real theAngleEnd); + Standard_EXPORT AIS_AnimationAxisRotation(const TCollection_AsciiString& theAnimationName, + const occ::handle& theContext, + const occ::handle& theObject, + const gp_Ax1& theAxis, + const double theAngleStart, + const double theAngleEnd); protected: //! Update the progress. - Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE; + Standard_EXPORT void update(const AIS_AnimationProgress& theProgress) override; private: - gp_Ax1 myRotAxis; //!< rotation axis - Standard_Real myAngleStart; //!< start angle for rotation - Standard_Real myAngleEnd; //!< end angle for rotation + gp_Ax1 myRotAxis; //!< rotation axis + double myAngleStart; //!< start angle for rotation + double myAngleEnd; //!< end angle for rotation }; #endif // _AIS_AnimationAxisRotation_HeaderFile diff --git a/opencascade/AIS_AnimationCamera.hxx b/opencascade/AIS_AnimationCamera.hxx index 0d0c1b62f..06c890d75 100644 --- a/opencascade/AIS_AnimationCamera.hxx +++ b/opencascade/AIS_AnimationCamera.hxx @@ -27,39 +27,37 @@ class AIS_AnimationCamera : public AIS_Animation public: //! Main constructor. Standard_EXPORT AIS_AnimationCamera(const TCollection_AsciiString& theAnimationName, - const Handle(V3d_View)& theView); + const occ::handle& theView); //! Return the target view. - const Handle(V3d_View)& View() const { return myView; } + const occ::handle& View() const { return myView; } //! Set target view. - void SetView(const Handle(V3d_View)& theView) { myView = theView; } + void SetView(const occ::handle& theView) { myView = theView; } //! Return camera start position. - const Handle(Graphic3d_Camera)& CameraStart() const { return myCamStart; } + const occ::handle& CameraStart() const { return myCamStart; } //! Define camera start position. - void SetCameraStart(const Handle(Graphic3d_Camera)& theCameraStart) + void SetCameraStart(const occ::handle& theCameraStart) { myCamStart = theCameraStart; } //! Return camera end position. - const Handle(Graphic3d_Camera)& CameraEnd() const { return myCamEnd; } + const occ::handle& CameraEnd() const { return myCamEnd; } //! Define camera end position. - void SetCameraEnd(const Handle(Graphic3d_Camera)& theCameraEnd) { myCamEnd = theCameraEnd; } + void SetCameraEnd(const occ::handle& theCameraEnd) { myCamEnd = theCameraEnd; } protected: //! Update the progress. - Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE; + Standard_EXPORT void update(const AIS_AnimationProgress& theProgress) override; protected: - Handle(V3d_View) myView; //!< view to setup camera - Handle(Graphic3d_Camera) myCamStart; //!< starting camera position - Handle(Graphic3d_Camera) myCamEnd; //!< end camera position + occ::handle myView; //!< view to setup camera + occ::handle myCamStart; //!< starting camera position + occ::handle myCamEnd; //!< end camera position }; -DEFINE_STANDARD_HANDLE(AIS_AnimationCamera, AIS_Animation) - #endif // _AIS_AnimationCamera_HeaderFile diff --git a/opencascade/AIS_AnimationObject.hxx b/opencascade/AIS_AnimationObject.hxx index 3b95b19af..7ea9fd065 100644 --- a/opencascade/AIS_AnimationObject.hxx +++ b/opencascade/AIS_AnimationObject.hxx @@ -32,18 +32,18 @@ public: //! @param[in] theTrsfStart local transformation at the start of animation (e.g. //! theObject->LocalTransformation()) //! @param[in] theTrsfEnd local transformation at the end of animation - Standard_EXPORT AIS_AnimationObject(const TCollection_AsciiString& theAnimationName, - const Handle(AIS_InteractiveContext)& theContext, - const Handle(AIS_InteractiveObject)& theObject, - const gp_Trsf& theTrsfStart, - const gp_Trsf& theTrsfEnd); + Standard_EXPORT AIS_AnimationObject(const TCollection_AsciiString& theAnimationName, + const occ::handle& theContext, + const occ::handle& theObject, + const gp_Trsf& theTrsfStart, + const gp_Trsf& theTrsfEnd); protected: //! Update the progress. - Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE; + Standard_EXPORT void update(const AIS_AnimationProgress& theProgress) override; private: - gp_TrsfNLerp myTrsfLerp; //!< interpolation tool + NCollection_Lerp myTrsfLerp; //!< interpolation tool }; #endif // _AIS_AnimationObject_HeaderFile diff --git a/opencascade/AIS_AttributeFilter.hxx b/opencascade/AIS_AttributeFilter.hxx index 264727476..75c865440 100644 --- a/opencascade/AIS_AttributeFilter.hxx +++ b/opencascade/AIS_AttributeFilter.hxx @@ -25,9 +25,6 @@ #include class SelectMgr_EntityOwner; -class AIS_AttributeFilter; -DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter) - //! Selects Interactive Objects, which have the desired width or color. //! The filter questions each Interactive Object in local //! context to determine whether it has an non-null @@ -52,55 +49,54 @@ public: //! Constructs an attribute filter object defined by the line //! width attribute aWidth. - Standard_EXPORT AIS_AttributeFilter(const Standard_Real aWidth); + Standard_EXPORT AIS_AttributeFilter(const double aWidth); //! Indicates that the Interactive Object has the color //! setting specified by the argument aCol at construction time. - Standard_Boolean HasColor() const { return hasC; } + bool HasColor() const { return hasC; } //! Indicates that the Interactive Object has the width //! setting specified by the argument aWidth at //! construction time. - Standard_Boolean HasWidth() const { return hasW; } + bool HasWidth() const { return hasW; } //! Sets the color. void SetColor(const Quantity_NameOfColor theCol) { myCol = theCol; - hasC = Standard_True; + hasC = true; } //! Sets the line width. - void SetWidth(const Standard_Real theWidth) + void SetWidth(const double theWidth) { myWid = theWidth; - hasW = Standard_True; + hasW = true; } //! Removes the setting for color from the filter. - void UnsetColor() { hasC = Standard_False; } + void UnsetColor() { hasC = false; } //! Removes the setting for width from the filter. - void UnsetWidth() { hasW = Standard_False; } + void UnsetWidth() { hasW = false; } //! Indicates that the selected Interactive Object passes //! the filter. The owner, anObj, can be either direct or //! user. A direct owner is the corresponding //! construction element, whereas a user is the //! compound shape of which the entity forms a part. - //! If the Interactive Object returns Standard_True + //! If the Interactive Object returns true //! when detected by the Local Context selector through //! the mouse, the object is kept; if not, it is rejected. - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const - Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& anObj) const override; DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter, SelectMgr_Filter) private: Quantity_NameOfColor myCol; - Standard_Real myWid; - Standard_Boolean hasC; - Standard_Boolean hasW; + double myWid; + bool hasC; + bool hasW; }; #endif // _AIS_AttributeFilter_HeaderFile diff --git a/opencascade/AIS_Axis.hxx b/opencascade/AIS_Axis.hxx index c41ea6d3a..c50f4b4d8 100644 --- a/opencascade/AIS_Axis.hxx +++ b/opencascade/AIS_Axis.hxx @@ -39,41 +39,41 @@ class AIS_Axis : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject) public: //! Initializes the line aComponent - Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent); + Standard_EXPORT AIS_Axis(const occ::handle& aComponent); //! initializes the axis2 position //! aComponent. The coordinate system used is right-handed. - Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, - const AIS_TypeOfAxis anAxisType); + Standard_EXPORT AIS_Axis(const occ::handle& aComponent, + const AIS_TypeOfAxis anAxisType); //! Initializes the axis1 position anAxis. - Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis); + Standard_EXPORT AIS_Axis(const occ::handle& anAxis); //! Initializes the ray as axis with start point and direction //! @param[in] theAxis Start point and direction of the ray //! @param[in] theLength Optional length of the ray (ray is infinite by default). - Standard_EXPORT AIS_Axis(const gp_Ax1& theAxis, const Standard_Real theLength = -1); + Standard_EXPORT AIS_Axis(const gp_Ax1& theAxis, const double theLength = -1); //! Returns the axis entity aComponent and identifies it //! as a component of a shape. - const Handle(Geom_Line)& Component() const { return myComponent; } + const occ::handle& Component() const { return myComponent; } //! Sets the coordinates of the lin aComponent. - Standard_EXPORT void SetComponent(const Handle(Geom_Line)& aComponent); + Standard_EXPORT void SetComponent(const occ::handle& aComponent); - //! Returns the position of axis2 and positions it by + //! Returns the position of axis2 and positions it by //! identifying it as the x, y, or z axis and giving its //! direction in 3D space. The coordinate system used is right-handed. - const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; } + const occ::handle& Axis2Placement() const { return myAx2; } //! Allows you to provide settings for aComponent:the //! position and direction of an axis in 3D space. The //! coordinate system used is right-handed. - Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent, - const AIS_TypeOfAxis anAxisType); + Standard_EXPORT void SetAxis2Placement(const occ::handle& aComponent, + const AIS_TypeOfAxis anAxisType); //! Constructs a new line to serve as the axis anAxis in 3D space. - Standard_EXPORT void SetAxis1Placement(const Handle(Geom_Axis1Placement)& anAxis); + Standard_EXPORT void SetAxis1Placement(const occ::handle& anAxis); //! Returns the type of axis. AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; } @@ -85,53 +85,47 @@ public: //! Returns a signature of 2 for axis datums. When you //! activate mode 2 by a signature, you pick AIS objects //! of type AIS_Axis. - Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; } + bool IsXYZAxis() const { return myIsXYZAxis; } //! Returns true if the interactive object accepts the display mode aMode. - Standard_EXPORT Standard_Boolean - AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE; + Standard_EXPORT bool AcceptDisplayMode(const int aMode) const override; - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; } + int Signature() const override { return 2; } - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } - Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& aColor) override; - Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE; + Standard_EXPORT void SetWidth(const double aValue) override; //! Set required visualization parameters. - Standard_EXPORT void SetDisplayAspect(const Handle(Prs3d_LineAspect)& theNewDatumAspect); + Standard_EXPORT void SetDisplayAspect(const occ::handle& theNewDatumAspect); - Standard_EXPORT void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; - Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; + Standard_EXPORT void UnsetWidth() override; private: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; Standard_EXPORT void ComputeFields(); private: - Handle(Geom_Line) myComponent; - Handle(Geom_Axis2Placement) myAx2; - gp_Pnt myPfirst; - gp_Pnt myPlast; - AIS_TypeOfAxis myTypeOfAxis; - Standard_Boolean myIsXYZAxis; - gp_Dir myDir; - Standard_Real myVal; - Standard_CString myText; - Handle(Prs3d_LineAspect) myLineAspect; + occ::handle myComponent; + occ::handle myAx2; + gp_Pnt myPfirst; + gp_Pnt myPlast; + AIS_TypeOfAxis myTypeOfAxis; + bool myIsXYZAxis; + gp_Dir myDir; + double myVal; + const char* myText; + occ::handle myLineAspect; }; -DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) - #endif // _AIS_Axis_HeaderFile diff --git a/opencascade/AIS_BadEdgeFilter.hxx b/opencascade/AIS_BadEdgeFilter.hxx index 8548449d6..621c527cd 100644 --- a/opencascade/AIS_BadEdgeFilter.hxx +++ b/opencascade/AIS_BadEdgeFilter.hxx @@ -19,16 +19,15 @@ #include -#include #include +#include +#include +#include #include #include class SelectMgr_EntityOwner; class TopoDS_Edge; -class AIS_BadEdgeFilter; -DEFINE_STANDARD_HANDLE(AIS_BadEdgeFilter, SelectMgr_Filter) - //! A Class class AIS_BadEdgeFilter : public SelectMgr_Filter { @@ -37,30 +36,25 @@ public: //! Constructs an empty filter object for bad edges. Standard_EXPORT AIS_BadEdgeFilter(); - Standard_EXPORT virtual Standard_Boolean ActsOn(const TopAbs_ShapeEnum aType) const - Standard_OVERRIDE; + Standard_EXPORT bool ActsOn(const TopAbs_ShapeEnum aType) const override; - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& EO) const - Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& EO) const override; - //! sets with current contour. used by - //! IsOk. - Standard_EXPORT void SetContour(const Standard_Integer Index); + //! sets with current contour. used by IsOk. + Standard_EXPORT void SetContour(const int Index); - //! Adds an edge to the list of non-selectionnable - //! edges. - Standard_EXPORT void AddEdge(const TopoDS_Edge& anEdge, const Standard_Integer Index); + //! Adds an edge to the list of non-selectable edges. + Standard_EXPORT void AddEdge(const TopoDS_Edge& anEdge, const int Index); - //! removes from the list of non-selectionnable edges + //! removes from the list of non-selectable edges //! all edges in the contour . - Standard_EXPORT void RemoveEdges(const Standard_Integer Index); + Standard_EXPORT void RemoveEdges(const int Index); DEFINE_STANDARD_RTTIEXT(AIS_BadEdgeFilter, SelectMgr_Filter) -protected: private: - TopTools_DataMapOfIntegerListOfShape myBadEdges; - Standard_Integer myContour; + NCollection_DataMap> myBadEdges; + int myContour; }; #endif // _AIS_BadEdgeFilter_HeaderFile diff --git a/opencascade/AIS_BaseAnimationObject.hxx b/opencascade/AIS_BaseAnimationObject.hxx index ecfdde37c..6411a35c6 100644 --- a/opencascade/AIS_BaseAnimationObject.hxx +++ b/opencascade/AIS_BaseAnimationObject.hxx @@ -26,9 +26,9 @@ protected: //! @param[in] theAnimationName animation identifier //! @param[in] theContext interactive context where object have been displayed //! @param[in] theObject object to apply local transformation - Standard_EXPORT AIS_BaseAnimationObject(const TCollection_AsciiString& theAnimationName, - const Handle(AIS_InteractiveContext)& theContext, - const Handle(AIS_InteractiveObject)& theObject); + Standard_EXPORT AIS_BaseAnimationObject(const TCollection_AsciiString& theAnimationName, + const occ::handle& theContext, + const occ::handle& theObject); //! Update the transformation. Standard_EXPORT void updateTrsf(const gp_Trsf& theTrsf); @@ -38,8 +38,8 @@ private: Standard_EXPORT void invalidateViewer(); protected: - Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed - Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location + occ::handle myContext; //!< context where object is displayed + occ::handle myObject; //!< presentation object to set location }; #endif // _AIS_BaseAnimationObject_HeaderFile diff --git a/opencascade/AIS_C0RegularityFilter.hxx b/opencascade/AIS_C0RegularityFilter.hxx index 54403456d..1c6b5658f 100644 --- a/opencascade/AIS_C0RegularityFilter.hxx +++ b/opencascade/AIS_C0RegularityFilter.hxx @@ -19,32 +19,28 @@ #include -#include +#include +#include +#include #include #include class TopoDS_Shape; class SelectMgr_EntityOwner; -class AIS_C0RegularityFilter; -DEFINE_STANDARD_HANDLE(AIS_C0RegularityFilter, SelectMgr_Filter) - class AIS_C0RegularityFilter : public SelectMgr_Filter { public: Standard_EXPORT AIS_C0RegularityFilter(const TopoDS_Shape& aShape); - Standard_EXPORT virtual Standard_Boolean ActsOn(const TopAbs_ShapeEnum aType) const - Standard_OVERRIDE; + Standard_EXPORT bool ActsOn(const TopAbs_ShapeEnum aType) const override; - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& EO) const - Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& EO) const override; DEFINE_STANDARD_RTTIEXT(AIS_C0RegularityFilter, SelectMgr_Filter) -protected: private: - TopTools_MapOfShape myMapOfEdges; + NCollection_Map myMapOfEdges; }; #endif // _AIS_C0RegularityFilter_HeaderFile diff --git a/opencascade/AIS_CameraFrustum.hxx b/opencascade/AIS_CameraFrustum.hxx index 8c6bda289..57676b629 100644 --- a/opencascade/AIS_CameraFrustum.hxx +++ b/opencascade/AIS_CameraFrustum.hxx @@ -39,30 +39,29 @@ public: Standard_EXPORT AIS_CameraFrustum(); //! Sets camera frustum. - Standard_EXPORT void SetCameraFrustum(const Handle(Graphic3d_Camera)& theCamera); + Standard_EXPORT void SetCameraFrustum(const occ::handle& theCamera); //! Setup custom color. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Restore default color. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Restore transparency setting. - Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; + Standard_EXPORT void UnsetTransparency() override; //! Return true if specified display mode is supported. - Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const - Standard_OVERRIDE; + Standard_EXPORT bool AcceptDisplayMode(const int theMode) const override; protected: //! Computes presentation of camera frustum. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; private: //! Fills triangles primitive array for camera frustum filling. @@ -72,9 +71,9 @@ private: void fillBorders(); protected: - NCollection_Array1 myPoints; //!< Array of points - Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for camera frustum filling - Handle(Graphic3d_ArrayOfSegments) myBorders; //!< Segments for camera frustum borders + NCollection_Array1> myPoints; //!< Array of points + occ::handle myTriangles; //!< Triangles for camera frustum filling + occ::handle myBorders; //!< Segments for camera frustum borders }; #endif // _AIS_CameraFrustum_HeaderFile diff --git a/opencascade/AIS_Chamf3dDimension.hxx b/opencascade/AIS_Chamf3dDimension.hxx deleted file mode 100644 index 92446f7ce..000000000 --- a/opencascade/AIS_Chamf3dDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_Chamf3dDimension_HeaderFile -#define _AIS_Chamf3dDimension_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_Chamf3dDimension AIS_Chamf3dDimension; - -#endif // _AIS_Chamf3dDimension_HeaderFile diff --git a/opencascade/AIS_Circle.hxx b/opencascade/AIS_Circle.hxx index a17fd569c..a5017a7a6 100644 --- a/opencascade/AIS_Circle.hxx +++ b/opencascade/AIS_Circle.hxx @@ -29,102 +29,97 @@ class AIS_Circle : public AIS_InteractiveObject public: //! Initializes this algorithm for constructing AIS circle //! datums initializes the circle aCircle - Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& aCircle); + Standard_EXPORT AIS_Circle(const occ::handle& aCircle); //! Initializes this algorithm for constructing AIS circle datums. //! Initializes the circle theCircle, the arc //! starting point theUStart, the arc ending point theUEnd, //! and the type of sensitivity theIsFilledCircleSens. - Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& theCircle, - const Standard_Real theUStart, - const Standard_Real theUEnd, - const Standard_Boolean theIsFilledCircleSens = Standard_False); + Standard_EXPORT AIS_Circle(const occ::handle& theCircle, + const double theUStart, + const double theUEnd, + const bool theIsFilledCircleSens = false); //! Returns index 6 by default. - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; } + int Signature() const override { return 6; } //! Indicates that the type of Interactive Object is a datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Returns the circle component defined in SetCircle. - const Handle(Geom_Circle)& Circle() const { return myComponent; } + const occ::handle& Circle() const { return myComponent; } //! Constructs instances of the starting point and the end //! point parameters, theU1 and theU2. - void Parameters(Standard_Real& theU1, Standard_Real& theU2) const + void Parameters(double& theU1, double& theU2) const { theU1 = myUStart; theU2 = myUEnd; } //! Allows you to provide settings for the circle datum aCircle. - void SetCircle(const Handle(Geom_Circle)& theCircle) { myComponent = theCircle; } + void SetCircle(const occ::handle& theCircle) { myComponent = theCircle; } //! Allows you to set the parameter theU for the starting point of an arc. - void SetFirstParam(const Standard_Real theU) + void SetFirstParam(const double theU) { myUStart = theU; - myCircleIsArc = Standard_True; + myCircleIsArc = true; } //! Allows you to provide the parameter theU for the end point of an arc. - void SetLastParam(const Standard_Real theU) + void SetLastParam(const double theU) { myUEnd = theU; - myCircleIsArc = Standard_True; + myCircleIsArc = true; } - Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& aColor) override; //! Assigns the width aValue to the solid line boundary of the circle datum. - Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE; + Standard_EXPORT void SetWidth(const double aValue) override; //! Removes color from the solid line boundary of the circle datum. - Standard_EXPORT void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Removes width settings from the solid line boundary of the circle datum. - Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; + Standard_EXPORT void UnsetWidth() override; //! Returns the type of sensitivity for the circle; - Standard_Boolean IsFilledCircleSens() const { return myIsFilledCircleSens; } + bool IsFilledCircleSens() const { return myIsFilledCircleSens; } - //! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True + //! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to true //! then the whole circle will be detectable, otherwise only the boundary of the circle. - void SetFilledCircleSens(const Standard_Boolean theIsFilledCircleSens) + void SetFilledCircleSens(const bool theIsFilledCircleSens) { myIsFilledCircleSens = theIsFilledCircleSens; } private: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& theprs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& theprs, + const int theMode) override; - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; - Standard_EXPORT void ComputeCircle(const Handle(Prs3d_Presentation)& aPresentation); + Standard_EXPORT void ComputeCircle(const occ::handle& aPresentation); - Standard_EXPORT void ComputeArc(const Handle(Prs3d_Presentation)& aPresentation); + Standard_EXPORT void ComputeArc(const occ::handle& aPresentation); - Standard_EXPORT void ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection); + Standard_EXPORT void ComputeCircleSelection(const occ::handle& aSelection); - Standard_EXPORT void ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection); + Standard_EXPORT void ComputeArcSelection(const occ::handle& aSelection); //! Replace aspects of already computed groups with the new value. - void replaceWithNewLineAspect(const Handle(Prs3d_LineAspect)& theAspect); + void replaceWithNewLineAspect(const occ::handle& theAspect); private: - Handle(Geom_Circle) myComponent; - Standard_Real myUStart; - Standard_Real myUEnd; - Standard_Boolean myCircleIsArc; - Standard_Boolean myIsFilledCircleSens; + occ::handle myComponent; + double myUStart; + double myUEnd; + bool myCircleIsArc; + bool myIsFilledCircleSens; }; -DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject) - #endif // _AIS_Circle_HeaderFile diff --git a/opencascade/AIS_ColorScale.hxx b/opencascade/AIS_ColorScale.hxx index 8a8fbfb30..5fe2bbcef 100644 --- a/opencascade/AIS_ColorScale.hxx +++ b/opencascade/AIS_ColorScale.hxx @@ -18,14 +18,11 @@ #include #include #include -#include +#include +#include #include #include #include -#include - -class AIS_ColorScale; -DEFINE_STANDARD_HANDLE(AIS_ColorScale, AIS_InteractiveObject) //! Class for drawing a custom color scale. //! @@ -41,27 +38,27 @@ class AIS_ColorScale : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_ColorScale, AIS_InteractiveObject) public: //! Calculate color according passed value; returns true if value is in range or false, if isn't - Standard_EXPORT static Standard_Boolean FindColor(const Standard_Real theValue, - const Standard_Real theMin, - const Standard_Real theMax, - const Standard_Integer theColorsCount, - const Graphic3d_Vec3d& theColorHlsMin, - const Graphic3d_Vec3d& theColorHlsMax, - Quantity_Color& theColor); + Standard_EXPORT static bool FindColor(const double theValue, + const double theMin, + const double theMax, + const int theColorsCount, + const NCollection_Vec3& theColorHlsMin, + const NCollection_Vec3& theColorHlsMax, + Quantity_Color& theColor); //! Calculate color according passed value; returns true if value is in range or false, if isn't - static Standard_Boolean FindColor(const Standard_Real theValue, - const Standard_Real theMin, - const Standard_Real theMax, - const Standard_Integer theColorsCount, - Quantity_Color& theColor) + static bool FindColor(const double theValue, + const double theMin, + const double theMax, + const int theColorsCount, + Quantity_Color& theColor) { return FindColor(theValue, theMin, theMax, theColorsCount, - Graphic3d_Vec3d(230.0, 1.0, 1.0), - Graphic3d_Vec3d(0.0, 1.0, 1.0), + NCollection_Vec3(230.0, 1.0, 1.0), + NCollection_Vec3(0.0, 1.0, 1.0), theColor); } @@ -69,9 +66,9 @@ public: //! Lightness and Saturation should be specified in valid range [0.0, 1.0], //! however Hue might be given out of Quantity_Color range to specify desired range for //! interpolation. - static Standard_Real hueToValidRange(const Standard_Real theHue) + static double hueToValidRange(const double theHue) { - Standard_Real aHue = theHue; + double aHue = theHue; while (aHue < 0.0) { aHue += 360.0; @@ -88,23 +85,22 @@ public: Standard_EXPORT AIS_ColorScale(); //! Calculate color according passed value; returns true if value is in range or false, if isn't - Standard_EXPORT Standard_Boolean FindColor(const Standard_Real theValue, - Quantity_Color& theColor) const; + Standard_EXPORT bool FindColor(const double theValue, Quantity_Color& theColor) const; //! Returns minimal value of color scale, 0.0 by default. - Standard_Real GetMin() const { return myMin; } + double GetMin() const { return myMin; } //! Sets the minimal value of color scale. - void SetMin(const Standard_Real theMin) { SetRange(theMin, GetMax()); } + void SetMin(const double theMin) { SetRange(theMin, GetMax()); } //! Returns maximal value of color scale, 1.0 by default. - Standard_Real GetMax() const { return myMax; } + double GetMax() const { return myMax; } //! Sets the maximal value of color scale. - void SetMax(const Standard_Real theMax) { SetRange(GetMin(), theMax); } + void SetMax(const double theMax) { SetRange(GetMin(), theMax); } //! Returns minimal and maximal values of color scale, 0.0 to 1.0 by default. - void GetRange(Standard_Real& theMin, Standard_Real& theMax) const + void GetRange(double& theMin, double& theMax) const { theMin = myMin; theMax = myMax; @@ -114,17 +110,17 @@ public: //! Note that values order will be ignored - the minimum and maximum values will be swapped if //! needed. //! ::SetReversed() should be called to swap displaying order. - Standard_EXPORT void SetRange(const Standard_Real theMin, const Standard_Real theMax); + Standard_EXPORT void SetRange(const double theMin, const double theMax); //! Returns the hue angle corresponding to minimum value, 230 by default (blue). - Standard_Real HueMin() const { return myColorHlsMin[0]; } + double HueMin() const { return myColorHlsMin[0]; } //! Returns the hue angle corresponding to maximum value, 0 by default (red). - Standard_Real HueMax() const { return myColorHlsMax[0]; } + double HueMax() const { return myColorHlsMax[0]; } //! Returns the hue angle range corresponding to minimum and maximum values, 230 to 0 by default //! (blue to red). - void HueRange(Standard_Real& theMinAngle, Standard_Real& theMaxAngle) const + void HueRange(double& theMinAngle, double& theMaxAngle) const { theMinAngle = myColorHlsMin[0]; theMaxAngle = myColorHlsMax[0]; @@ -132,7 +128,7 @@ public: //! Sets hue angle range corresponding to minimum and maximum values. //! The valid angle range is [0, 360], see Quantity_Color and Quantity_TOC_HLS for more details. - void SetHueRange(const Standard_Real theMinAngle, const Standard_Real theMaxAngle) + void SetHueRange(const double theMinAngle, const double theMaxAngle) { myColorHlsMin[0] = theMinAngle; myColorHlsMax[0] = theMaxAngle; @@ -179,10 +175,10 @@ public: void SetColorType(const Aspect_TypeOfColorScaleData theType) { myColorType = theType; } //! Returns the number of color scale intervals, 10 by default. - Standard_Integer GetNumberOfIntervals() const { return myNbIntervals; } + int GetNumberOfIntervals() const { return myNbIntervals; } //! Sets the number of color scale intervals. - Standard_EXPORT void SetNumberOfIntervals(const Standard_Integer theNum); + Standard_EXPORT void SetNumberOfIntervals(const int theNum); //! Returns the color scale title string, empty string by default. const TCollection_ExtendedString& GetTitle() const { return myTitle; } @@ -205,25 +201,24 @@ public: //! Index is in range from 1 to GetNumberOfIntervals() or to //! GetNumberOfIntervals() + 1 if IsLabelAtBorder() is true. //! Returns empty string if label not defined. - Standard_EXPORT TCollection_ExtendedString GetLabel(const Standard_Integer theIndex) const; + Standard_EXPORT TCollection_ExtendedString GetLabel(const int theIndex) const; //! Returns the user specified color from color map with index (starts at 1). //! Returns default color if index is out of range in color map. - Standard_EXPORT Quantity_Color GetIntervalColor(const Standard_Integer theIndex) const; + Standard_EXPORT Quantity_Color GetIntervalColor(const int theIndex) const; //! Sets the color of the specified interval. //! Note that list is automatically resized to include specified index. //! @param theColor color value to set //! @param theIndex index in range [1, GetNumberOfIntervals()]; //! appended to the end of list if -1 is specified - Standard_EXPORT void SetIntervalColor(const Quantity_Color& theColor, - const Standard_Integer theIndex); + Standard_EXPORT void SetIntervalColor(const Quantity_Color& theColor, const int theIndex); //! Returns the user specified labels. - Standard_EXPORT void GetLabels(TColStd_SequenceOfExtendedString& theLabels) const; + Standard_EXPORT void GetLabels(NCollection_Sequence& theLabels) const; //! Returns the user specified labels. - const TColStd_SequenceOfExtendedString& Labels() const { return myLabels; } + const NCollection_Sequence& Labels() const { return myLabels; } //! Sets the color scale labels. //! The length of the sequence should be equal to GetNumberOfIntervals() or to @@ -231,25 +226,23 @@ public: //! much the number of intervals, then these labels will be considered as "free" and will be //! located at the virtual intervals corresponding to the number of labels (with flag //! IsLabelAtBorder() having the same effect as in normal case). - Standard_EXPORT void SetLabels(const TColStd_SequenceOfExtendedString& theSeq); + Standard_EXPORT void SetLabels(const NCollection_Sequence& theSeq); //! Returns the user specified colors. - Standard_EXPORT void GetColors(Aspect_SequenceOfColor& theColors) const; + Standard_EXPORT void GetColors(NCollection_Sequence& theColors) const; //! Returns the user specified colors. - const Aspect_SequenceOfColor& GetColors() const { return myColors; } + const NCollection_Sequence& GetColors() const { return myColors; } //! Sets the color scale colors. //! The length of the sequence should be equal to GetNumberOfIntervals(). - Standard_EXPORT void SetColors(const Aspect_SequenceOfColor& theSeq); + Standard_EXPORT void SetColors(const NCollection_Sequence& theSeq); //! Populates colors scale by colors of the same lightness value in CIE Lch //! color space, distributed by hue, with perceptually uniform differences //! between consequent colors. //! See MakeUniformColors() for description of parameters. - void SetUniformColors(Standard_Real theLightness, - Standard_Real theHueFrom, - Standard_Real theHueTo) + void SetUniformColors(double theLightness, double theHueFrom, double theHueTo) { SetColors(MakeUniformColors(myNbIntervals, theLightness, theHueFrom, theHueTo)); SetColorType(Aspect_TOCSD_USER); @@ -270,10 +263,10 @@ public: //! Hue value can be out of the range [0, 360], interpreted as modulo 360. //! The colors of the scale will be in the order of increasing hue if //! theHueTo > theHueFrom, and decreasing otherwise. - Standard_EXPORT static Aspect_SequenceOfColor MakeUniformColors(Standard_Integer theNbColors, - Standard_Real theLightness, - Standard_Real theHueFrom, - Standard_Real theHueTo); + Standard_EXPORT static NCollection_Sequence MakeUniformColors(int theNbColors, + double theLightness, + double theHueFrom, + double theHueTo); //! Returns the position of labels concerning color filled rectangles, Aspect_TOCSP_RIGHT by //! default. @@ -287,39 +280,38 @@ public: //! Sets the color scale title position. Standard_DEPRECATED("AIS_ColorScale::SetTitlePosition() has no effect!") - void SetTitlePosition(const Aspect_TypeOfColorScalePosition thePos) { myTitlePos = thePos; } //! Returns TRUE if the labels and colors used in reversed order, FALSE by default. //! - Normal, bottom-up order with Minimal value on the Bottom and Maximum value on Top. //! - Reversed, top-down order with Maximum value on the Bottom and Minimum value on Top. - Standard_Boolean IsReversed() const { return myIsReversed; } + bool IsReversed() const { return myIsReversed; } //! Sets true if the labels and colors used in reversed order. - void SetReversed(const Standard_Boolean theReverse) { myIsReversed = theReverse; } + void SetReversed(const bool theReverse) { myIsReversed = theReverse; } //! Return TRUE if color transition between neighbor intervals //! should be linearly interpolated, FALSE by default. - Standard_Boolean IsSmoothTransition() const { return myIsSmooth; } + bool IsSmoothTransition() const { return myIsSmooth; } //! Setup smooth color transition. - void SetSmoothTransition(const Standard_Boolean theIsSmooth) { myIsSmooth = theIsSmooth; } + void SetSmoothTransition(const bool theIsSmooth) { myIsSmooth = theIsSmooth; } //! Returns TRUE if the labels are placed at border of color intervals, TRUE by default. //! The automatically generated label will show value exactly on the current position: //! - value connecting two neighbor intervals (TRUE) //! - value in the middle of interval (FALSE) - Standard_Boolean IsLabelAtBorder() const { return myIsLabelAtBorder; } + bool IsLabelAtBorder() const { return myIsLabelAtBorder; } //! Sets true if the labels are placed at border of color intervals (TRUE by default). //! If set to False, labels will be drawn at color intervals rather than at borders. - void SetLabelAtBorder(const Standard_Boolean theOn) { myIsLabelAtBorder = theOn; } + void SetLabelAtBorder(const bool theOn) { myIsLabelAtBorder = theOn; } //! Returns TRUE if the color scale has logarithmic intervals, FALSE by default. - Standard_Boolean IsLogarithmic() const { return myIsLogarithmic; } + bool IsLogarithmic() const { return myIsLogarithmic; } //! Sets true if the color scale has logarithmic intervals. - void SetLogarithmic(const Standard_Boolean isLogarithmic) { myIsLogarithmic = isLogarithmic; } + void SetLogarithmic(const bool isLogarithmic) { myIsLogarithmic = isLogarithmic; } //! Sets the color scale label at index. //! Note that list is automatically resized to include specified index. @@ -327,19 +319,18 @@ public: //! @param theIndex index in range [1, GetNumberOfIntervals()] or [1, GetNumberOfIntervals() + 1] //! if IsLabelAtBorder() is true; //! label is appended to the end of list if negative index is specified - Standard_EXPORT void SetLabel(const TCollection_ExtendedString& theLabel, - const Standard_Integer theIndex); + Standard_EXPORT void SetLabel(const TCollection_ExtendedString& theLabel, const int theIndex); //! Returns the size of color bar, 0 and 0 by default //! (e.g. should be set by user explicitly before displaying). - void GetSize(Standard_Integer& theBreadth, Standard_Integer& theHeight) const + void GetSize(int& theBreadth, int& theHeight) const { theBreadth = myBreadth; theHeight = myHeight; } //! Sets the size of color bar. - void SetSize(const Standard_Integer theBreadth, const Standard_Integer theHeight) + void SetSize(const int theBreadth, const int theHeight) { myBreadth = theBreadth; myHeight = theHeight; @@ -347,80 +338,77 @@ public: //! Returns the breadth of color bar, 0 by default //! (e.g. should be set by user explicitly before displaying). - Standard_Integer GetBreadth() const { return myBreadth; } + int GetBreadth() const { return myBreadth; } //! Sets the width of color bar. - void SetBreadth(const Standard_Integer theBreadth) { myBreadth = theBreadth; } + void SetBreadth(const int theBreadth) { myBreadth = theBreadth; } //! Returns the height of color bar, 0 by default //! (e.g. should be set by user explicitly before displaying). - Standard_Integer GetHeight() const { return myHeight; } + int GetHeight() const { return myHeight; } //! Sets the height of color bar. - void SetHeight(const Standard_Integer theHeight) { myHeight = theHeight; } + void SetHeight(const int theHeight) { myHeight = theHeight; } //! Returns the bottom-left position of color scale, 0x0 by default. - void GetPosition(Standard_Real& theX, Standard_Real& theY) const + void GetPosition(double& theX, double& theY) const { theX = myXPos; theY = myYPos; } //! Sets the position of color scale. - void SetPosition(const Standard_Integer theX, const Standard_Integer theY) + void SetPosition(const int theX, const int theY) { myXPos = theX; myYPos = theY; } //! Returns the left position of color scale, 0 by default. - Standard_Integer GetXPosition() const { return myXPos; } + int GetXPosition() const { return myXPos; } //! Sets the left position of color scale. - void SetXPosition(const Standard_Integer theX) { myXPos = theX; } + void SetXPosition(const int theX) { myXPos = theX; } //! Returns the bottom position of color scale, 0 by default. - Standard_Integer GetYPosition() const { return myYPos; } + int GetYPosition() const { return myYPos; } //! Sets the bottom position of color scale. - void SetYPosition(const Standard_Integer theY) { myYPos = theY; } + void SetYPosition(const int theY) { myYPos = theY; } //! Returns the font height of text labels, 20 by default. - Standard_Integer GetTextHeight() const { return myTextHeight; } + int GetTextHeight() const { return myTextHeight; } //! Sets the height of text of color scale. - void SetTextHeight(const Standard_Integer theHeight) { myTextHeight = theHeight; } + void SetTextHeight(const int theHeight) { myTextHeight = theHeight; } public: //! Returns the width of text. //! @param[in] theText the text of which to calculate width. - Standard_EXPORT Standard_Integer TextWidth(const TCollection_ExtendedString& theText) const; + Standard_EXPORT int TextWidth(const TCollection_ExtendedString& theText) const; //! Returns the height of text. //! @param[in] theText the text of which to calculate height. - Standard_EXPORT Standard_Integer TextHeight(const TCollection_ExtendedString& theText) const; + Standard_EXPORT int TextHeight(const TCollection_ExtendedString& theText) const; Standard_EXPORT void TextSize(const TCollection_ExtendedString& theText, - const Standard_Integer theHeight, - Standard_Integer& theWidth, - Standard_Integer& theAscent, - Standard_Integer& theDescent) const; + const int theHeight, + int& theWidth, + int& theAscent, + int& theDescent) const; public: //! Return true if specified display mode is supported. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Compute presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePresentation, + const int theMode) override; //! Compute selection - not implemented for color scale. - virtual void ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/, - const Standard_Integer /*aMode*/) Standard_OVERRIDE + void ComputeSelection(const occ::handle& /*aSelection*/, + const int /*aMode*/) override { } @@ -428,18 +416,18 @@ private: //! Returns the size of color scale. //! @param[out] theWidth the width of color scale. //! @param[out] theHeight the height of color scale. - void SizeHint(Standard_Integer& theWidth, Standard_Integer& theHeight) const; + void SizeHint(int& theWidth, int& theHeight) const; //! Returns the upper value of given interval, or minimum for theIndex = 0. - Standard_Real GetIntervalValue(const Standard_Integer theIndex) const; + double GetIntervalValue(const int theIndex) const; //! Returns the color for the given value in the given interval. //! @param[in] theValue the current value of interval //! @param[in] theMin the min value of interval //! @param[in] theMax the max value of interval - Quantity_Color colorFromValue(const Standard_Real theValue, - const Standard_Real theMin, - const Standard_Real theMax) const; + Quantity_Color colorFromValue(const double theValue, + const double theMin, + const double theMax) const; //! Initialize text aspect for drawing the labels. void updateTextAspect(); @@ -450,29 +438,29 @@ private: //! @param[in] theX X coordinate of text position //! @param[in] theY Y coordinate of text position //! @param[in] theVertAlignment text vertical alignment - void drawText(const Handle(Graphic3d_Group)& theGroup, + void drawText(const occ::handle& theGroup, const TCollection_ExtendedString& theText, - const Standard_Integer theX, - const Standard_Integer theY, + const int theX, + const int theY, const Graphic3d_VerticalTextAlignment theVertAlignment); //! Determine the maximum text label width in pixels. - Standard_Integer computeMaxLabelWidth(const TColStd_SequenceOfExtendedString& theLabels) const; + int computeMaxLabelWidth(const NCollection_Sequence& theLabels) const; //! Draw labels. - void drawLabels(const Handle(Graphic3d_Group)& theGroup, - const TColStd_SequenceOfExtendedString& theLabels, - const Standard_Integer theBarBottom, - const Standard_Integer theBarHeight, - const Standard_Integer theMaxLabelWidth, - const Standard_Integer theColorBreadth); + void drawLabels(const occ::handle& theGroup, + const NCollection_Sequence& theLabels, + const int theBarBottom, + const int theBarHeight, + const int theMaxLabelWidth, + const int theColorBreadth); //! Draw a color bar. - void drawColorBar(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theBarBottom, - const Standard_Integer theBarHeight, - const Standard_Integer theMaxLabelWidth, - const Standard_Integer theColorBreadth); + void drawColorBar(const occ::handle& thePrs, + const int theBarBottom, + const int theBarHeight, + const int theMaxLabelWidth, + const int theColorBreadth); //! Draw a frame. //! @param[in] theX the X coordinate of frame position. @@ -480,39 +468,39 @@ private: //! @param[in] theWidth the width of frame. //! @param[in] theHeight the height of frame. //! @param[in] theColor the color of frame. - void drawFrame(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theX, - const Standard_Integer theY, - const Standard_Integer theWidth, - const Standard_Integer theHeight, - const Quantity_Color& theColor); + void drawFrame(const occ::handle& thePrs, + const int theX, + const int theY, + const int theWidth, + const int theHeight, + const Quantity_Color& theColor); private: - Standard_Real myMin; //!< values range - minimal value - Standard_Real myMax; //!< values range - maximal value + double myMin; //!< values range - minimal value + double myMax; //!< values range - maximal value // clang-format off - Graphic3d_Vec3d myColorHlsMin; //!< HLS color corresponding to minimum value - Graphic3d_Vec3d myColorHlsMax; //!< HLS color corresponding to maximum value + NCollection_Vec3 myColorHlsMin; //!< HLS color corresponding to minimum value + NCollection_Vec3 myColorHlsMax; //!< HLS color corresponding to maximum value TCollection_ExtendedString myTitle; //!< optional title string - TCollection_AsciiString myFormat; //!< sprintf() format for generating label from value - Standard_Integer myNbIntervals; //!< number of intervals + TCollection_AsciiString myFormat; //!< Sprintf() format for generating label from value + int myNbIntervals; //!< number of intervals Aspect_TypeOfColorScaleData myColorType; //!< color type Aspect_TypeOfColorScaleData myLabelType; //!< label type - Standard_Boolean myIsLabelAtBorder; //!< at border - Standard_Boolean myIsReversed; //!< flag indicating reversed order - Standard_Boolean myIsLogarithmic; //!< flag indicating logarithmic scale - Standard_Boolean myIsSmooth; //!< flag indicating smooth transition between the colors - Aspect_SequenceOfColor myColors; //!< sequence of custom colors - TColStd_SequenceOfExtendedString myLabels; //!< sequence of custom text labels + bool myIsLabelAtBorder; //!< at border + bool myIsReversed; //!< flag indicating reversed order + bool myIsLogarithmic; //!< flag indicating logarithmic scale + bool myIsSmooth; //!< flag indicating smooth transition between the colors + NCollection_Sequence myColors; //!< sequence of custom colors + NCollection_Sequence myLabels; //!< sequence of custom text labels Aspect_TypeOfColorScalePosition myLabelPos; //!< label position relative to the color scale // clang-format on Aspect_TypeOfColorScalePosition myTitlePos; //!< title position - Standard_Integer myXPos; //!< left position - Standard_Integer myYPos; //!< bottom position - Standard_Integer myBreadth; //!< color scale breadth - Standard_Integer myHeight; //!< height of the color scale - Standard_Integer mySpacing; //!< extra spacing between element - Standard_Integer myTextHeight; //!< label font height + int myXPos; //!< left position + int myYPos; //!< bottom position + int myBreadth; //!< color scale breadth + int myHeight; //!< height of the color scale + int mySpacing; //!< extra spacing between element + int myTextHeight; //!< label font height }; #endif diff --git a/opencascade/AIS_ColoredDrawer.hxx b/opencascade/AIS_ColoredDrawer.hxx index 9c3b92426..e1b80cf62 100644 --- a/opencascade/AIS_ColoredDrawer.hxx +++ b/opencascade/AIS_ColoredDrawer.hxx @@ -23,7 +23,7 @@ class AIS_ColoredDrawer : public Prs3d_Drawer DEFINE_STANDARD_RTTIEXT(AIS_ColoredDrawer, Prs3d_Drawer) public: //! Default constructor. - AIS_ColoredDrawer(const Handle(Prs3d_Drawer)& theLink) + AIS_ColoredDrawer(const occ::handle& theLink) : myIsHidden(false), myHasOwnMaterial(false), myHasOwnColor(false), @@ -53,13 +53,13 @@ public: void UnsetOwnTransparency() { myHasOwnTransp = false; } - void SetOwnTransparency(Standard_Real /*theTransp*/) { myHasOwnTransp = true; } + void SetOwnTransparency(double /*theTransp*/) { myHasOwnTransp = true; } bool HasOwnWidth() const { return myHasOwnWidth; } void UnsetOwnWidth() { myHasOwnWidth = false; } - void SetOwnWidth(const Standard_Real /*theWidth*/) { myHasOwnWidth = true; } + void SetOwnWidth(const double /*theWidth*/) { myHasOwnWidth = true; } public: //! @name list of overridden properties bool myIsHidden; @@ -69,6 +69,4 @@ public: //! @name list of overridden properties bool myHasOwnWidth; }; -DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, Prs3d_Drawer) - #endif // _AIS_ColoredDrawer_HeaderFile diff --git a/opencascade/AIS_ColoredShape.hxx b/opencascade/AIS_ColoredShape.hxx index 2997c0bf9..2c22ecea5 100644 --- a/opencascade/AIS_ColoredShape.hxx +++ b/opencascade/AIS_ColoredShape.hxx @@ -16,11 +16,14 @@ #ifndef _AIS_ColoredShape_HeaderFile #define _AIS_ColoredShape_HeaderFile -#include +#include +#include +#include #include #include #include -#include +#include +#include class StdSelect_BRepOwner; @@ -32,72 +35,78 @@ public: Standard_EXPORT AIS_ColoredShape(const TopoDS_Shape& theShape); //! Copy constructor - Standard_EXPORT AIS_ColoredShape(const Handle(AIS_Shape)& theShape); + Standard_EXPORT AIS_ColoredShape(const occ::handle& theShape); public: //! @name sub-shape aspects //! Customize properties of specified sub-shape. //! The shape will be stored in the map but ignored, if it is not sub-shape of main Shape! //! This method can be used to mark sub-shapes with customizable properties. - Standard_EXPORT virtual Handle(AIS_ColoredDrawer) CustomAspects(const TopoDS_Shape& theShape); + Standard_EXPORT virtual occ::handle CustomAspects( + const TopoDS_Shape& theShape); //! Reset the map of custom sub-shape aspects. Standard_EXPORT virtual void ClearCustomAspects(); //! Reset custom properties of specified sub-shape. //! @param theToUnregister unregister or not sub-shape from the map - Standard_EXPORT void UnsetCustomAspects(const TopoDS_Shape& theShape, - const Standard_Boolean theToUnregister = Standard_False); + Standard_EXPORT void UnsetCustomAspects(const TopoDS_Shape& theShape, + const bool theToUnregister = false); //! Customize color of specified sub-shape Standard_EXPORT void SetCustomColor(const TopoDS_Shape& theShape, const Quantity_Color& theColor); //! Customize transparency of specified sub-shape - Standard_EXPORT void SetCustomTransparency(const TopoDS_Shape& theShape, - Standard_Real theTransparency); + Standard_EXPORT void SetCustomTransparency(const TopoDS_Shape& theShape, double theTransparency); //! Customize line width of specified sub-shape - Standard_EXPORT void SetCustomWidth(const TopoDS_Shape& theShape, - const Standard_Real theLineWidth); + Standard_EXPORT void SetCustomWidth(const TopoDS_Shape& theShape, const double theLineWidth); //! Return the map of custom aspects. - const AIS_DataMapOfShapeDrawer& CustomAspectsMap() const { return myShapeColors; } + const NCollection_DataMap, TopTools_ShapeMapHasher>& + CustomAspectsMap() const + { + return myShapeColors; + } //! Return the map of custom aspects. - AIS_DataMapOfShapeDrawer& ChangeCustomAspectsMap() { return myShapeColors; } + NCollection_DataMap, TopTools_ShapeMapHasher>& + ChangeCustomAspectsMap() + { + return myShapeColors; + } public: //! @name global aspects //! Setup color of entire shape. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Setup line width of entire shape. - Standard_EXPORT virtual void SetWidth(const Standard_Real theLineWidth) Standard_OVERRIDE; + Standard_EXPORT void SetWidth(const double theLineWidth) override; //! Sets transparency value. - Standard_EXPORT virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE; + Standard_EXPORT void SetTransparency(const double theValue) override; //! Sets the material aspect. - Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theAspect) - Standard_OVERRIDE; + Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& theAspect) override; public: //! Removes the setting for transparency in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; + Standard_EXPORT void UnsetTransparency() override; //! Setup line width of entire shape. - Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE; + Standard_EXPORT void UnsetWidth() override; protected: //! @name override presentation computation //! Compute presentation considering sub-shape color map. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection considering sub-shape hidden state. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; protected: - typedef NCollection_IndexedDataMap + typedef NCollection_IndexedDataMap, TopoDS_Compound> DataMapOfDrawerCompd; protected: @@ -109,20 +118,24 @@ protected: //! @param theIsParentClosed flag indicating that specified shape is part of closed Solid //! @param theDrawerOpenedShapePerType the array of shape types to fill //! @param theDrawerClosedFaces the map for closed faces - Standard_EXPORT static Standard_Boolean dispatchColors( - const Handle(AIS_ColoredDrawer)& theParentDrawer, - const TopoDS_Shape& theShapeToParse, - const AIS_DataMapOfShapeDrawer& theShapeDrawerMap, - const TopAbs_ShapeEnum theParentType, - const Standard_Boolean theIsParentClosed, - DataMapOfDrawerCompd* theDrawerOpenedShapePerType, - DataMapOfDrawerCompd& theDrawerClosedFaces); + Standard_EXPORT static bool dispatchColors( + const occ::handle& theParentDrawer, + const TopoDS_Shape& theShapeToParse, + const NCollection_DataMap, + TopTools_ShapeMapHasher>& theShapeDrawerMap, + const TopAbs_ShapeEnum theParentType, + const bool theIsParentClosed, + DataMapOfDrawerCompd* theDrawerOpenedShapePerType, + DataMapOfDrawerCompd& theDrawerClosedFaces); protected: //! Extract myShapeColors map (KeyshapeColored -> Color) to subshapes map (Subshape -> Color). //! This needed when colored shape is not part of BaseShape (but subshapes are) and actually //! container for subshapes. - Standard_EXPORT void fillSubshapeDrawerMap(AIS_DataMapOfShapeDrawer& theSubshapeDrawerMap) const; + Standard_EXPORT void fillSubshapeDrawerMap( + NCollection_DataMap, TopTools_ShapeMapHasher>& + theSubshapeDrawerMap) const; //! Add shape to presentation //! @param thePrs the presentation @@ -130,13 +143,13 @@ protected: //! @param theDrawerClosedFaces the map of attributes for closed faces //! @param theMode display mode Standard_EXPORT void addShapesWithCustomProps( - const Handle(Prs3d_Presentation)& thePrs, - const DataMapOfDrawerCompd* theDrawerOpenedShapePerType, - const DataMapOfDrawerCompd& theDrawerClosedFaces, - const Standard_Integer theMode); + const occ::handle& thePrs, + const DataMapOfDrawerCompd* theDrawerOpenedShapePerType, + const DataMapOfDrawerCompd& theDrawerClosedFaces, + const int theMode); //! Check all shapes from myShapeColorsfor visibility - Standard_EXPORT Standard_Boolean isShapeEntirelyVisible() const; + Standard_EXPORT bool isShapeEntirelyVisible() const; //! Resolve (parse) theKeyShape into subshapes, search in they for theBaseShape, //! bind all resolved subshapes with theOriginKeyShape and store all binds in theShapeDrawerMap @@ -145,9 +158,11 @@ protected: //! @param theKeyShape a shape to be resolved (parse) into smaller (in topological sense) //! subshapes for new bind cycle //! @param theDrawer assigned drawer - Standard_EXPORT void bindSubShapes(AIS_DataMapOfShapeDrawer& theShapeDrawerMap, - const TopoDS_Shape& theKeyShape, - const Handle(AIS_ColoredDrawer)& theDrawer) const; + Standard_EXPORT void bindSubShapes( + NCollection_DataMap, TopTools_ShapeMapHasher>& + theShapeDrawerMap, + const TopoDS_Shape& theKeyShape, + const occ::handle& theDrawer) const; //! Add sub-shape to selection considering hidden state (recursively). //! @param theParentDrawer drawer of parent shape @@ -158,23 +173,25 @@ protected: //! @param theTypOfSel type of selection //! @param theDeflection linear deflection //! @param theDeflAngle angular deflection - Standard_EXPORT void computeSubshapeSelection(const Handle(AIS_ColoredDrawer)& theParentDrawer, - const AIS_DataMapOfShapeDrawer& theShapeDrawerMap, - const TopoDS_Shape& theShape, - const Handle(StdSelect_BRepOwner)& theOwner, - const Handle(SelectMgr_Selection)& theSelection, - const TopAbs_ShapeEnum theTypOfSel, - const Standard_Integer thePriority, - const Standard_Real theDeflection, - const Standard_Real theDeflAngle); + Standard_EXPORT void computeSubshapeSelection( + const occ::handle& theParentDrawer, + const NCollection_DataMap, + TopTools_ShapeMapHasher>& theShapeDrawerMap, + const TopoDS_Shape& theShape, + const occ::handle& theOwner, + const occ::handle& theSelection, + const TopAbs_ShapeEnum theTypOfSel, + const int thePriority, + const double theDeflection, + const double theDeflAngle); protected: - AIS_DataMapOfShapeDrawer myShapeColors; + NCollection_DataMap, TopTools_ShapeMapHasher> + myShapeColors; public: DEFINE_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape) }; -DEFINE_STANDARD_HANDLE(AIS_ColoredShape, AIS_Shape) - #endif // _AIS_ColoredShape_HeaderFile diff --git a/opencascade/AIS_ConcentricRelation.hxx b/opencascade/AIS_ConcentricRelation.hxx deleted file mode 100644 index 46d570f9e..000000000 --- a/opencascade/AIS_ConcentricRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_ConcentricRelation_HeaderFile -#define _AIS_ConcentricRelation_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_ConcentricRelation AIS_ConcentricRelation; - -#endif // _AIS_ConcentricRelation_HeaderFile diff --git a/opencascade/AIS_ConnectedInteractive.hxx b/opencascade/AIS_ConnectedInteractive.hxx index 41627e81b..e4f1cb05e 100644 --- a/opencascade/AIS_ConnectedInteractive.hxx +++ b/opencascade/AIS_ConnectedInteractive.hxx @@ -45,25 +45,22 @@ public: const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); //! Returns KOI_Object - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Object; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Object; } //! Returns 0 - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; } + int Signature() const override { return 0; } //! Establishes the connection between the Connected //! Interactive Object, anotherIobj, and its reference. - void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj) + void Connect(const occ::handle& theAnotherObj) { - connect(theAnotherObj, Handle(TopLoc_Datum3D)()); + connect(theAnotherObj, occ::handle()); } //! Establishes the connection between the Connected //! Interactive Object, anotherIobj, and its reference. //! Locates instance in aLocation. - void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, const gp_Trsf& theLocation) + void Connect(const occ::handle& theAnotherObj, const gp_Trsf& theLocation) { connect(theAnotherObj, new TopLoc_Datum3D(theLocation)); } @@ -71,18 +68,18 @@ public: //! Establishes the connection between the Connected //! Interactive Object, anotherIobj, and its reference. //! Locates instance in aLocation. - void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, - const Handle(TopLoc_Datum3D)& theLocation) + void Connect(const occ::handle& theAnotherObj, + const occ::handle& theLocation) { connect(theAnotherObj, theLocation); } //! Returns true if there is a connection established //! between the presentation and its source reference. - Standard_Boolean HasConnection() const { return !myReference.IsNull(); } + bool HasConnection() const { return !myReference.IsNull(); } //! Returns the connection with the reference Interactive Object. - const Handle(AIS_InteractiveObject)& ConnectedTo() const { return myReference; } + const occ::handle& ConnectedTo() const { return myReference; } //! Clears the connection with a source reference. The //! presentation will no longer be displayed. @@ -91,13 +88,13 @@ public: //! Informs the graphic context that the interactive Object //! may be decomposed into sub-shapes for dynamic selection. - virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE + bool AcceptShapeDecomposition() const override { return !myReference.IsNull() && myReference->AcceptShapeDecomposition(); } //! Return true if reference presentation accepts specified display mode. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE + bool AcceptDisplayMode(const int theMode) const override { return myReference.IsNull() || myReference->AcceptDisplayMode(theMode); } @@ -112,38 +109,36 @@ protected: //! compute anything, but just uses the //! presentation of this last object, with //! a transformation if there's one stored. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& theprs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& theprs, + const int theMode) override; //! Computes the presentation according to a point of view. - Standard_EXPORT virtual void computeHLR(const Handle(Graphic3d_Camera)& theProjector, - const Handle(TopLoc_Datum3D)& theTrsf, - const Handle(Prs3d_Presentation)& thePrs) - Standard_OVERRIDE; + Standard_EXPORT void computeHLR(const occ::handle& theProjector, + const occ::handle& theTrsf, + const occ::handle& thePrs) override; //! Generates sensitive entities by copying //! them from myReference selection, creates and sets an entity //! owner for this entities and adds them to theSelection - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Generates sensitive entities by copying //! them from myReference sub shapes selection, creates and sets an entity //! owner for this entities and adds them to theSelection - Standard_EXPORT void computeSubShapeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode); + Standard_EXPORT void computeSubShapeSelection( + const occ::handle& theSelection, + const int theMode); - Standard_EXPORT void updateShape(const Standard_Boolean WithLocation = Standard_True); + Standard_EXPORT void updateShape(const bool WithLocation = true); - Standard_EXPORT void connect(const Handle(AIS_InteractiveObject)& theAnotherObj, - const Handle(TopLoc_Datum3D)& theLocation); + Standard_EXPORT void connect(const occ::handle& theAnotherObj, + const occ::handle& theLocation); protected: - Handle(AIS_InteractiveObject) myReference; - TopoDS_Shape myShape; + occ::handle myReference; + TopoDS_Shape myShape; }; -DEFINE_STANDARD_HANDLE(AIS_ConnectedInteractive, AIS_InteractiveObject) - #endif // _AIS_ConnectedInteractive_HeaderFile diff --git a/opencascade/AIS_DataMapIteratorOfDataMapOfIOStatus.hxx b/opencascade/AIS_DataMapIteratorOfDataMapOfIOStatus.hxx deleted file mode 100644 index 23e46136c..000000000 --- a/opencascade/AIS_DataMapIteratorOfDataMapOfIOStatus.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef AIS_DataMapIteratorOfDataMapOfIOStatus_HeaderFile -#define AIS_DataMapIteratorOfDataMapOfIOStatus_HeaderFile - -#include - -#endif diff --git a/opencascade/AIS_DataMapOfIOStatus.hxx b/opencascade/AIS_DataMapOfIOStatus.hxx index 1591311eb..5659ee63a 100644 --- a/opencascade/AIS_DataMapOfIOStatus.hxx +++ b/opencascade/AIS_DataMapOfIOStatus.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-12-11 -// Created by: Robert COUBLANC -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,16 +11,33 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AIS_DataMapOfIOStatus_HeaderFile -#define AIS_DataMapOfIOStatus_HeaderFile +//! @file AIS_DataMapOfIOStatus.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _AIS_DataMapOfIOStatus_hxx +#define _AIS_DataMapOfIOStatus_hxx + +#include #include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED( + "AIS_DataMapOfIOStatus.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("AIS_DataMapOfIOStatus is deprecated, use " + "NCollection_DataMap, " + "opencascade::handle> directly") +typedef NCollection_DataMap, + opencascade::handle> AIS_DataMapOfIOStatus; -typedef NCollection_DataMap::Iterator +Standard_DEPRECATED("AIS_DataMapIteratorOfDataMapOfIOStatus is deprecated, use " + "NCollection_DataMap, " + "opencascade::handle>::Iterator directly") +typedef NCollection_DataMap, + opencascade::handle>::Iterator AIS_DataMapIteratorOfDataMapOfIOStatus; -#endif +#endif // _AIS_DataMapOfIOStatus_hxx diff --git a/opencascade/AIS_DataMapOfShapeDrawer.hxx b/opencascade/AIS_DataMapOfShapeDrawer.hxx index 6695fb61f..8c23c5ec8 100644 --- a/opencascade/AIS_DataMapOfShapeDrawer.hxx +++ b/opencascade/AIS_DataMapOfShapeDrawer.hxx @@ -1,4 +1,4 @@ -// Copyright (c) 2016 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -11,14 +11,31 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _AIS_DataMapOfShapeDrawer_HeaderFile -#define _AIS_DataMapOfShapeDrawer_HeaderFile +//! @file AIS_DataMapOfShapeDrawer.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DataMap, +//! TopTools_ShapeMapHasher> directly instead. +#ifndef _AIS_DataMapOfShapeDrawer_hxx +#define _AIS_DataMapOfShapeDrawer_hxx + +#include #include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED( + "AIS_DataMapOfShapeDrawer.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DataMap, " + "TopTools_ShapeMapHasher> directly.") + + Standard_DEPRECATED( + "AIS_DataMapOfShapeDrawer is deprecated, use NCollection_DataMap, TopTools_ShapeMapHasher> directly") +typedef NCollection_DataMap, + TopTools_ShapeMapHasher> AIS_DataMapOfShapeDrawer; -#endif // _AIS_DataMapOfShapeDrawer_HeaderFile +#endif // _AIS_DataMapOfShapeDrawer_hxx diff --git a/opencascade/AIS_DiameterDimension.hxx b/opencascade/AIS_DiameterDimension.hxx deleted file mode 100644 index bc1350199..000000000 --- a/opencascade/AIS_DiameterDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_DiameterDimension_HeaderFile -#define _AIS_DiameterDimension_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_DiameterDimension AIS_DiameterDimension; - -#endif // _AIS_DiameterDimension_HeaderFile diff --git a/opencascade/AIS_Dimension.hxx b/opencascade/AIS_Dimension.hxx deleted file mode 100644 index 089258594..000000000 --- a/opencascade/AIS_Dimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_Dimension_HeaderFile -#define _AIS_Dimension_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_Dimension AIS_Dimension; - -#endif // _AIS_Dimension_HeaderFile diff --git a/opencascade/AIS_DimensionOwner.hxx b/opencascade/AIS_DimensionOwner.hxx deleted file mode 100644 index e0c714d8c..000000000 --- a/opencascade/AIS_DimensionOwner.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_DimensionOwner_HeaderFile -#define _AIS_DimensionOwner_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_DimensionOwner AIS_DimensionOwner; - -#endif // _AIS_DimensionOwner_HeaderFile diff --git a/opencascade/AIS_EllipseRadiusDimension.hxx b/opencascade/AIS_EllipseRadiusDimension.hxx deleted file mode 100644 index 5d20c5f2d..000000000 --- a/opencascade/AIS_EllipseRadiusDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_EllipseRadiusDimension_HeaderFile -#define _AIS_EllipseRadiusDimension_HeaderFile - -#include - -Standard_DEPRECATED("Alias to moved class") -typedef PrsDim_EllipseRadiusDimension AIS_EllipseRadiusDimension; - -#endif // _AIS_EllipseRadiusDimension_HeaderFile diff --git a/opencascade/AIS_EqualDistanceRelation.hxx b/opencascade/AIS_EqualDistanceRelation.hxx deleted file mode 100644 index 10102cbb5..000000000 --- a/opencascade/AIS_EqualDistanceRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_EqualDistanceRelation_HeaderFile -#define _AIS_EqualDistanceRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_EqualDistanceRelation AIS_EqualDistanceRelation; - -#endif // _AIS_EqualDistanceRelation_HeaderFile diff --git a/opencascade/AIS_EqualRadiusRelation.hxx b/opencascade/AIS_EqualRadiusRelation.hxx deleted file mode 100644 index 3f924301f..000000000 --- a/opencascade/AIS_EqualRadiusRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_EqualRadiusRelation_HeaderFile -#define _AIS_EqualRadiusRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_EqualRadiusRelation AIS_EqualRadiusRelation; - -#endif // _AIS_EqualRadiusRelation_HeaderFile diff --git a/opencascade/AIS_ExclusionFilter.hxx b/opencascade/AIS_ExclusionFilter.hxx index 2fb959eef..3b580e5bb 100644 --- a/opencascade/AIS_ExclusionFilter.hxx +++ b/opencascade/AIS_ExclusionFilter.hxx @@ -20,16 +20,13 @@ #include #include -#include +#include +#include +#include #include #include -#include -#include class SelectMgr_EntityOwner; -class AIS_ExclusionFilter; -DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter) - //! A framework to reject or to accept only objects of //! given types and/or signatures. //! Objects are stored, and the stored objects - along @@ -51,56 +48,52 @@ public: //! Constructs an empty exclusion filter object defined by //! the flag setting ExclusionFlagOn. //! By default, the flag is set to true. - Standard_EXPORT AIS_ExclusionFilter(const Standard_Boolean ExclusionFlagOn = Standard_True); + Standard_EXPORT AIS_ExclusionFilter(const bool ExclusionFlagOn = true); //! All the AIS objects of //! Will be rejected by the IsOk Method. Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, - const Standard_Boolean ExclusionFlagOn = Standard_True); + const bool ExclusionFlagOn = true); //! Constructs an exclusion filter object defined by the //! enumeration value TypeToExclude, the signature //! SignatureInType, and the flag setting ExclusionFlagOn. //! By default, the flag is set to true. Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, - const Standard_Integer SignatureInType, - const Standard_Boolean ExclusionFlagOn = Standard_True); + const int SignatureInType, + const bool ExclusionFlagOn = true); - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const - Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& anObj) const override; //! Adds the type TypeToExclude to the list of types. - Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude); + Standard_EXPORT bool Add(const AIS_KindOfInteractive TypeToExclude); - Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude, - const Standard_Integer SignatureInType); + Standard_EXPORT bool Add(const AIS_KindOfInteractive TypeToExclude, const int SignatureInType); - Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude); + Standard_EXPORT bool Remove(const AIS_KindOfInteractive TypeToExclude); - Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude, - const Standard_Integer SignatureInType); + Standard_EXPORT bool Remove(const AIS_KindOfInteractive TypeToExclude, const int SignatureInType); Standard_EXPORT void Clear(); - Standard_Boolean IsExclusionFlagOn() const { return myIsExclusionFlagOn; } + bool IsExclusionFlagOn() const { return myIsExclusionFlagOn; } - void SetExclusionFlag(const Standard_Boolean theStatus) { myIsExclusionFlagOn = theStatus; } + void SetExclusionFlag(const bool theStatus) { myIsExclusionFlagOn = theStatus; } - Standard_EXPORT Standard_Boolean IsStored(const AIS_KindOfInteractive aType) const; + Standard_EXPORT bool IsStored(const AIS_KindOfInteractive aType) const; - Standard_EXPORT void ListOfStoredTypes(TColStd_ListOfInteger& TheList) const; + Standard_EXPORT void ListOfStoredTypes(NCollection_List& TheList) const; Standard_EXPORT void ListOfSignature(const AIS_KindOfInteractive aType, - TColStd_ListOfInteger& TheStoredList) const; + NCollection_List& TheStoredList) const; DEFINE_STANDARD_RTTIEXT(AIS_ExclusionFilter, SelectMgr_Filter) private: - Standard_EXPORT Standard_Boolean IsSignatureIn(const AIS_KindOfInteractive aType, - const Standard_Integer aSignature) const; + Standard_EXPORT bool IsSignatureIn(const AIS_KindOfInteractive aType, const int aSignature) const; - Standard_Boolean myIsExclusionFlagOn; - TColStd_DataMapOfIntegerListOfInteger myStoredTypes; + bool myIsExclusionFlagOn; + NCollection_DataMap> myStoredTypes; }; #endif // _AIS_ExclusionFilter_HeaderFile diff --git a/opencascade/AIS_FixRelation.hxx b/opencascade/AIS_FixRelation.hxx deleted file mode 100644 index 1adedde85..000000000 --- a/opencascade/AIS_FixRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_FixRelation_HeaderFile -#define _AIS_FixRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_FixRelation AIS_FixRelation; - -#endif // _AIS_FixRelation_HeaderFile diff --git a/opencascade/AIS_GlobalStatus.hxx b/opencascade/AIS_GlobalStatus.hxx index 97f302ba1..d615a3894 100644 --- a/opencascade/AIS_GlobalStatus.hxx +++ b/opencascade/AIS_GlobalStatus.hxx @@ -20,12 +20,10 @@ #include #include -#include #include +#include #include -DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient) - //! Stores information about objects in graphic context: class AIS_GlobalStatus : public Standard_Transient { @@ -35,62 +33,56 @@ public: Standard_EXPORT AIS_GlobalStatus(); //! Returns the display mode. - Standard_Integer DisplayMode() const { return myDispMode; } + int DisplayMode() const { return myDispMode; } //! Sets display mode. - void SetDisplayMode(const Standard_Integer theMode) { myDispMode = theMode; } + void SetDisplayMode(const int theMode) { myDispMode = theMode; } //! Returns TRUE if object is highlighted - Standard_Boolean IsHilighted() const { return myIsHilit; } + bool IsHilighted() const { return myIsHilit; } //! Sets highlighted state. - void SetHilightStatus(const Standard_Boolean theStatus) { myIsHilit = theStatus; } + void SetHilightStatus(const bool theStatus) { myIsHilit = theStatus; } //! Changes applied highlight style for a particular object - void SetHilightStyle(const Handle(Prs3d_Drawer)& theStyle) { myHiStyle = theStyle; } + void SetHilightStyle(const occ::handle& theStyle) { myHiStyle = theStyle; } //! Returns applied highlight style for a particular object - const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; } + const occ::handle& HilightStyle() const { return myHiStyle; } //! Returns active selection modes of the object. - const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; } + const NCollection_List& SelectionModes() const { return mySelModes; } //! Return TRUE if selection mode was registered. - Standard_Boolean IsSModeIn(Standard_Integer theMode) const - { - return mySelModes.Contains(theMode); - } + bool IsSModeIn(int theMode) const { return mySelModes.Contains(theMode); } //! Add selection mode. - Standard_Boolean AddSelectionMode(const Standard_Integer theMode) + bool AddSelectionMode(const int theMode) { if (!mySelModes.Contains(theMode)) { mySelModes.Append(theMode); - return Standard_True; + return true; } - return Standard_False; + return false; } //! Remove selection mode. - Standard_Boolean RemoveSelectionMode(const Standard_Integer theMode) - { - return mySelModes.Remove(theMode); - } + bool RemoveSelectionMode(const int theMode) { return mySelModes.Remove(theMode); } //! Remove all selection modes. void ClearSelectionModes() { mySelModes.Clear(); } - Standard_Boolean IsSubIntensityOn() const { return mySubInt; } + bool IsSubIntensityOn() const { return mySubInt; } - void SetSubIntensity(Standard_Boolean theIsOn) { mySubInt = theIsOn; } + void SetSubIntensity(bool theIsOn) { mySubInt = theIsOn; } private: - TColStd_ListOfInteger mySelModes; - Handle(Prs3d_Drawer) myHiStyle; - Standard_Integer myDispMode; - Standard_Boolean myIsHilit; - Standard_Boolean mySubInt; + NCollection_List mySelModes; + occ::handle myHiStyle; + int myDispMode; + bool myIsHilit; + bool mySubInt; }; #endif // _AIS_GlobalStatus_HeaderFile diff --git a/opencascade/AIS_GraphicTool.hxx b/opencascade/AIS_GraphicTool.hxx index 549d413b0..07095832d 100644 --- a/opencascade/AIS_GraphicTool.hxx +++ b/opencascade/AIS_GraphicTool.hxx @@ -34,35 +34,34 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT static Quantity_NameOfColor GetLineColor( - const Handle(Prs3d_Drawer)& aDrawer, - const AIS_TypeOfAttribute TheTypeOfAttributes); + const occ::handle& aDrawer, + const AIS_TypeOfAttribute TheTypeOfAttributes); - Standard_EXPORT static void GetLineColor(const Handle(Prs3d_Drawer)& aDrawer, - const AIS_TypeOfAttribute TheTypeOfAttributes, - Quantity_Color& TheLineColor); + Standard_EXPORT static void GetLineColor(const occ::handle& aDrawer, + const AIS_TypeOfAttribute TheTypeOfAttributes, + Quantity_Color& TheLineColor); - Standard_EXPORT static Standard_Real GetLineWidth(const Handle(Prs3d_Drawer)& aDrawer, - const AIS_TypeOfAttribute TheTypeOfAttributes); + Standard_EXPORT static double GetLineWidth(const occ::handle& aDrawer, + const AIS_TypeOfAttribute TheTypeOfAttributes); Standard_EXPORT static Aspect_TypeOfLine GetLineType( - const Handle(Prs3d_Drawer)& aDrawer, - const AIS_TypeOfAttribute TheTypeOfAttributes); + const occ::handle& aDrawer, + const AIS_TypeOfAttribute TheTypeOfAttributes); - Standard_EXPORT static void GetLineAtt(const Handle(Prs3d_Drawer)& aDrawer, - const AIS_TypeOfAttribute TheTypeOfAttributes, - Quantity_NameOfColor& aCol, - Standard_Real& aWidth, - Aspect_TypeOfLine& aTyp); + Standard_EXPORT static void GetLineAtt(const occ::handle& aDrawer, + const AIS_TypeOfAttribute TheTypeOfAttributes, + Quantity_NameOfColor& aCol, + double& aWidth, + Aspect_TypeOfLine& aTyp); - Standard_EXPORT static Quantity_NameOfColor GetInteriorColor(const Handle(Prs3d_Drawer)& aDrawer); + Standard_EXPORT static Quantity_NameOfColor GetInteriorColor( + const occ::handle& aDrawer); - Standard_EXPORT static void GetInteriorColor(const Handle(Prs3d_Drawer)& aDrawer, - Quantity_Color& aColor); + Standard_EXPORT static void GetInteriorColor(const occ::handle& aDrawer, + Quantity_Color& aColor); - Standard_EXPORT static Graphic3d_MaterialAspect GetMaterial(const Handle(Prs3d_Drawer)& aDrawer); - -protected: -private: + Standard_EXPORT static Graphic3d_MaterialAspect GetMaterial( + const occ::handle& aDrawer); }; #endif // _AIS_GraphicTool_HeaderFile diff --git a/opencascade/AIS_IdenticRelation.hxx b/opencascade/AIS_IdenticRelation.hxx deleted file mode 100644 index 02eb6e406..000000000 --- a/opencascade/AIS_IdenticRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_IdenticRelation_HeaderFile -#define _AIS_IdenticRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_IdenticRelation AIS_IdenticRelation; - -#endif // _AIS_IdenticRelation_HeaderFile diff --git a/opencascade/AIS_InteractiveContext.hxx b/opencascade/AIS_InteractiveContext.hxx index e3194bdeb..4c957bd44 100644 --- a/opencascade/AIS_InteractiveContext.hxx +++ b/opencascade/AIS_InteractiveContext.hxx @@ -17,11 +17,13 @@ #ifndef _AIS_InteractiveContext_HeaderFile #define _AIS_InteractiveContext_HeaderFile -#include +#include +#include +#include #include #include #include -#include +#include #include #include #include @@ -29,21 +31,25 @@ #include #include #include -#include +#include +#include #include #include #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include +#include +#include +#include +#include #include +class SelectMgr_EntityOwner; class V3d_Viewer; class V3d_View; @@ -69,10 +75,10 @@ class AIS_InteractiveContext : public Standard_Transient DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient) public: //! @name object display management //! Constructs the interactive context object defined by the principal viewer MainViewer. - Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer); + Standard_EXPORT AIS_InteractiveContext(const occ::handle& MainViewer); //! Destructor. - Standard_EXPORT virtual ~AIS_InteractiveContext(); + Standard_EXPORT ~AIS_InteractiveContext() override; //! Returns the display status of the entity anIobj. //! This will be one of the following: @@ -81,115 +87,112 @@ public: //! @name object display management //! - AIS_DS_Temporary temporarily displayed //! - AIS_DS_None nowhere displayed. Standard_EXPORT PrsMgr_DisplayStatus - DisplayStatus(const Handle(AIS_InteractiveObject)& anIobj) const; + DisplayStatus(const occ::handle& anIobj) const; //! Returns the status of the Interactive Context for the view of the Interactive Object. - Standard_EXPORT void Status(const Handle(AIS_InteractiveObject)& anObj, - TCollection_ExtendedString& astatus) const; + Standard_EXPORT void Status(const occ::handle& anObj, + TCollection_ExtendedString& astatus) const; //! Returns true if Object is displayed in the interactive context. - Standard_EXPORT Standard_Boolean IsDisplayed(const Handle(AIS_InteractiveObject)& anIobj) const; + Standard_EXPORT bool IsDisplayed(const occ::handle& anIobj) const; - Standard_EXPORT Standard_Boolean IsDisplayed(const Handle(AIS_InteractiveObject)& aniobj, - const Standard_Integer aMode) const; + Standard_EXPORT bool IsDisplayed(const occ::handle& aniobj, + const int aMode) const; //! Enable or disable automatic activation of default selection mode while displaying the object. - void SetAutoActivateSelection(const Standard_Boolean theIsAuto) - { - myIsAutoActivateSelMode = theIsAuto; - } + void SetAutoActivateSelection(const bool theIsAuto) { myIsAutoActivateSelMode = theIsAuto; } //! Manages displaying the new object should also automatically activate default selection mode; //! TRUE by default. - Standard_Boolean GetAutoActivateSelection() const { return myIsAutoActivateSelMode; } + bool GetAutoActivateSelection() const { return myIsAutoActivateSelMode; } //! Displays the object in this Context using default Display Mode. //! This will be the object's default display mode, if there is one. Otherwise, it will be the //! context mode. The Interactive Object's default selection mode is activated if //! GetAutoActivateSelection() is TRUE. In general, this is 0. - Standard_EXPORT void Display(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void Display(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Sets status, display mode and selection mode for specified Object //! If theSelectionMode equals -1, theIObj will not be activated: it will be displayed but will //! not be selectable. Standard_EXPORT void Display( - const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theDispMode, - const Standard_Integer theSelectionMode, - const Standard_Boolean theToUpdateViewer, - const PrsMgr_DisplayStatus theDispStatus = PrsMgr_DisplayStatus_None); + const occ::handle& theIObj, + const int theDispMode, + const int theSelectionMode, + const bool theToUpdateViewer, + const PrsMgr_DisplayStatus theDispStatus = PrsMgr_DisplayStatus_None); //! Allows you to load the Interactive Object with a given selection mode, //! and/or with the desired decomposition option, whether the object is visualized or not. //! The loaded objects will be selectable but displayable in highlighting only when detected by //! the Selector. - Standard_EXPORT void Load(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Integer theSelectionMode = -1); + Standard_EXPORT void Load(const occ::handle& theObj, + const int theSelectionMode = -1); //! Hides the object. The object's presentations are simply flagged as invisible and therefore //! excluded from redrawing. To show hidden objects, use Display(). - Standard_EXPORT void Erase(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void Erase(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Hides all objects. The object's presentations are simply flagged as invisible and therefore //! excluded from redrawing. To show all hidden objects, use DisplayAll(). - Standard_EXPORT void EraseAll(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void EraseAll(const bool theToUpdateViewer); //! Displays all hidden objects. - Standard_EXPORT void DisplayAll(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void DisplayAll(const bool theToUpdateViewer); //! Hides selected objects. The object's presentations are simply flagged as invisible and //! therefore excluded from redrawing. To show hidden objects, use Display(). - Standard_EXPORT void EraseSelected(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void EraseSelected(const bool theToUpdateViewer); //! Displays current objects. - Standard_EXPORT void DisplaySelected(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void DisplaySelected(const bool theToUpdateViewer); //! Empties the graphic presentation of the mode indexed by aMode. //! Warning! Removes theIObj. theIObj is still active if it was previously activated. - void ClearPrs(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theMode, - const Standard_Boolean theToUpdateViewer) + void ClearPrs(const occ::handle& theIObj, + const int theMode, + const bool theToUpdateViewer) { ClearGlobalPrs(theIObj, theMode, theToUpdateViewer); } //! Removes Object from every viewer. - Standard_EXPORT void Remove(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void Remove(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Removes all the objects from Context. - Standard_EXPORT void RemoveAll(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void RemoveAll(const bool theToUpdateViewer); //! Recomputes the seen parts presentation of the Object. //! If theAllModes equals true, all presentations are present in the object even if unseen. - Standard_EXPORT void Redisplay(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer, - const Standard_Boolean theAllModes = Standard_False); + Standard_EXPORT void Redisplay(const occ::handle& theIObj, + const bool theToUpdateViewer, + const bool theAllModes = false); //! Recomputes the Prs/Selection of displayed objects of a given type and a given signature. //! if signature = -1 doesn't take signature criterion. Standard_EXPORT void Redisplay(const AIS_KindOfInteractive theTypeOfObject, - const Standard_Integer theSignature, - const Standard_Boolean theToUpdateViewer); + const int theSignature, + const bool theToUpdateViewer); //! Recomputes the displayed presentations, flags the others. //! Doesn't update presentations. - Standard_EXPORT void RecomputePrsOnly(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer, - const Standard_Boolean theAllModes = Standard_False); + Standard_EXPORT void RecomputePrsOnly(const occ::handle& theIObj, + const bool theToUpdateViewer, + const bool theAllModes = false); //! Recomputes the active selections, flags the others. //! Doesn't update presentations. - Standard_EXPORT void RecomputeSelectionOnly(const Handle(AIS_InteractiveObject)& anIObj); + Standard_EXPORT void RecomputeSelectionOnly(const occ::handle& anIObj); //! Updates displayed interactive object by checking and recomputing its flagged as "to be //! recomputed" presentation and selection structures. This method does not force any //! recomputation on its own. The method recomputes selections even if they are loaded without //! activation in particular selector. - Standard_EXPORT void Update(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theUpdateViewer); + Standard_EXPORT void Update(const occ::handle& theIObj, + const bool theUpdateViewer); public: //! @name highlighting management //! Returns default highlight style settings (could be overridden by PrsMgr_PresentableObject). @@ -226,7 +229,7 @@ public: //! @name highlighting management //! Prs3d_TypeOfHighlight_Dynamic and Prs3d_TypeOfHighlight_LocalDynamic defaults on object level //! @sa PrsMgr_PresentableObject::HilightAttributes() overriding Prs3d_TypeOfHighlight_Selected //! and Prs3d_TypeOfHighlight_LocalSelected defaults on object level - const Handle(Prs3d_Drawer)& HighlightStyle(const Prs3d_TypeOfHighlight theStyleType) const + const occ::handle& HighlightStyle(const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; } @@ -237,8 +240,8 @@ public: //! @name highlighting management //! //! If a new highlight style is created, its presentation Zlayer should be checked, //! otherwise highlighting might not work as expected. - void SetHighlightStyle(const Prs3d_TypeOfHighlight theStyleType, - const Handle(Prs3d_Drawer)& theStyle) + void SetHighlightStyle(const Prs3d_TypeOfHighlight theStyleType, + const occ::handle& theStyle) { myStyles[theStyleType] = theStyle; if (theStyleType == Prs3d_TypeOfHighlight_None) @@ -250,149 +253,148 @@ public: //! @name highlighting management //! Returns current dynamic highlight style settings corresponding to //! Prs3d_TypeOfHighlight_Dynamic. This is just a short-cut to //! HighlightStyle(Prs3d_TypeOfHighlight_Dynamic). - const Handle(Prs3d_Drawer)& HighlightStyle() const + const occ::handle& HighlightStyle() const { return myStyles[Prs3d_TypeOfHighlight_Dynamic]; } - //! Setup the style of dynamic highlighting corrsponding to Prs3d_TypeOfHighlight_Selected. + //! Setup the style of dynamic highlighting corresponding to Prs3d_TypeOfHighlight_Selected. //! This is just a short-cut to SetHighlightStyle(Prs3d_TypeOfHighlight_Dynamic,theStyle). - void SetHighlightStyle(const Handle(Prs3d_Drawer)& theStyle) + void SetHighlightStyle(const occ::handle& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; } - //! Returns current selection style settings corrsponding to Prs3d_TypeOfHighlight_Selected. + //! Returns current selection style settings corresponding to Prs3d_TypeOfHighlight_Selected. //! This is just a short-cut to HighlightStyle(Prs3d_TypeOfHighlight_Selected). - const Handle(Prs3d_Drawer)& SelectionStyle() const + const occ::handle& SelectionStyle() const { return myStyles[Prs3d_TypeOfHighlight_Selected]; } //! Setup the style of selection highlighting. //! This is just a short-cut to SetHighlightStyle(Prs3d_TypeOfHighlight_Selected,theStyle). - void SetSelectionStyle(const Handle(Prs3d_Drawer)& theStyle) + void SetSelectionStyle(const occ::handle& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; } //! Returns highlight style of the object if it is marked as highlighted via global status //! @param[in] theObj the object to check - Standard_EXPORT Standard_Boolean HighlightStyle(const Handle(AIS_InteractiveObject)& theObj, - Handle(Prs3d_Drawer)& theStyle) const; + Standard_EXPORT bool HighlightStyle(const occ::handle& theObj, + occ::handle& theStyle) const; //! Returns highlight style of the owner if it is selected //! @param[in] theOwner the owner to check - Standard_EXPORT Standard_Boolean HighlightStyle(const Handle(SelectMgr_EntityOwner)& theOwner, - Handle(Prs3d_Drawer)& theStyle) const; + Standard_EXPORT bool HighlightStyle(const occ::handle& theOwner, + occ::handle& theStyle) const; //! Returns true if the object is marked as highlighted via its global status //! @param[in] theObj the object to check - Standard_EXPORT Standard_Boolean IsHilighted(const Handle(AIS_InteractiveObject)& theObj) const; + Standard_EXPORT bool IsHilighted(const occ::handle& theObj) const; //! Returns true if the owner is marked as selected //! @param[in] theOwner the owner to check - Standard_EXPORT Standard_Boolean IsHilighted(const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT bool IsHilighted(const occ::handle& theOwner) const; //! Changes the color of all the lines of the object in view. - Standard_EXPORT void HilightWithColor(const Handle(AIS_InteractiveObject)& theObj, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void HilightWithColor(const occ::handle& theObj, + const occ::handle& theStyle, + const bool theToUpdateViewer); - //! Removes hilighting from the Object. - Standard_EXPORT void Unhilight(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + //! Removes highlighting from the Object. + Standard_EXPORT void Unhilight(const occ::handle& theIObj, + const bool theToUpdateViewer); public: //! @name object presence management (View affinity, Layer, Priority) //! Returns the display priority of the Object. Standard_EXPORT Graphic3d_DisplayPriority - DisplayPriority(const Handle(AIS_InteractiveObject)& theIObj) const; + DisplayPriority(const occ::handle& theIObj) const; //! Sets the display priority of the seen parts presentation of the Object. - Standard_EXPORT void SetDisplayPriority(const Handle(AIS_InteractiveObject)& theIObj, - const Graphic3d_DisplayPriority thePriority); + Standard_EXPORT void SetDisplayPriority(const occ::handle& theIObj, + const Graphic3d_DisplayPriority thePriority); Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed " "instead of integer number to SetDisplayPriority()") - - void SetDisplayPriority(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer thePriority) + void SetDisplayPriority(const occ::handle& theIObj, const int thePriority) { SetDisplayPriority(theIObj, (Graphic3d_DisplayPriority)thePriority); } //! Get Z layer id set for displayed interactive object. - Standard_EXPORT Graphic3d_ZLayerId GetZLayer(const Handle(AIS_InteractiveObject)& theIObj) const; + Standard_EXPORT Graphic3d_ZLayerId + GetZLayer(const occ::handle& theIObj) const; //! Set Z layer id for interactive object. //! The Z layers can be used to display temporarily presentations of some object in front of the //! other objects in the scene. The ids for Z layers are generated by V3d_Viewer. - Standard_EXPORT void SetZLayer(const Handle(AIS_InteractiveObject)& theIObj, - const Graphic3d_ZLayerId theLayerId); + Standard_EXPORT void SetZLayer(const occ::handle& theIObj, + const Graphic3d_ZLayerId theLayerId); //! Setup object visibility in specified view. //! Has no effect if object is not displayed in this context. - Standard_EXPORT void SetViewAffinity(const Handle(AIS_InteractiveObject)& theIObj, - const Handle(V3d_View)& theView, - const Standard_Boolean theIsVisible); + Standard_EXPORT void SetViewAffinity(const occ::handle& theIObj, + const occ::handle& theView, + const bool theIsVisible); public: //! @name Display Mode management //! Returns the Display Mode setting to be used by default. - Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); } + int DisplayMode() const { return myDefaultDrawer->DisplayMode(); } //! Sets the display mode of seen Interactive Objects (which have no overridden Display Mode). - Standard_EXPORT void SetDisplayMode(const Standard_Integer theMode, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetDisplayMode(const int theMode, const bool theToUpdateViewer); //! Sets the display mode of seen Interactive Objects. //! theMode provides the display mode index of the entity theIObj. - Standard_EXPORT void SetDisplayMode(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theMode, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetDisplayMode(const occ::handle& theIObj, + const int theMode, + const bool theToUpdateViewer); //! Unsets the display mode of seen Interactive Objects. - Standard_EXPORT void UnsetDisplayMode(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnsetDisplayMode(const occ::handle& theIObj, + const bool theToUpdateViewer); public: //! @name object local transformation management //! Puts the location on the initial graphic representation and the selection for the Object. - Standard_EXPORT void SetLocation(const Handle(AIS_InteractiveObject)& theObject, - const TopLoc_Location& theLocation); + Standard_EXPORT void SetLocation(const occ::handle& theObject, + const TopLoc_Location& theLocation); //! Puts the Object back into its initial position. - Standard_EXPORT void ResetLocation(const Handle(AIS_InteractiveObject)& theObject); + Standard_EXPORT void ResetLocation(const occ::handle& theObject); //! Returns true if the Object has a location. - Standard_EXPORT Standard_Boolean - HasLocation(const Handle(AIS_InteractiveObject)& theObject) const; + Standard_EXPORT bool HasLocation(const occ::handle& theObject) const; //! Returns the location of the Object. - Standard_EXPORT TopLoc_Location Location(const Handle(AIS_InteractiveObject)& theObject) const; + Standard_EXPORT TopLoc_Location + Location(const occ::handle& theObject) const; //! Sets transform persistence. - Standard_EXPORT void SetTransformPersistence(const Handle(AIS_InteractiveObject)& theObject, - const Handle(Graphic3d_TransformPers)& theTrsfPers); + Standard_EXPORT void SetTransformPersistence( + const occ::handle& theObject, + const occ::handle& theTrsfPers); public: //! @name mouse picking logic (detection and dynamic highlighting of entities under cursor) //! Setup pixel tolerance for MoveTo() operation. //! @sa MoveTo(). - Standard_EXPORT void SetPixelTolerance(const Standard_Integer thePrecision = 2); + Standard_EXPORT void SetPixelTolerance(const int thePrecision = 2); //! Returns the pixel tolerance, default is 2. //! Pixel Tolerance extends sensitivity within MoveTo() operation (picking by point) //! and can be adjusted by application based on user input precision (e.g. screen pixel density, //! input device precision, etc.). - Standard_EXPORT Standard_Integer PixelTolerance() const; + Standard_EXPORT int PixelTolerance() const; //! Allows to manage sensitivity of a particular selection of interactive object theObject //! and changes previous sensitivity value of all sensitive entities in selection with theMode //! to the given theNewSensitivity. - Standard_EXPORT void SetSelectionSensitivity(const Handle(AIS_InteractiveObject)& theObject, - const Standard_Integer theMode, - const Standard_Integer theNewSensitivity); + Standard_EXPORT void SetSelectionSensitivity(const occ::handle& theObject, + const int theMode, + const int theNewSensitivity); //! Returns last active View (argument of MoveTo()/Select() methods). - Standard_EXPORT Handle(V3d_View) LastActiveView() const; + Standard_EXPORT occ::handle LastActiveView() const; //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors. //! This is done by the view theView passing this position to the main viewer and updating it. @@ -403,51 +405,50 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent //! (Prs3d_TypeOfHighlight_Dynamic and Prs3d_TypeOfHighlight_LocalDynamic) //! @sa PrsMgr_PresentableObject::DynamicHilightAttributes() defining per-object dynamic highlight //! style of detected owners (overrides defaults) - Standard_EXPORT AIS_StatusOfDetection MoveTo(const Standard_Integer theXPix, - const Standard_Integer theYPix, - const Handle(V3d_View)& theView, - const Standard_Boolean theToRedrawOnUpdate); + Standard_EXPORT AIS_StatusOfDetection MoveTo(const int theXPix, + const int theYPix, + const occ::handle& theView, + const bool theToRedrawOnUpdate); //! Relays axis theAxis to the interactive context selectors. //! This is done by the view theView passing this axis to the main viewer and updating it. //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight //! detected object. //! @sa PickingStrategy() - Standard_EXPORT AIS_StatusOfDetection MoveTo(const gp_Ax1& theAxis, - const Handle(V3d_View)& theView, - const Standard_Boolean theToRedrawOnUpdate); + Standard_EXPORT AIS_StatusOfDetection MoveTo(const gp_Ax1& theAxis, + const occ::handle& theView, + const bool theToRedrawOnUpdate); //! Clears the list of entities detected by MoveTo() and resets dynamic highlighting. //! @param theToRedrawImmediate if TRUE, the main Viewer will be redrawn on update //! @return TRUE if viewer needs to be updated (e.g. there were actually dynamically highlighted //! entities) - Standard_EXPORT Standard_Boolean - ClearDetected(Standard_Boolean theToRedrawImmediate = Standard_False); + Standard_EXPORT bool ClearDetected(bool theToRedrawImmediate = false); //! Returns true if there is a mouse-detected entity in context. //! @sa DetectedOwner(), HasNextDetected(), HilightPreviousDetected(), HilightNextDetected(). - Standard_Boolean HasDetected() const { return !myLastPicked.IsNull(); } + bool HasDetected() const { return !myLastPicked.IsNull(); } //! Returns the owner of the detected sensitive primitive which is currently dynamically //! highlighted. WARNING! This method is irrelevant to //! InitDetected()/MoreDetected()/NextDetected(). //! @sa HasDetected(), HasNextDetected(), HilightPreviousDetected(), HilightNextDetected(). - const Handle(SelectMgr_EntityOwner)& DetectedOwner() const { return myLastPicked; } + const occ::handle& DetectedOwner() const { return myLastPicked; } //! Returns the interactive objects last detected in context. //! In general this is just a wrapper for - //! Handle(AIS_InteractiveObject)::DownCast(DetectedOwner()->Selectable()). + //! occ::down_cast(DetectedOwner()->Selectable()). //! @sa DetectedOwner() - Handle(AIS_InteractiveObject) DetectedInteractive() const + occ::handle DetectedInteractive() const { - return Handle(AIS_InteractiveObject)::DownCast(myLastPicked->Selectable()); + return occ::down_cast(myLastPicked->Selectable()); } //! Returns true if there is a detected shape in local context. //! @sa HasDetected(), DetectedShape() Standard_DEPRECATED( "Local Context is deprecated - local selection should be used without Local Context") - Standard_EXPORT Standard_Boolean HasDetectedShape() const; + Standard_EXPORT bool HasDetectedShape() const; //! Returns the shape detected in local context. //! @sa DetectedOwner() @@ -457,7 +458,7 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent //! returns True if other entities were detected in the last mouse detection //! @sa HilightPreviousDetected(), HilightNextDetected(). - Standard_Boolean HasNextDetected() const + bool HasNextDetected() const { return !myDetectedSeq.IsEmpty() && myCurHighlighted <= myDetectedSeq.Upper(); } @@ -469,15 +470,13 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent //! hilight the first one again. //! @return the Rank of hilighted entity //! @sa HasNextDetected(), HilightPreviousDetected(). - Standard_EXPORT Standard_Integer - HilightNextDetected(const Handle(V3d_View)& theView, - const Standard_Boolean theToRedrawImmediate = Standard_True); + Standard_EXPORT int HilightNextDetected(const occ::handle& theView, + const bool theToRedrawImmediate = true); //! Same as previous methods in reverse direction. //! @sa HasNextDetected(), HilightNextDetected(). - Standard_EXPORT Standard_Integer - HilightPreviousDetected(const Handle(V3d_View)& theView, - const Standard_Boolean theToRedrawImmediate = Standard_True); + Standard_EXPORT int HilightPreviousDetected(const occ::handle& theView, + const bool theToRedrawImmediate = true); public: //! @name iteration through detected entities //! Initialization for iteration through mouse-detected objects in @@ -487,16 +486,17 @@ public: //! @name iteration through detected entities { if (!myDetectedSeq.IsEmpty()) { - myCurDetected = myDetectedSeq.Lower(); + myCurDetected = NCollection_Sequence::Lower(); } } //! Return TRUE if there is more mouse-detected objects after the current one //! during iteration through mouse-detected interactive objects. //! @sa DetectedCurrentOwner(), InitDetected(), NextDetected(). - Standard_Boolean MoreDetected() const + bool MoreDetected() const { - return myCurDetected >= myDetectedSeq.Lower() && myCurDetected <= myDetectedSeq.Upper(); + return myCurDetected >= NCollection_Sequence::Lower() + && myCurDetected <= myDetectedSeq.Upper(); } //! Gets next current object during iteration through mouse-detected interactive objects. @@ -507,14 +507,14 @@ public: //! @name iteration through detected entities //! WARNING! This method is irrelevant to DetectedOwner() which returns last picked Owner //! regardless of iterator position! //! @sa InitDetected(), MoreDetected(), NextDetected(). - Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedCurrentOwner() const; + Standard_EXPORT occ::handle DetectedCurrentOwner() const; public: //! @name Selection management //! Adds object in the selection. - Standard_EXPORT AIS_StatusOfPick AddSelect(const Handle(SelectMgr_EntityOwner)& theObject); + Standard_EXPORT AIS_StatusOfPick AddSelect(const occ::handle& theObject); //! Adds object in the selection. - AIS_StatusOfPick AddSelect(const Handle(AIS_InteractiveObject)& theObject) + AIS_StatusOfPick AddSelect(const occ::handle& theObject) { return AddSelect(theObject->GlobalSelOwner()); } @@ -528,10 +528,10 @@ public: //! @name Selection management //! @return picking status //! @sa StdSelect_ViewerSelector3d::AllowOverlapDetection() Standard_EXPORT AIS_StatusOfPick - SelectRectangle(const Graphic3d_Vec2i& thePntMin, - const Graphic3d_Vec2i& thePntMax, - const Handle(V3d_View)& theView, - const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); + SelectRectangle(const NCollection_Vec2& thePntMin, + const NCollection_Vec2& thePntMax, + const occ::handle& theView, + const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); //! Select everything found in the polygon defined by bounding polyline. //! Viewer should be explicitly redrawn after selection. @@ -540,9 +540,9 @@ public: //! @name Selection management //! @param[in] theSelScheme selection scheme //! @return picking status Standard_EXPORT AIS_StatusOfPick - SelectPolygon(const TColgp_Array1OfPnt2d& thePolyline, - const Handle(V3d_View)& theView, - const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); + SelectPolygon(const NCollection_Array1& thePolyline, + const occ::handle& theView, + const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); //! Selects the topmost object picked by the point in the view, //! Viewer should be explicitly redrawn after selection. @@ -551,9 +551,9 @@ public: //! @name Selection management //! @param[in] theSelScheme selection scheme //! @return picking status Standard_EXPORT AIS_StatusOfPick - SelectPoint(const Graphic3d_Vec2i& thePnt, - const Handle(V3d_View)& theView, - const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); + SelectPoint(const NCollection_Vec2& thePnt, + const occ::handle& theView, + const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); //! Select and hilights the previous detected via AIS_InteractiveContext::MoveTo() method; //! unhilights the previous picked. @@ -565,47 +565,49 @@ public: //! @name Selection management //! (Prs3d_TypeOfHighlight_Selected and Prs3d_TypeOfHighlight_LocalSelected) //! @sa PrsMgr_PresentableObject::HilightAttributes() defining per-object highlight style of //! selected owners (overrides defaults) + //! For all selection schemes, allowing to select an object, + //! HandleMouseClick is available Standard_EXPORT AIS_StatusOfPick SelectDetected(const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace); //! Returns bounding box of selected objects. - Standard_EXPORT Bnd_Box BoundingBoxOfSelection(const Handle(V3d_View)& theView) const; + Standard_EXPORT Bnd_Box BoundingBoxOfSelection(const occ::handle& theView) const; Standard_DEPRECATED("BoundingBoxOfSelection() should be called with View argument") - - Bnd_Box BoundingBoxOfSelection() const { return BoundingBoxOfSelection(Handle(V3d_View)()); } + Bnd_Box BoundingBoxOfSelection() const { return BoundingBoxOfSelection(occ::handle()); } //! Sets list of owner selected/deselected using specified selection scheme. //! @param theOwners owners to change selection state //! @param theSelScheme selection scheme //! @return picking status - Standard_EXPORT AIS_StatusOfPick Select(const AIS_NArray1OfEntityOwner& theOwners, - const AIS_SelectionScheme theSelScheme); + Standard_EXPORT AIS_StatusOfPick + Select(const NCollection_Array1>& theOwners, + const AIS_SelectionScheme theSelScheme); //! Fits the view correspondingly to the bounds of selected objects. //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true. - Standard_EXPORT void FitSelected(const Handle(V3d_View)& theView, - const Standard_Real theMargin, - const Standard_Boolean theToUpdate); + Standard_EXPORT void FitSelected(const occ::handle& theView, + const double theMargin, + const bool theToUpdate); //! Fits the view correspondingly to the bounds of selected objects. //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true. - Standard_EXPORT void FitSelected(const Handle(V3d_View)& theView); + Standard_EXPORT void FitSelected(const occ::handle& theView); //! Return value specified whether selected object must be hilighted when mouse cursor is moved //! above it //! @sa MoveTo() - Standard_Boolean ToHilightSelected() const { return myToHilightSelected; } + bool ToHilightSelected() const { return myToHilightSelected; } //! Specify whether selected object must be hilighted when mouse cursor is moved above it (in //! MoveTo method). By default this value is false and selected object is not hilighted in this //! case. //! @sa MoveTo() - void SetToHilightSelected(const Standard_Boolean toHilight) { myToHilightSelected = toHilight; } + void SetToHilightSelected(const bool toHilight) { myToHilightSelected = toHilight; } //! Returns true if the automatic highlight mode is active; TRUE by default. //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight() - Standard_Boolean AutomaticHilight() const { return myAutoHilight; } + bool AutomaticHilight() const { return myAutoHilight; } //! Sets the highlighting status of detected and selected entities. //! This function allows you to disconnect the automatic mode. @@ -619,22 +621,22 @@ public: //! @name Selection management //! that is used to implement custom highlighting logic for a specific interactive object class. //! //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight() - void SetAutomaticHilight(Standard_Boolean theStatus) { myAutoHilight = theStatus; } + void SetAutomaticHilight(bool theStatus) { myAutoHilight = theStatus; } //! Unhighlights previously selected owners and marks them as not selected. //! Marks owner given as selected and highlights it. //! Performs selection filters check. - Standard_EXPORT void SetSelected(const Handle(SelectMgr_EntityOwner)& theOwners, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetSelected(const occ::handle& theOwners, + const bool theToUpdateViewer); //! Puts the interactive object aniObj in the list of selected objects. //! Performs selection filters check. - Standard_EXPORT void SetSelected(const Handle(AIS_InteractiveObject)& theObject, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetSelected(const occ::handle& theObject, + const bool theToUpdateViewer); //! Allows to highlight or unhighlight the owner given depending on its selection status - Standard_EXPORT void AddOrRemoveSelected(const Handle(AIS_InteractiveObject)& theObject, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void AddOrRemoveSelected(const occ::handle& theObject, + const bool theToUpdateViewer); //! Updates Selected state of specified owner without calling HilightSelected(). //! Has no effect if Selected state is not changed, and redirects to AddOrRemoveSelected() @@ -642,44 +644,44 @@ public: //! @name Selection management //! @param theOwner owner object to set selected state //! @param theIsSelected new selected state //! @return TRUE if Selected state has been changed - Standard_EXPORT Standard_Boolean SetSelectedState(const Handle(SelectMgr_EntityOwner)& theOwner, - const Standard_Boolean theIsSelected); + Standard_EXPORT bool SetSelectedState(const occ::handle& theOwner, + const bool theIsSelected); //! Highlights selected objects. - Standard_EXPORT void HilightSelected(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void HilightSelected(const bool theToUpdateViewer); //! Removes highlighting from selected objects. - Standard_EXPORT void UnhilightSelected(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnhilightSelected(const bool theToUpdateViewer); //! Updates the list of selected objects: //! i.e. highlights the newly selected ones and unhighlights previously selected objects. //! @sa HilightSelected(). - void UpdateSelected(Standard_Boolean theToUpdateViewer) { HilightSelected(theToUpdateViewer); } + void UpdateSelected(bool theToUpdateViewer) { HilightSelected(theToUpdateViewer); } //! Empties previous selected objects in order to get the selected objects detected by the //! selector using UpdateSelected. - Standard_EXPORT void ClearSelected(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void ClearSelected(const bool theToUpdateViewer); //! Allows to highlight or unhighlight the owner given depending on its selection status - Standard_EXPORT void AddOrRemoveSelected(const Handle(SelectMgr_EntityOwner)& theOwner, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void AddOrRemoveSelected(const occ::handle& theOwner, + const bool theToUpdateViewer); //! Returns true is the owner given is selected - Standard_Boolean IsSelected(const Handle(SelectMgr_EntityOwner)& theOwner) const + bool IsSelected(const occ::handle& theOwner) const { return !theOwner.IsNull() && theOwner->IsSelected(); } //! Returns true is the object given is selected - Standard_EXPORT Standard_Boolean IsSelected(const Handle(AIS_InteractiveObject)& theObj) const; + Standard_EXPORT bool IsSelected(const occ::handle& theObj) const; //! Returns the first selected object in the list of current selected. - Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject() const; + Standard_EXPORT occ::handle FirstSelectedObject() const; //! Count a number of selected entities using InitSelected()+MoreSelected()+NextSelected() //! iterator. //! @sa SelectedOwner(), InitSelected(), MoreSelected(), NextSelected(). - Standard_Integer NbSelected() { return mySelection->Extent(); } + int NbSelected() { return mySelection->Extent(); } //! Initializes a scan of the selected objects. //! @sa SelectedOwner(), MoreSelected(), NextSelected(). @@ -687,7 +689,7 @@ public: //! @name Selection management //! Returns true if there is another object found by the scan of the list of selected objects. //! @sa SelectedOwner(), InitSelected(), NextSelected(). - Standard_Boolean MoreSelected() const { return mySelection->More(); } + bool MoreSelected() const { return mySelection->More(); } //! Continues the scan to the next object in the list of selected objects. //! @sa SelectedOwner(), InitSelected(), MoreSelected(). @@ -695,30 +697,30 @@ public: //! @name Selection management //! Returns the owner of the selected entity. //! @sa InitSelected(), MoreSelected(), NextSelected(). - Handle(SelectMgr_EntityOwner) SelectedOwner() const + occ::handle SelectedOwner() const { - return !mySelection->More() ? Handle(SelectMgr_EntityOwner)() : mySelection->Value(); + return !mySelection->More() ? occ::handle() : mySelection->Value(); } //! Return Handle(AIS_InteractiveObject)::DownCast (SelectedOwner()->Selectable()). //! @sa SelectedOwner(). - Handle(AIS_InteractiveObject) SelectedInteractive() const + occ::handle SelectedInteractive() const { return !mySelection->More() - ? Handle(AIS_InteractiveObject)() - : Handle(AIS_InteractiveObject)::DownCast(mySelection->Value()->Selectable()); + ? occ::handle() + : occ::down_cast(mySelection->Value()->Selectable()); } //! Returns TRUE if the interactive context has a shape selected. //! @sa SelectedShape(). - Standard_EXPORT Standard_Boolean HasSelectedShape() const; + Standard_EXPORT bool HasSelectedShape() const; //! Returns the selected shape. //! Basically it is just a shape returned stored by StdSelect_BRepOwner with graphic //! transformation being applied: //! @code - //! const Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast - //! (SelectedOwner()); TopoDS_Shape aSelShape = aBRepOwner->Shape(); TopoDS_Shape + //! const occ::handle aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast + //! (SelectedOwner()); TopoDS_Shape aSelShape = aBRepOwner->Shape(); TopoDS_Shape //! aLocatedShape = aSelShape.Located (aBRepOwner->Location() * aSelShape.Location()); //! @endcode //! @sa SelectedOwner(), HasSelectedShape(). @@ -726,33 +728,37 @@ public: //! @name Selection management //! Returns SelectedInteractive()->HasOwner(). //! @sa SelectedOwner(). - Standard_Boolean HasApplicative() const { return SelectedInteractive()->HasOwner(); } + bool HasApplicative() const { return SelectedInteractive()->HasOwner(); } //! Returns SelectedInteractive()->GetOwner(). //! @sa SelectedOwner(). - Handle(Standard_Transient) Applicative() const { return SelectedInteractive()->GetOwner(); } + occ::handle Applicative() const { return SelectedInteractive()->GetOwner(); } public: //! @name immediate mode rendering - //! initializes the list of presentations to be displayed - //! returns False if no local context is opened. - Standard_EXPORT Standard_Boolean BeginImmediateDraw(); + Standard_DEPRECATED( + "Deprecated method - Graphic3d_ZLayerId with IsImmediate flag should be used instead") + Standard_EXPORT bool BeginImmediateDraw(); - //! returns True if has been stored in the list. - Standard_EXPORT Standard_Boolean ImmediateAdd(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Integer theMode = 0); + Standard_DEPRECATED( + "Deprecated method - Graphic3d_ZLayerId with IsImmediate flag should be used instead") + Standard_EXPORT bool ImmediateAdd(const occ::handle& theObj, + const int theMode = 0); - //! returns True if the immediate display has been done. - Standard_EXPORT Standard_Boolean EndImmediateDraw(const Handle(V3d_View)& theView); + Standard_DEPRECATED( + "Deprecated method - Graphic3d_ZLayerId with IsImmediate flag should be used instead") + Standard_EXPORT bool EndImmediateDraw(const occ::handle& theView); - //! Uses the First Active View of Main Viewer! - //! returns True if the immediate display has been done. - Standard_EXPORT Standard_Boolean EndImmediateDraw(); + Standard_DEPRECATED( + "Deprecated method - Graphic3d_ZLayerId with IsImmediate flag should be used instead") + Standard_EXPORT bool EndImmediateDraw(); - Standard_EXPORT Standard_Boolean IsImmediateModeOn() const; + Standard_DEPRECATED( + "Deprecated method - Graphic3d_ZLayerId with IsImmediate flag should be used instead") + Standard_EXPORT bool IsImmediateModeOn() const; //! Redraws immediate structures in all views of the viewer given taking into account its //! visibility. - void RedrawImmediate(const Handle(V3d_Viewer)& theViewer) + void RedrawImmediate(const occ::handle& theViewer) { myMainPM->RedrawImmediate(theViewer); } @@ -779,57 +785,58 @@ public: //! @name management of active Selection Modes //! @param theIsForce when set to TRUE, the display status will be ignored while activating //! selection mode Standard_EXPORT void SetSelectionModeActive( - const Handle(AIS_InteractiveObject)& theObj, - const Standard_Integer theMode, - const Standard_Boolean theToActivate, - const AIS_SelectionModesConcurrency theConcurrency = AIS_SelectionModesConcurrency_Multiple, - const Standard_Boolean theIsForce = Standard_False); + const occ::handle& theObj, + const int theMode, + const bool theToActivate, + const AIS_SelectionModesConcurrency theConcurrency = AIS_SelectionModesConcurrency_Multiple, + const bool theIsForce = false); //! Activates the selection mode aMode whose index is given, for the given interactive entity //! anIobj. - void Activate(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Integer theMode = 0, - const Standard_Boolean theIsForce = Standard_False) + void Activate(const occ::handle& theObj, + const int theMode = 0, + const bool theIsForce = false) { SetSelectionModeActive(theObj, theMode, - Standard_True, + true, AIS_SelectionModesConcurrency_GlobalOrLocal, theIsForce); } //! Activates the given selection mode for the all displayed objects. - Standard_EXPORT void Activate(const Standard_Integer theMode, - const Standard_Boolean theIsForce = Standard_False); + Standard_EXPORT void Activate(const int theMode, const bool theIsForce = false); //! Deactivates all the activated selection modes of an object. - void Deactivate(const Handle(AIS_InteractiveObject)& theObj) + void Deactivate(const occ::handle& theObj) { - SetSelectionModeActive(theObj, -1, Standard_False, AIS_SelectionModesConcurrency_Single); + SetSelectionModeActive(theObj, -1, false, AIS_SelectionModesConcurrency_Single); } //! Deactivates all the activated selection modes of the interactive object anIobj with a given //! selection mode aMode. - void Deactivate(const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode) + void Deactivate(const occ::handle& theObj, const int theMode) { - SetSelectionModeActive(theObj, theMode, Standard_False); + SetSelectionModeActive(theObj, theMode, false); } //! Deactivates the given selection mode for all displayed objects. - Standard_EXPORT void Deactivate(const Standard_Integer theMode); + Standard_EXPORT void Deactivate(const int theMode); //! Deactivates all the activated selection mode at all displayed objects. Standard_EXPORT void Deactivate(); //! Returns the list of activated selection modes. - Standard_EXPORT void ActivatedModes(const Handle(AIS_InteractiveObject)& anIobj, - TColStd_ListOfInteger& theList) const; + Standard_EXPORT void ActivatedModes(const occ::handle& anIobj, + NCollection_List& theList) const; //! Returns a collection containing all entity owners created for the interactive object in //! specified selection mode (in all active modes if the Mode == -1) - Standard_EXPORT void EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& theOwners, - const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theMode = -1) const; + Standard_EXPORT void EntityOwners( + occ::handle>>>& + theOwners, + const occ::handle& theIObj, + const int theMode = -1) const; public: //! @name Selection Filters management //! @return the context selection filter type. @@ -844,16 +851,22 @@ public: //! @name Selection Filters management } //! Returns the list of filters active in a local context. - const SelectMgr_ListOfFilter& Filters() const { return myFilters->StoredFilters(); } + const NCollection_List>& Filters() const + { + return myFilters->StoredFilters(); + } //! @return the context selection global context filter. - const Handle(SelectMgr_AndOrFilter)& GlobalFilter() const { return myFilters; } + const occ::handle& GlobalFilter() const { return myFilters; } //! Allows you to add the filter. - void AddFilter(const Handle(SelectMgr_Filter)& theFilter) { myFilters->Add(theFilter); } + void AddFilter(const occ::handle& theFilter) { myFilters->Add(theFilter); } //! Removes a filter from context. - void RemoveFilter(const Handle(SelectMgr_Filter)& theFilter) { myFilters->Remove(theFilter); } + void RemoveFilter(const occ::handle& theFilter) + { + myFilters->Remove(theFilter); + } //! Remove all filters from context. void RemoveFilters() { myFilters->Clear(); } @@ -885,24 +898,27 @@ public: //! @name common properties //! Returns the default attribute manager. //! This contains all the color and line attributes which can be used by interactive objects which //! do not have their own attributes. - const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; } + const occ::handle& DefaultDrawer() const { return myDefaultDrawer; } //! Sets the default attribute manager; should be set at context creation time. //! Warning - this setter doesn't update links to the default drawer of already displayed objects! - void SetDefaultDrawer(const Handle(Prs3d_Drawer)& theDrawer) + void SetDefaultDrawer(const occ::handle& theDrawer) { myDefaultDrawer = theDrawer; myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer; } //! Returns the current viewer. - const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; } + const occ::handle& CurrentViewer() const { return myMainVwr; } - const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; } + const occ::handle& SelectionManager() const { return mgrSelector; } - const Handle(PrsMgr_PresentationManager)& MainPrsMgr() const { return myMainPM; } + const occ::handle& MainPrsMgr() const { return myMainPM; } - const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return mgrSelector->Selector(); } + const occ::handle& MainSelector() const + { + return mgrSelector->Selector(); + } //! Updates the current viewer. Standard_EXPORT void UpdateCurrentViewer(); @@ -910,163 +926,171 @@ public: //! @name common properties //! Returns the list of displayed objects of a particular Type WhichKind and Signature //! WhichSignature. By Default, WhichSignature equals -1. This means that there is a check on type //! only. - Standard_EXPORT void DisplayedObjects(AIS_ListOfInteractive& aListOfIO) const; + Standard_EXPORT void DisplayedObjects( + NCollection_List>& aListOfIO) const; //! gives the list of displayed objects of a particular Type and signature. //! by Default, = -1 means control only on . - Standard_EXPORT void DisplayedObjects(const AIS_KindOfInteractive theWhichKind, - const Standard_Integer theWhichSignature, - AIS_ListOfInteractive& theListOfIO) const; + Standard_EXPORT void DisplayedObjects( + const AIS_KindOfInteractive theWhichKind, + const int theWhichSignature, + NCollection_List>& theListOfIO) const; //! Returns the list theListOfIO of erased objects (hidden objects) particular Type WhichKind and //! Signature WhichSignature. By Default, WhichSignature equals 1. This means that there is a //! check on type only. - Standard_EXPORT void ErasedObjects(AIS_ListOfInteractive& theListOfIO) const; + Standard_EXPORT void ErasedObjects( + NCollection_List>& theListOfIO) const; //! gives the list of erased objects (hidden objects) //! Type and signature by Default, = -1 means control only on . - Standard_EXPORT void ErasedObjects(const AIS_KindOfInteractive theWhichKind, - const Standard_Integer theWhichSignature, - AIS_ListOfInteractive& theListOfIO) const; + Standard_EXPORT void ErasedObjects( + const AIS_KindOfInteractive theWhichKind, + const int theWhichSignature, + NCollection_List>& theListOfIO) const; //! Returns the list theListOfIO of objects with indicated display status particular Type //! WhichKind and Signature WhichSignature. By Default, WhichSignature equals 1. This means that //! there is a check on type only. - Standard_EXPORT void ObjectsByDisplayStatus(const PrsMgr_DisplayStatus theStatus, - AIS_ListOfInteractive& theListOfIO) const; + Standard_EXPORT void ObjectsByDisplayStatus( + const PrsMgr_DisplayStatus theStatus, + NCollection_List>& theListOfIO) const; //! gives the list of objects with indicated display status //! Type and signature by Default, = -1 means control only on . - Standard_EXPORT void ObjectsByDisplayStatus(const AIS_KindOfInteractive WhichKind, - const Standard_Integer WhichSignature, - const PrsMgr_DisplayStatus theStatus, - AIS_ListOfInteractive& theListOfIO) const; + Standard_EXPORT void ObjectsByDisplayStatus( + const AIS_KindOfInteractive WhichKind, + const int WhichSignature, + const PrsMgr_DisplayStatus theStatus, + NCollection_List>& theListOfIO) const; //! fills with objects of a particular Type and Signature with no consideration of //! display status. by Default, = -1 means control only on . if //! = AIS_KindOfInteractive_None and = -1, all the objects are put //! into the list. Standard_EXPORT void ObjectsInside( - AIS_ListOfInteractive& aListOfIO, - const AIS_KindOfInteractive WhichKind = AIS_KindOfInteractive_None, - const Standard_Integer WhichSignature = -1) const; + NCollection_List>& aListOfIO, + const AIS_KindOfInteractive WhichKind = AIS_KindOfInteractive_None, + const int WhichSignature = -1) const; //! Create iterator through all objects registered in context. - AIS_DataMapIteratorOfDataMapOfIOStatus ObjectIterator() const + NCollection_DataMap, occ::handle>::Iterator + ObjectIterator() const { - return AIS_DataMapIteratorOfDataMapOfIOStatus(myObjects); + return NCollection_DataMap, + occ::handle>::Iterator(myObjects); } //! Rebuilds 1st level of BVH selection forcibly Standard_EXPORT void RebuildSelectionStructs(); //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures - Standard_EXPORT void Disconnect(const Handle(AIS_InteractiveObject)& theAssembly, - const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL); + Standard_EXPORT void Disconnect( + const occ::handle& theAssembly, + const occ::handle& theObjToDisconnect = nullptr); //! Query objects visible or hidden in specified view due to affinity mask. Standard_EXPORT void ObjectsForView( - AIS_ListOfInteractive& theListOfIO, - const Handle(V3d_View)& theView, - const Standard_Boolean theIsVisibleInView, + NCollection_List>& theListOfIO, + const occ::handle& theView, + const bool theIsVisibleInView, const PrsMgr_DisplayStatus theStatus = PrsMgr_DisplayStatus_None) const; //! Return rotation gravity point. - Standard_EXPORT virtual gp_Pnt GravityPoint(const Handle(V3d_View)& theView) const; + Standard_EXPORT virtual gp_Pnt GravityPoint(const occ::handle& theView) const; public: //! @name debug visualization //! Visualization of sensitives - for debugging purposes! - Standard_EXPORT void DisplayActiveSensitive(const Handle(V3d_View)& aView); + Standard_EXPORT void DisplayActiveSensitive(const occ::handle& aView); //! Clear visualization of sensitives. - Standard_EXPORT void ClearActiveSensitive(const Handle(V3d_View)& aView); + Standard_EXPORT void ClearActiveSensitive(const occ::handle& aView); //! Visualization of sensitives - for debugging purposes! - Standard_EXPORT void DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anObject, - const Handle(V3d_View)& aView); + Standard_EXPORT void DisplayActiveSensitive(const occ::handle& anObject, + const occ::handle& aView); public: //! @name common object display attributes //! Sets the graphic attributes of the interactive object, such as visualization mode, color, and //! material. - Standard_EXPORT void SetLocalAttributes(const Handle(AIS_InteractiveObject)& theIObj, - const Handle(Prs3d_Drawer)& theDrawer, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetLocalAttributes(const occ::handle& theIObj, + const occ::handle& theDrawer, + const bool theToUpdateViewer); //! Removes the settings for local attributes of the Object and returns to defaults. - Standard_EXPORT void UnsetLocalAttributes(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnsetLocalAttributes(const occ::handle& theIObj, + const bool theToUpdateViewer); //! change the current facing model apply on polygons for SetColor(), SetTransparency(), //! SetMaterial() methods default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes //! is applying both on the front and back face. Standard_EXPORT void SetCurrentFacingModel( - const Handle(AIS_InteractiveObject)& aniobj, - const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); + const occ::handle& aniobj, + const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); //! Returns true if a view of the Interactive Object has color. - Standard_EXPORT Standard_Boolean HasColor(const Handle(AIS_InteractiveObject)& aniobj) const; + Standard_EXPORT bool HasColor(const occ::handle& aniobj) const; //! Returns the color of the Object in the interactive context. - Standard_EXPORT void Color(const Handle(AIS_InteractiveObject)& aniobj, - Quantity_Color& acolor) const; + Standard_EXPORT void Color(const occ::handle& aniobj, + Quantity_Color& acolor) const; //! Sets the color of the selected entity. - Standard_EXPORT void SetColor(const Handle(AIS_InteractiveObject)& theIObj, - const Quantity_Color& theColor, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetColor(const occ::handle& theIObj, + const Quantity_Color& theColor, + const bool theToUpdateViewer); //! Removes the color selection for the selected entity. - Standard_EXPORT void UnsetColor(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnsetColor(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Returns the width of the Interactive Object in the interactive context. - Standard_EXPORT virtual Standard_Real Width(const Handle(AIS_InteractiveObject)& aniobj) const; + Standard_EXPORT virtual double Width(const occ::handle& aniobj) const; //! Sets the width of the Object. - Standard_EXPORT virtual void SetWidth(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Real theValue, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT virtual void SetWidth(const occ::handle& theIObj, + const double theValue, + const bool theToUpdateViewer); //! Removes the width setting of the Object. - Standard_EXPORT virtual void UnsetWidth(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT virtual void UnsetWidth(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Provides the type of material setting for the view of the Object. - Standard_EXPORT void SetMaterial(const Handle(AIS_InteractiveObject)& theIObj, - const Graphic3d_MaterialAspect& theMaterial, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetMaterial(const occ::handle& theIObj, + const Graphic3d_MaterialAspect& theMaterial, + const bool theToUpdateViewer); //! Removes the type of material setting for viewing the Object. - Standard_EXPORT void UnsetMaterial(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnsetMaterial(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Provides the transparency settings for viewing the Object. //! The transparency value aValue may be between 0.0, opaque, and 1.0, fully transparent. - Standard_EXPORT void SetTransparency(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Real theValue, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetTransparency(const occ::handle& theIObj, + const double theValue, + const bool theToUpdateViewer); //! Removes the transparency settings for viewing the Object. - Standard_EXPORT void UnsetTransparency(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void UnsetTransparency(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Sets up polygon offsets for the given AIS_InteractiveObject. //! It simply calls AIS_InteractiveObject::SetPolygonOffsets(). - Standard_EXPORT void SetPolygonOffsets(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theMode, - const Standard_ShortReal theFactor, - const Standard_ShortReal theUnits, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetPolygonOffsets(const occ::handle& theIObj, + const int theMode, + const float theFactor, + const float theUnits, + const bool theToUpdateViewer); //! Simply calls AIS_InteractiveObject::HasPolygonOffsets(). - Standard_EXPORT Standard_Boolean - HasPolygonOffsets(const Handle(AIS_InteractiveObject)& anObj) const; + Standard_EXPORT bool HasPolygonOffsets(const occ::handle& anObj) const; //! Retrieves current polygon offsets settings for Object. - Standard_EXPORT void PolygonOffsets(const Handle(AIS_InteractiveObject)& anObj, - Standard_Integer& aMode, - Standard_ShortReal& aFactor, - Standard_ShortReal& aUnits) const; + Standard_EXPORT void PolygonOffsets(const occ::handle& anObj, + int& aMode, + float& aFactor, + float& aUnits) const; public: //! @name trihedron display attributes //! Sets the size aSize of the trihedron. @@ -1074,26 +1098,24 @@ public: //! @name trihedron display attributes //! Use of this function in one of your own interactive objects requires a call to the Compute //! function of the new class. This will recalculate the presentation for every trihedron //! displayed. - Standard_EXPORT void SetTrihedronSize(const Standard_Real theSize, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetTrihedronSize(const double theSize, const bool theToUpdateViewer); //! returns the current value of trihedron size. - Standard_EXPORT Standard_Real TrihedronSize() const; + Standard_EXPORT double TrihedronSize() const; public: //! @name plane display attributes //! Sets the plane size defined by the length in the X direction XSize and that in the Y direction //! YSize. - Standard_EXPORT void SetPlaneSize(const Standard_Real theSizeX, - const Standard_Real theSizeY, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetPlaneSize(const double theSizeX, + const double theSizeY, + const bool theToUpdateViewer); //! Sets the plane size aSize. - Standard_EXPORT void SetPlaneSize(const Standard_Real theSize, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetPlaneSize(const double theSize, const bool theToUpdateViewer); //! Returns true if the length in the X direction XSize is the same as that in the Y direction //! YSize. - Standard_EXPORT Standard_Boolean PlaneSize(Standard_Real& XSize, Standard_Real& YSize) const; + Standard_EXPORT bool PlaneSize(double& XSize, double& YSize) const; public: //! @name tessellation deviation properties for automatic triangulation //! Sets the deviation coefficient theCoefficient. @@ -1108,18 +1130,18 @@ public: //! @name tessellation deviation properties for automatic triangulation //! The default value is 0.001. //! In drawing shapes, however, you are allowed to ask for a relative deviation. //! This deviation will be: SizeOfObject * DeviationCoefficient. - Standard_EXPORT void SetDeviationCoefficient(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Real theCoefficient, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetDeviationCoefficient(const occ::handle& theIObj, + const double theCoefficient, + const bool theToUpdateViewer); - Standard_EXPORT void SetDeviationAngle(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Real theAngle, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetDeviationAngle(const occ::handle& theIObj, + const double theAngle, + const bool theToUpdateViewer); //! Calls the AIS_Shape SetAngleAndDeviation to set both Angle and Deviation coefficients - Standard_EXPORT void SetAngleAndDeviation(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Real theAngle, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetAngleAndDeviation(const occ::handle& theIObj, + const double theAngle, + const bool theToUpdateViewer); //! Sets the deviation coefficient theCoefficient. //! Drawings of curves or patches are made with respect to a maximal chordal deviation. @@ -1133,7 +1155,7 @@ public: //! @name tessellation deviation properties for automatic triangulation //! The default value is 0.001. //! In drawing shapes, however, you are allowed to ask for a relative deviation. //! This deviation will be: SizeOfObject * DeviationCoefficient. - void SetDeviationCoefficient(const Standard_Real theCoefficient) + void SetDeviationCoefficient(const double theCoefficient) { myDefaultDrawer->SetDeviationCoefficient(theCoefficient); } @@ -1149,15 +1171,12 @@ public: //! @name tessellation deviation properties for automatic triangulation //! is absolute and is set through Prs3d_Drawer::SetMaximalChordialDeviation. The default value is //! 0.001. In drawing shapes, however, you are allowed to ask for a relative deviation. This //! deviation will be: SizeOfObject * DeviationCoefficient. - Standard_Real DeviationCoefficient() const { return myDefaultDrawer->DeviationCoefficient(); } + double DeviationCoefficient() const { return myDefaultDrawer->DeviationCoefficient(); } //! default 20 degrees - void SetDeviationAngle(const Standard_Real theAngle) - { - myDefaultDrawer->SetDeviationAngle(theAngle); - } + void SetDeviationAngle(const double theAngle) { myDefaultDrawer->SetDeviationAngle(theAngle); } - Standard_Real DeviationAngle() const { return myDefaultDrawer->DeviationAngle(); } + double DeviationAngle() const { return myDefaultDrawer->DeviationAngle(); } public: //! @name HLR (Hidden Line Removal) display attributes //! Initializes hidden line aspect in the default drawing tool, or Drawer. @@ -1165,21 +1184,21 @@ public: //! @name HLR (Hidden Line Removal) display attributes //! Color: Quantity_NOC_YELLOW //! Type of line: Aspect_TOL_DASH //! Width: 1. - const Handle(Prs3d_LineAspect)& HiddenLineAspect() const + const occ::handle& HiddenLineAspect() const { return myDefaultDrawer->HiddenLineAspect(); } //! Sets the hidden line aspect anAspect. //! Aspect defines display attributes for hidden lines in HLR projections. - void SetHiddenLineAspect(const Handle(Prs3d_LineAspect)& theAspect) const + void SetHiddenLineAspect(const occ::handle& theAspect) const { myDefaultDrawer->SetHiddenLineAspect(theAspect); } - //! returns Standard_True if the hidden lines are to be drawn. + //! returns true if the hidden lines are to be drawn. //! By default the hidden lines are not drawn. - Standard_Boolean DrawHiddenLine() const { return myDefaultDrawer->DrawHiddenLine(); } + bool DrawHiddenLine() const { return myDefaultDrawer->DrawHiddenLine(); } void EnableDrawHiddenLine() const { myDefaultDrawer->EnableDrawHiddenLine(); } @@ -1187,50 +1206,45 @@ public: //! @name HLR (Hidden Line Removal) display attributes public: //! @name iso-line display attributes //! Sets the number of U and V isoparameters displayed. - Standard_EXPORT void SetIsoNumber(const Standard_Integer NbIsos, - const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); + Standard_EXPORT void SetIsoNumber(const int NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); //! Returns the number of U and V isoparameters displayed. - Standard_EXPORT Standard_Integer IsoNumber(const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); + Standard_EXPORT int IsoNumber(const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); //! Returns True if drawing isoparameters on planes is enabled. - void IsoOnPlane(const Standard_Boolean theToSwitchOn) - { - myDefaultDrawer->SetIsoOnPlane(theToSwitchOn); - } + void IsoOnPlane(const bool theToSwitchOn) { myDefaultDrawer->SetIsoOnPlane(theToSwitchOn); } //! Returns True if drawing isoparameters on planes is enabled. //! if = False, - Standard_Boolean IsoOnPlane() const { return myDefaultDrawer->IsoOnPlane(); } + bool IsoOnPlane() const { return myDefaultDrawer->IsoOnPlane(); } //! Enables or disables on-triangulation build for isolines for a particular object. //! In case if on-triangulation builder is disabled, default on-plane builder will compute //! isolines for the object given. - Standard_EXPORT void IsoOnTriangulation(const Standard_Boolean theIsEnabled, - const Handle(AIS_InteractiveObject)& theObject); + Standard_EXPORT void IsoOnTriangulation(const bool theIsEnabled, + const occ::handle& theObject); //! Enables or disables on-triangulation build for isolines for default drawer. //! In case if on-triangulation builder is disabled, default on-plane builder will compute //! isolines for the object given. - void IsoOnTriangulation(const Standard_Boolean theToSwitchOn) + void IsoOnTriangulation(const bool theToSwitchOn) { myDefaultDrawer->SetIsoOnTriangulation(theToSwitchOn); } //! Returns true if drawing isolines on triangulation algorithm is enabled. - Standard_Boolean IsoOnTriangulation() const { return myDefaultDrawer->IsoOnTriangulation(); } + bool IsoOnTriangulation() const { return myDefaultDrawer->IsoOnTriangulation(); } //! @name obsolete methods public: Standard_DEPRECATED("Deprecated method Display() with obsolete argument " "theToAllowDecomposition") - - void Display(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Integer theDispMode, - const Standard_Integer theSelectionMode, - const Standard_Boolean theToUpdateViewer, - const Standard_Boolean theToAllowDecomposition, - const PrsMgr_DisplayStatus theDispStatus = PrsMgr_DisplayStatus_None) + void Display(const occ::handle& theIObj, + const int theDispMode, + const int theSelectionMode, + const bool theToUpdateViewer, + const bool theToAllowDecomposition, + const PrsMgr_DisplayStatus theDispStatus = PrsMgr_DisplayStatus_None) { (void)theToAllowDecomposition; Display(theIObj, theDispMode, theSelectionMode, theToUpdateViewer, theDispStatus); @@ -1238,10 +1252,7 @@ public: Standard_DEPRECATED("Deprecated method Load() with obsolete last argument " "theToAllowDecomposition") - - void Load(const Handle(AIS_InteractiveObject)& theObj, - Standard_Integer theSelectionMode, - Standard_Boolean) + void Load(const occ::handle& theObj, int theSelectionMode, bool) { Load(theObj, theSelectionMode); } @@ -1250,9 +1261,7 @@ public: //! On dynamic detection by the mouse cursor, sensitive primitives are highlighted. //! The highlight color of entities detected by mouse movement is white by default. Standard_DEPRECATED("Deprecated method Hilight()") - - void Hilight(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Boolean theIsToUpdateViewer) + void Hilight(const occ::handle& theObj, const bool theIsToUpdateViewer) { return HilightWithColor(theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer); } @@ -1260,59 +1269,59 @@ public: //! Sets the graphic basic aspect to the current presentation of ALL selected objects. Standard_DEPRECATED( "Deprecated method - presentation attributes should be assigned directly to object") - Standard_EXPORT void SetSelectedAspect(const Handle(Prs3d_BasicAspect)& theAspect, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SetSelectedAspect(const occ::handle& theAspect, + const bool theToUpdateViewer); //! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, //! XPMin, YPMin, XPMax, and YPMax in the view. The objects detected are passed to the main //! viewer, which is then updated. Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking " "AIS_SelectionScheme_Replace should be called instead") - Standard_EXPORT AIS_StatusOfPick Select(const Standard_Integer theXPMin, - const Standard_Integer theYPMin, - const Standard_Integer theXPMax, - const Standard_Integer theYPMax, - const Handle(V3d_View)& theView, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick Select(const int theXPMin, + const int theYPMin, + const int theXPMax, + const int theYPMax, + const occ::handle& theView, + const bool theToUpdateViewer); //! polyline selection; clears the previous picked list Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking " "AIS_SelectionScheme_Replace should be called instead") - Standard_EXPORT AIS_StatusOfPick Select(const TColgp_Array1OfPnt2d& thePolyline, - const Handle(V3d_View)& theView, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick Select(const NCollection_Array1& thePolyline, + const occ::handle& theView, + const bool theToUpdateViewer); //! Stores and hilights the previous detected; Unhilights the previous picked. //! @sa MoveTo(). Standard_DEPRECATED("This method is deprecated - SelectDetected() taking " "AIS_SelectionScheme_Replace should be called instead") - Standard_EXPORT AIS_StatusOfPick Select(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick Select(const bool theToUpdateViewer); //! Adds the last detected to the list of previous picked. //! If the last detected was already declared as picked, removes it from the Picked List. //! @sa MoveTo(). Standard_DEPRECATED("This method is deprecated - SelectDetected() taking AIS_SelectionScheme_XOR " "should be called instead") - Standard_EXPORT AIS_StatusOfPick ShiftSelect(const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick ShiftSelect(const bool theToUpdateViewer); //! Adds the last detected to the list of previous picked. //! If the last detected was already declared as picked, removes it from the Picked List. Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking AIS_SelectionScheme_XOR " "should be called instead") - Standard_EXPORT AIS_StatusOfPick ShiftSelect(const TColgp_Array1OfPnt2d& thePolyline, - const Handle(V3d_View)& theView, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick ShiftSelect(const NCollection_Array1& thePolyline, + const occ::handle& theView, + const bool theToUpdateViewer); //! Rectangle of selection; adds new detected entities into the picked list, //! removes the detected entities that were already stored. Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking " "AIS_SelectionScheme_XOR should be called instead") - Standard_EXPORT AIS_StatusOfPick ShiftSelect(const Standard_Integer theXPMin, - const Standard_Integer theYPMin, - const Standard_Integer theXPMax, - const Standard_Integer theYPMax, - const Handle(V3d_View)& theView, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT AIS_StatusOfPick ShiftSelect(const int theXPMin, + const int theYPMin, + const int theXPMax, + const int theYPMax, + const occ::handle& theView, + const bool theToUpdateViewer); public: //! Updates the view of the current object in open context. @@ -1320,9 +1329,8 @@ public: //! selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void SetCurrentObject(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer) + void SetCurrentObject(const occ::handle& theIObj, + const bool theToUpdateViewer) { SetSelected(theIObj, theToUpdateViewer); } @@ -1333,9 +1341,8 @@ public: //! object, if 0 selection of the object is empty this method simply does nothing. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void AddOrRemoveCurrentObject(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Boolean theIsToUpdateViewer) + void AddOrRemoveCurrentObject(const occ::handle& theObj, + const bool theIsToUpdateViewer) { AddOrRemoveSelected(theObj, theIsToUpdateViewer); } @@ -1345,16 +1352,14 @@ public: //! current objects; those selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void UpdateCurrent() { UpdateSelected(Standard_True); } + void UpdateCurrent() { UpdateSelected(true); } //! Returns true if there is a non-null interactive object in Neutral Point. //! Objects selected when there is no open local context are called current objects; //! those selected in open local context, selected objects. Standard_DEPRECATED( "Local Context is deprecated - local selection should be used without Local Context") - - Standard_Boolean IsCurrent(const Handle(AIS_InteractiveObject)& theObject) const + bool IsCurrent(const occ::handle& theObject) const { return IsSelected(theObject); } @@ -1364,7 +1369,6 @@ public: //! selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - void InitCurrent() { InitSelected(); } //! Returns true if there is another object found by the scan of the list of current objects. @@ -1372,15 +1376,13 @@ public: //! selected in open local context, selected objects. Standard_DEPRECATED( "Local Context is deprecated - local selection should be used without Local Context") - - Standard_Boolean MoreCurrent() const { return MoreSelected(); } + bool MoreCurrent() const { return MoreSelected(); } //! Continues the scan to the next object in the list of current objects. //! Objects selected when there is no open local context are called current objects; those //! selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - void NextCurrent() { NextSelected(); } //! Returns the current interactive object. @@ -1388,43 +1390,32 @@ public: //! selected in open local context, selected objects. Standard_DEPRECATED( "Local Context is deprecated - local selection should be used without Local Context") - - Handle(AIS_InteractiveObject) Current() const { return SelectedInteractive(); } + occ::handle Current() const { return SelectedInteractive(); } Standard_DEPRECATED( "Local Context is deprecated - local selection should be used without Local Context") - - Standard_Integer NbCurrents() { return NbSelected(); } + int NbCurrents() { return NbSelected(); } //! Highlights current objects. //! Objects selected when there is no open local context are called current objects; those //! selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void HilightCurrents(const Standard_Boolean theToUpdateViewer) - { - HilightSelected(theToUpdateViewer); - } + void HilightCurrents(const bool theToUpdateViewer) { HilightSelected(theToUpdateViewer); } //! Removes highlighting from current objects. //! Objects selected when there is no open local context are called current objects; those //! selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void UnhilightCurrents(const Standard_Boolean theToUpdateViewer) - { - UnhilightSelected(theToUpdateViewer); - } + void UnhilightCurrents(const bool theToUpdateViewer) { UnhilightSelected(theToUpdateViewer); } //! Empties previous current objects in order to get the current objects detected by the selector //! using UpdateCurrent. Objects selected when there is no open local context are called current //! objects; those selected in open local context, selected objects. Standard_DEPRECATED("Local Context is deprecated - local selection should be used without Local " "Context") - - void ClearCurrents(const Standard_Boolean theToUpdateViewer) { ClearSelected(theToUpdateViewer); } + void ClearCurrents(const bool theToUpdateViewer) { ClearSelected(theToUpdateViewer); } //! @return current mouse-detected shape or empty (null) shape, if current interactive object //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all. @@ -1438,7 +1429,7 @@ public: //! @sa DetectedCurrentOwner(), InitDetected(), MoreDetected(), NextDetected(). Standard_DEPRECATED( "Local Context is deprecated - ::DetectedCurrentOwner() should be called instead") - Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const; + Standard_EXPORT occ::handle DetectedCurrentObject() const; public: //! @name sub-intensity management (deprecated) //! Sub-intensity allows temporary highlighting of particular objects with specified color in a @@ -1463,95 +1454,94 @@ public: //! @name sub-intensity management (deprecated) //! Point with subintensity color. Available only for active local context. There is no effect if //! there is no local context. If a local context is open, the presentation of the Interactive //! Object activates the selection mode. - Standard_EXPORT void SubIntensityOn(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SubIntensityOn(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Removes the subintensity option for the entity. //! If a local context is open, the presentation of the Interactive Object activates the selection //! mode. - Standard_EXPORT void SubIntensityOff(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void SubIntensityOff(const occ::handle& theIObj, + const bool theToUpdateViewer); //! Returns selection instance - const Handle(AIS_Selection)& Selection() const { return mySelection; } + const occ::handle& Selection() const { return mySelection; } //! Sets selection instance to manipulate a container of selected owners //! @param theSelection an instance of the selection - void SetSelection(const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; } + void SetSelection(const occ::handle& theSelection) { mySelection = theSelection; } //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const; + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; protected: //! @name internal methods - Standard_EXPORT void GetDefModes(const Handle(AIS_InteractiveObject)& anIobj, - Standard_Integer& Dmode, - Standard_Integer& HiMod, - Standard_Integer& SelMode) const; + Standard_EXPORT void GetDefModes(const occ::handle& anIobj, + int& Dmode, + int& HiMod, + int& SelMode) const; - Standard_EXPORT void EraseGlobal(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void EraseGlobal(const occ::handle& theIObj, + const bool theToUpdateViewer); - Standard_EXPORT void ClearGlobal(const Handle(AIS_InteractiveObject)& theIObj, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void ClearGlobal(const occ::handle& theIObj, + const bool theToUpdateViewer); - Standard_EXPORT void ClearGlobalPrs(const Handle(AIS_InteractiveObject)& theObj, - const Standard_Integer theMode, - const Standard_Boolean theToUpdateViewer); + Standard_EXPORT void ClearGlobalPrs(const occ::handle& theObj, + const int theMode, + const bool theToUpdateViewer); Standard_EXPORT void InitAttributes(); //! Highlights detected objects. //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to update view. - Standard_EXPORT AIS_StatusOfDetection moveTo(const Handle(V3d_View)& theView, - const Standard_Boolean theToRedrawOnUpdate); + Standard_EXPORT AIS_StatusOfDetection moveTo(const occ::handle& theView, + const bool theToRedrawOnUpdate); //! Returns True if the object is detected. - Standard_EXPORT Standard_Boolean isDetected(const Handle(AIS_InteractiveObject)& theObject); + Standard_EXPORT bool isDetected(const occ::handle& theObject); //! Helper function to unhighlight all entity owners currently highlighted with seleciton color. - Standard_EXPORT void unselectOwners(const Handle(AIS_InteractiveObject)& theObject); + Standard_EXPORT void unselectOwners(const occ::handle& theObject); //! Helper function that highlights the owner given with without //! performing AutoHighlight checks, e.g. is used for dynamic highlight. - Standard_EXPORT void highlightWithColor(const Handle(SelectMgr_EntityOwner)& theOwner, - const Handle(V3d_Viewer)& theViewer = NULL); + Standard_EXPORT void highlightWithColor(const occ::handle& theOwner, + const occ::handle& theViewer = nullptr); //! Helper function that highlights the owner given with with check //! for AutoHighlight, e.g. is used for selection. - Standard_EXPORT void highlightSelected(const Handle(SelectMgr_EntityOwner)& theOwner); + Standard_EXPORT void highlightSelected(const occ::handle& theOwner); //! Helper function that highlights the owners with check for AutoHighlight, e.g. is used for //! selection. //! @param[in] theOwners list of owners to highlight //! @param[in] theStyle highlight style to apply or NULL to apply selection style - Standard_EXPORT void highlightOwners(const AIS_NListOfEntityOwner& theOwners, - const Handle(Prs3d_Drawer)& theStyle); + Standard_EXPORT void highlightOwners( + const NCollection_List>& theOwners, + const occ::handle& theStyle); //! Helper function that highlights global owner of the object given with with check //! for AutoHighlight, e.g. is used for selection. //! If global owner is null, it simply highlights the whole object - Standard_EXPORT void highlightGlobal(const Handle(AIS_InteractiveObject)& theObj, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theDispMode); + Standard_EXPORT void highlightGlobal(const occ::handle& theObj, + const occ::handle& theStyle, + const int theDispMode); //! Helper function that unhighlights all owners that are stored in current AIS_Selection. //! The function updates global status and selection state of owner and interactive object. //! If the parameter is set to true, interactive objects with //! sub-intensity switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity //! color. - Standard_EXPORT void unhighlightSelected( - const Standard_Boolean theIsToHilightSubIntensity = Standard_False); + Standard_EXPORT void unhighlightSelected(const bool theIsToHilightSubIntensity = false); //! Helper function that unhighlights the owners with check //! for AutoHighlight, e.g. is used for selection. Standard_EXPORT void unhighlightOwners( - const AIS_NListOfEntityOwner& theOwners, - const Standard_Boolean theIsToHilightSubIntensity = Standard_False); + const NCollection_List>& theOwners, + const bool theIsToHilightSubIntensity = false); //! Helper function that unhighlights global selection owner of given interactive. //! The function does not perform any updates of global or owner status - Standard_EXPORT void unhighlightGlobal(const Handle(AIS_InteractiveObject)& theObj); + Standard_EXPORT void unhighlightGlobal(const occ::handle& theObj); //! Helper function that turns on sub-intensity in global status and highlights //! given objects with sub-intensity color @@ -1562,30 +1552,32 @@ protected: //! @name internal methods //! @param[in] theIsDisplayedOnly is true if sub-intensity should be applied only to objects with //! status AIS_DS_Displayed Standard_EXPORT void turnOnSubintensity( - const Handle(AIS_InteractiveObject)& theObject = NULL, - const Standard_Integer theDispMode = -1, - const Standard_Boolean theIsDisplayedOnly = Standard_True) const; + const occ::handle& theObject = nullptr, + const int theDispMode = -1, + const bool theIsDisplayedOnly = true) const; //! Helper function that highlights the object with sub-intensity color without any checks //! @param[in] theObject the object that will be highlighted //! @param[in] theMode display mode - Standard_EXPORT void highlightWithSubintensity(const Handle(AIS_InteractiveObject)& theObject, - const Standard_Integer theMode) const; + Standard_EXPORT void highlightWithSubintensity( + const occ::handle& theObject, + const int theMode) const; //! Helper function that highlights the owner with sub-intensity color without any checks //! @param[in] theOwner the owner that will be highlighted //! @param[in] theMode display mode - Standard_EXPORT void highlightWithSubintensity(const Handle(SelectMgr_EntityOwner)& theOwner, - const Standard_Integer theMode) const; + Standard_EXPORT void highlightWithSubintensity(const occ::handle& theOwner, + const int theMode) const; //! Helper function that returns correct dynamic highlight style for the object: //! if custom style is defined via object's highlight drawer, it will be used. Otherwise, //! dynamic highlight style of interactive context will be returned. //! @param[in] theObj the object to check - const Handle(Prs3d_Drawer)& getHiStyle(const Handle(AIS_InteractiveObject)& theObj, - const Handle(SelectMgr_EntityOwner)& theOwner) const + const occ::handle& getHiStyle( + const occ::handle& theObj, + const occ::handle& theOwner) const { - const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes(); + const occ::handle& aHiDrawer = theObj->DynamicHilightAttributes(); if (!aHiDrawer.IsNull()) { return aHiDrawer; @@ -1597,17 +1589,18 @@ protected: //! @name internal methods } //! Return TRUE if highlight style of owner requires full viewer redraw. - Standard_EXPORT Standard_Boolean isSlowHiStyle(const Handle(SelectMgr_EntityOwner)& theOwner, - const Handle(V3d_Viewer)& theViewer) const; + Standard_EXPORT bool isSlowHiStyle(const occ::handle& theOwner, + const occ::handle& theViewer) const; //! Helper function that returns correct selection style for the object: //! if custom style is defined via object's highlight drawer, it will be used. Otherwise, //! selection style of interactive context will be returned. //! @param[in] theObj the object to check - const Handle(Prs3d_Drawer)& getSelStyle(const Handle(AIS_InteractiveObject)& theObj, - const Handle(SelectMgr_EntityOwner)& theOwner) const + const occ::handle& getSelStyle( + const occ::handle& theObj, + const occ::handle& theOwner) const { - const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes(); + const occ::handle& aHiDrawer = theObj->HilightAttributes(); if (!aHiDrawer.IsNull()) { return aHiDrawer; @@ -1620,12 +1613,12 @@ protected: //! @name internal methods //! Assign the context to the object or throw exception if object was already assigned to another //! context. - Standard_EXPORT void setContextToObject(const Handle(AIS_InteractiveObject)& theObj); + Standard_EXPORT void setContextToObject(const occ::handle& theObj); //! Return display mode for highlighting. - Standard_Integer getHilightMode(const Handle(AIS_InteractiveObject)& theObj, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theDispMode) const + int getHilightMode(const occ::handle& theObj, + const occ::handle& theStyle, + const int theDispMode) const { if (!theStyle.IsNull() && theStyle->DisplayMode() != -1 && theObj->AcceptDisplayMode(theStyle->DisplayMode())) @@ -1655,32 +1648,30 @@ protected: //! @name internal methods //! Bind/Unbind status to object and its children //! @param[in] theIObj the object to change status //! @param[in] theStatus status, if NULL, unbind object - Standard_EXPORT void setObjectStatus(const Handle(AIS_InteractiveObject)& theIObj, - const PrsMgr_DisplayStatus theStatus, - const Standard_Integer theDispyMode, - const Standard_Integer theSelectionMode); + Standard_EXPORT void setObjectStatus(const occ::handle& theIObj, + const PrsMgr_DisplayStatus theStatus, + const int theDispyMode, + const int theSelectionMode); protected: //! @name internal fields - AIS_DataMapOfIOStatus myObjects; - Handle(SelectMgr_SelectionManager) mgrSelector; - Handle(PrsMgr_PresentationManager) myMainPM; - Handle(V3d_Viewer) myMainVwr; - V3d_View* myLastActiveView; - Handle(SelectMgr_EntityOwner) myLastPicked; - Standard_Boolean myToHilightSelected; - Handle(AIS_Selection) mySelection; - Handle(SelectMgr_AndOrFilter) myFilters; //!< context filter (the content active filters - //! can be applied with AND or OR operation) - Handle(Prs3d_Drawer) myDefaultDrawer; - Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB]; - TColStd_SequenceOfInteger myDetectedSeq; - Standard_Integer myCurDetected; - Standard_Integer myCurHighlighted; + NCollection_DataMap, occ::handle> myObjects; + occ::handle mgrSelector; + occ::handle myMainPM; + occ::handle myMainVwr; + V3d_View* myLastActiveView; + occ::handle myLastPicked; + bool myToHilightSelected; + occ::handle mySelection; + occ::handle myFilters; //!< context filter (the content active filters + //! can be applied with AND or OR operation) + occ::handle myDefaultDrawer; + occ::handle myStyles[Prs3d_TypeOfHighlight_NB]; + NCollection_Sequence myDetectedSeq; + int myCurDetected; + int myCurHighlighted; SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo() - Standard_Boolean myAutoHilight; - Standard_Boolean myIsAutoActivateSelMode; + bool myAutoHilight; + bool myIsAutoActivateSelMode; }; -DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient) - #endif // _AIS_InteractiveContext_HeaderFile diff --git a/opencascade/AIS_InteractiveObject.hxx b/opencascade/AIS_InteractiveObject.hxx index f5404e1ff..71e70ce58 100644 --- a/opencascade/AIS_InteractiveObject.hxx +++ b/opencascade/AIS_InteractiveObject.hxx @@ -60,30 +60,30 @@ public: //! - Line signature 5 //! - Circle signature 6 //! - Plane signature 7. - virtual Standard_Integer Signature() const { return -1; } + virtual int Signature() const { return -1; } - //! Updates the active presentation; if = Standard_True + //! Updates the active presentation; if = true //! all the presentations inside are recomputed. //! IMPORTANT: It is preferable to call Redisplay method of //! corresponding AIS_InteractiveContext instance for cases when it //! is accessible. This method just redirects call to myCTXPtr, //! so this class field must be up to date for proper result. - Standard_EXPORT void Redisplay(const Standard_Boolean AllModes = Standard_False); + Standard_EXPORT void Redisplay(const bool AllModes = false); //! Indicates whether the Interactive Object has a pointer to an interactive context. - Standard_Boolean HasInteractiveContext() const { return myCTXPtr != NULL; } + bool HasInteractiveContext() const { return myCTXPtr != nullptr; } //! Returns the context pointer to the interactive context. AIS_InteractiveContext* InteractiveContext() const { return myCTXPtr; } //! Sets the interactive context aCtx and provides a link //! to the default drawing tool or "Drawer" if there is none. - Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& aCtx); + Standard_EXPORT virtual void SetContext(const occ::handle& aCtx); //! Returns true if the object has an owner attributed to it. //! The owner can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is //! composed of, and takes the form of a transient. - Standard_Boolean HasOwner() const { return !myOwner.IsNull(); } + bool HasOwner() const { return !myOwner.IsNull(); } //! Returns the owner of the Interactive Object. //! The owner can be a shape for a set of sub-shapes or @@ -94,13 +94,13 @@ public: //! edges, wires, and faces. //! - Users, presentable objects connecting to sensitive //! primitives, or a shape which has been decomposed. - const Handle(Standard_Transient)& GetOwner() const { return myOwner; } + const occ::handle& GetOwner() const { return myOwner; } //! Allows you to attribute the owner theApplicativeEntity to //! an Interactive Object. This can be a shape for a set of //! sub-shapes or a sub-shape for sub-shapes which it //! is composed of. The owner takes the form of a transient. - void SetOwner(const Handle(Standard_Transient)& theApplicativeEntity) + void SetOwner(const occ::handle& theApplicativeEntity) { myOwner = theApplicativeEntity; } @@ -117,31 +117,29 @@ public: //! @param[in] theDragTo drag end point //! @param[in] theAction drag action //! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start) - Standard_EXPORT virtual Standard_Boolean ProcessDragging( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const Handle(SelectMgr_EntityOwner)& theOwner, - const Graphic3d_Vec2i& theDragFrom, - const Graphic3d_Vec2i& theDragTo, - const AIS_DragAction theAction); + Standard_EXPORT virtual bool ProcessDragging(const occ::handle& theCtx, + const occ::handle& theView, + const occ::handle& theOwner, + const NCollection_Vec2& theDragFrom, + const NCollection_Vec2& theDragTo, + const AIS_DragAction theAction); public: //! Returns the context pointer to the interactive context. - Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const; + Standard_EXPORT occ::handle GetContext() const; //! Returns TRUE when this object has a presentation in the current DisplayMode() - Standard_EXPORT Standard_Boolean HasPresentation() const; + Standard_EXPORT bool HasPresentation() const; //! Returns the current presentation of this object according to the current DisplayMode() - Standard_EXPORT Handle(Prs3d_Presentation) Presentation() const; + Standard_EXPORT occ::handle Presentation() const; //! Sets the graphic basic aspect to the current presentation. Standard_DEPRECATED("Deprecated method, results might be undefined") - Standard_EXPORT void SetAspect(const Handle(Prs3d_BasicAspect)& anAspect); + Standard_EXPORT void SetAspect(const occ::handle& anAspect); //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; protected: //! The TypeOfPresention3d means that the interactive object @@ -156,9 +154,7 @@ protected: // clang-format off AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext() // clang-format on - Handle(Standard_Transient) myOwner; //!< application-specific owner object + occ::handle myOwner; //!< application-specific owner object }; -DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject) - #endif // _AIS_InteractiveObject_HeaderFile diff --git a/opencascade/AIS_LengthDimension.hxx b/opencascade/AIS_LengthDimension.hxx deleted file mode 100644 index a79cf351a..000000000 --- a/opencascade/AIS_LengthDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_LengthDimension_HeaderFile -#define _AIS_LengthDimension_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_LengthDimension AIS_LengthDimension; - -#endif // _AIS_LengthDimension_HeaderFile diff --git a/opencascade/AIS_LightSource.hxx b/opencascade/AIS_LightSource.hxx index e7e1e7301..b26909783 100644 --- a/opencascade/AIS_LightSource.hxx +++ b/opencascade/AIS_LightSource.hxx @@ -37,13 +37,13 @@ class AIS_LightSource : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_LightSource, AIS_InteractiveObject) public: //! Initializes the light source by copying Graphic3d_CLight settings. - Standard_EXPORT AIS_LightSource(const Handle(Graphic3d_CLight)& theLightSource); + Standard_EXPORT AIS_LightSource(const occ::handle& theLightSource); //! Returns the light. - const Handle(Graphic3d_CLight)& Light() const { return myLightSource; } + const occ::handle& Light() const { return myLightSource; } //! Set the light. - void SetLight(const Handle(Graphic3d_CLight)& theLight) + void SetLight(const occ::handle& theLight) { myLightSource = theLight; SetToUpdate(); @@ -51,10 +51,10 @@ public: public: //! @name Light properties //! Returns TRUE if the light source name should be displayed; TRUE by default. - Standard_Boolean ToDisplayName() const { return myToDisplayName; } + bool ToDisplayName() const { return myToDisplayName; } //! Show/hide light source name. - void SetDisplayName(Standard_Boolean theToDisplay) + void SetDisplayName(bool theToDisplay) { if (myToDisplayName != theToDisplay) { @@ -65,10 +65,10 @@ public: //! @name Light properties //! Returns TRUE to display light source range as sphere (positional light) or cone (spot light); //! TRUE by default. Has no effect for non-zoomable presentation. - Standard_Boolean ToDisplayRange() const { return myToDisplayRange; } + bool ToDisplayRange() const { return myToDisplayRange; } //! Show/hide light source range shaded presentation. - void SetDisplayRange(Standard_Boolean theToDisplay) + void SetDisplayRange(bool theToDisplay) { if (myToDisplayRange != theToDisplay) { @@ -78,10 +78,10 @@ public: //! @name Light properties } //! Returns the size of presentation; 50 by default. - Standard_Real Size() const { return mySize; } + double Size() const { return mySize; } //! Sets the size of presentation. - void SetSize(Standard_Real theSize) + void SetSize(double theSize) { if (mySize != theSize) { @@ -91,10 +91,10 @@ public: //! @name Light properties } //! Returns Sensitive sphere arc size in pixels; 20 by default. - Standard_Integer ArcSize() const { return mySensSphereArcSize; } + int ArcSize() const { return mySensSphereArcSize; } //! Sets the size of sensitive sphere arc. - void SetArcSize(Standard_Integer theSize) + void SetArcSize(int theSize) { if (mySensSphereArcSize != theSize) { @@ -134,10 +134,10 @@ public: //! @name Light properties void SetSwitchOnClick(bool theToHandle) { myToSwitchOnClick = theToHandle; } //! Returns a number of directional light arrows to display; 5 by default. - Standard_Integer NbArrows() const { return myNbArrows; } + int NbArrows() const { return myNbArrows; } //! Returns a number of directional light arrows to display (supported values: 1, 3, 5, 9). - void SetNbArrows(Standard_Integer theNbArrows) + void SetNbArrows(int theNbArrows) { if (myNbArrows != theNbArrows) { @@ -148,7 +148,7 @@ public: //! @name Light properties //! Returns light source icon. //! @param[in] theIsEnabled marker index for enabled/disabled light source states - const Handle(Graphic3d_MarkerImage)& MarkerImage(bool theIsEnabled) const + const occ::handle& MarkerImage(bool theIsEnabled) const { return myMarkerImages[theIsEnabled ? 1 : 0]; } @@ -161,7 +161,7 @@ public: //! @name Light properties } //! Sets custom icon to light source. - void SetMarkerImage(const Handle(Graphic3d_MarkerImage)& theImage, bool theIsEnabled) + void SetMarkerImage(const occ::handle& theImage, bool theIsEnabled) { myMarkerImages[theIsEnabled ? 1 : 0] = theImage; myMarkerTypes[theIsEnabled ? 1 : 0] = !theImage.IsNull() @@ -176,39 +176,33 @@ public: //! @name Light properties } //! Returns tessellation level for quadric surfaces; 30 by default. - Standard_Integer NbSplitsQuadric() const { return myNbSplitsQuadric; } + int NbSplitsQuadric() const { return myNbSplitsQuadric; } //! Sets tessellation level for quadric surfaces. - void SetNbSplitsQuadric(Standard_Integer theNbSplits) { myNbSplitsQuadric = theNbSplits; } + void SetNbSplitsQuadric(int theNbSplits) { myNbSplitsQuadric = theNbSplits; } //! Returns tessellation level for arrows; 20 by default. - Standard_Integer NbSplitsArrow() const { return myNbSplitsArrow; } + int NbSplitsArrow() const { return myNbSplitsArrow; } //! Sets tessellation level for arrows. - void SetNbSplitsArrow(Standard_Integer theNbSplits) { myNbSplitsArrow = theNbSplits; } + void SetNbSplitsArrow(int theNbSplits) { myNbSplitsArrow = theNbSplits; } //! Returns kind of the object. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_LightSource; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_LightSource; } protected: //! Return true if specified display mode is supported: 0 for main presentation and 1 for //! highlight. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0 || theMode == 1; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0 || theMode == 1; } //! Computes selection sensitive zones(triangulation) for light source presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Fills presentation. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; //! Drag object in the viewer. //! @param[in] theCtx interactive context @@ -218,17 +212,15 @@ protected: //! @param[in] theDragTo drag end point //! @param[in] theAction drag action //! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start) - Standard_EXPORT virtual Standard_Boolean ProcessDragging( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const Handle(SelectMgr_EntityOwner)& theOwner, - const Graphic3d_Vec2i& theDragFrom, - const Graphic3d_Vec2i& theDragTo, - const AIS_DragAction theAction) Standard_OVERRIDE; + Standard_EXPORT bool ProcessDragging(const occ::handle& theCtx, + const occ::handle& theView, + const occ::handle& theOwner, + const NCollection_Vec2& theDragFrom, + const NCollection_Vec2& theDragTo, + const AIS_DragAction theAction) override; //! Sets new local transformation, which is propagated to Graphic3d_CLight instance. - Standard_EXPORT virtual void setLocalTransformation(const Handle(TopLoc_Datum3D)& theTrsf) - Standard_OVERRIDE; + Standard_EXPORT void setLocalTransformation(const occ::handle& theTrsf) override; //! Updates local transformation basing on a type of light source. Standard_EXPORT virtual void updateLightLocalTransformation(); @@ -240,46 +232,46 @@ protected: Standard_EXPORT virtual void updateLightAspects(); //! Compute ambient light source presentation as a sphere at view corner. - Standard_EXPORT virtual void computeAmbient(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode); + Standard_EXPORT virtual void computeAmbient(const occ::handle& thePrs, + const int theMode); //! Compute directional light source presentation as a set of arrows at view corner. - Standard_EXPORT virtual void computeDirectional(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode); + Standard_EXPORT virtual void computeDirectional(const occ::handle& thePrs, + const int theMode); //! Compute positional light source presentation as a sphere of either fixed size (no range) or of //! size representing a maximum range. - Standard_EXPORT virtual void computePositional(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode); + Standard_EXPORT virtual void computePositional(const occ::handle& thePrs, + const int theMode); //! Compute spot light source presentation as a cone. - Standard_EXPORT virtual void computeSpot(const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode); + Standard_EXPORT virtual void computeSpot(const occ::handle& thePrs, + const int theMode); protected: - Handle(Graphic3d_CLight) myLightSource; //!< displayed light source + occ::handle myLightSource; //!< displayed light source // clang-format off - Handle(Graphic3d_AspectMarker3d) myDisabledMarkerAspect; //!< disabled light source marker style - Handle(Graphic3d_AspectLine3d) myArrowLineAspectShadow; //!< arrow shadow style - Handle(Graphic3d_MarkerImage) myMarkerImages[2]; //!< icon of disabled (0) and enabled (1) light - Handle(Select3D_SensitiveSphere) mySensSphere; //!< sensitive sphere of directional light source + occ::handle myDisabledMarkerAspect; //!< disabled light source marker style + occ::handle myArrowLineAspectShadow; //!< arrow shadow style + occ::handle myMarkerImages[2]; //!< icon of disabled (0) and enabled (1) light + occ::handle mySensSphere; //!< sensitive sphere of directional light source Aspect_TypeOfMarker myMarkerTypes[2]; //!< icon of disabled (0) and enabled (1) light Aspect_TypeOfMarker myCodirMarkerType; //!< icon of arrow co-directional to camera direction (look from) Aspect_TypeOfMarker myOpposMarkerType; //!< icon of arrow opposite to camera direction (look at) gp_Trsf myLocTrsfStart; //!< object transformation before transformation - Standard_Real mySize; //!< presentation size - Standard_Integer myNbArrows; //!< number of directional light arrows - Standard_Integer myNbSplitsQuadric; //!< tessellation level for quadric surfaces - Standard_Integer myNbSplitsArrow; //!< tessellation level for arrows - Standard_Integer mySensSphereArcSize; //! sensitive sphere arc size in pixels - Standard_Boolean myIsZoomable; //!< flag to allow/disallow transform-persistence when possible - Standard_Boolean myIsDraggable; //!< flag to allow/disallow rotate directional light source by dragging + double mySize; //!< presentation size + int myNbArrows; //!< number of directional light arrows + int myNbSplitsQuadric; //!< tessellation level for quadric surfaces + int myNbSplitsArrow; //!< tessellation level for arrows + int mySensSphereArcSize; //! sensitive sphere arc size in pixels + bool myIsZoomable; //!< flag to allow/disallow transform-persistence when possible + bool myIsDraggable; //!< flag to allow/disallow rotate directional light source by dragging // clang-format on - Standard_Boolean myToDisplayName; //!< flag to show/hide name - Standard_Boolean myToDisplayRange; //!< flag to show/hide range of positional/spot light - Standard_Boolean myToSwitchOnClick; //!< flag to handle mouse click to turn light on/off + bool myToDisplayName; //!< flag to show/hide name + bool myToDisplayRange; //!< flag to show/hide range of positional/spot light + bool myToSwitchOnClick; //!< flag to handle mouse click to turn light on/off }; //! Owner of AIS_LightSource presentation. @@ -288,26 +280,25 @@ class AIS_LightSourceOwner : public SelectMgr_EntityOwner DEFINE_STANDARD_RTTIEXT(AIS_LightSourceOwner, SelectMgr_EntityOwner) public: //! Main constructor. - Standard_EXPORT AIS_LightSourceOwner(const Handle(AIS_LightSource)& theObject, - Standard_Integer thePriority = 5); + Standard_EXPORT AIS_LightSourceOwner(const occ::handle& theObject, + int thePriority = 5); //! Handle mouse button click event. - Standard_EXPORT virtual Standard_Boolean HandleMouseClick(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButton, - Aspect_VKeyFlags theModifiers, - bool theIsDoubleClick) - Standard_OVERRIDE; + Standard_EXPORT bool HandleMouseClick(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButton, + Aspect_VKeyFlags theModifiers, + bool theIsDoubleClick) override; //! Highlights selectable object's presentation with display mode in presentation manager with //! given highlight style. Also a check for auto-highlight is performed - if selectable object //! manages highlighting on its own, execution will be passed to //! SelectMgr_SelectableObject::HilightOwnerWithColor method. - Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void HilightWithColor(const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) override; //! Always update dynamic highlighting. - Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE; + Standard_EXPORT bool IsForcedHilight() const override; }; #endif // _AIS_LightSource_HeaderFile diff --git a/opencascade/AIS_Line.hxx b/opencascade/AIS_Line.hxx index 0bf760c39..6be6097c5 100644 --- a/opencascade/AIS_Line.hxx +++ b/opencascade/AIS_Line.hxx @@ -30,86 +30,96 @@ class AIS_Line : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject) public: //! Initializes the line aLine. - Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine); + Standard_EXPORT AIS_Line(const occ::handle& aLine); //! Initializes a starting point aStartPoint //! and a finishing point aEndPoint for the line. - Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint, - const Handle(Geom_Point)& aEndPoint); + Standard_EXPORT AIS_Line(const occ::handle& aStartPoint, + const occ::handle& aEndPoint); //! Returns the signature 5. - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; } + int Signature() const override { return 5; } //! Returns the type Datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Constructs an infinite line. - const Handle(Geom_Line)& Line() const { return myComponent; } + const occ::handle& Line() const { return myComponent; } + + //! Returns the starting point of the line set by SetPoints. + //! @return handle to the start point + const occ::handle& StartPoint() const { return myStartPoint; } + + //! Returns the end point of the line set by SetPoints. + //! @return handle to the end point + const occ::handle& EndPoint() const { return myEndPoint; } //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints. - void Points(Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const + //! @deprecated Use StartPoint() and EndPoint() instead. + Standard_DEPRECATED("Use StartPoint() and EndPoint() instead") + void Points(occ::handle& thePStart, occ::handle& thePEnd) const { - thePStart = myStartPoint; - thePEnd = myEndPoint; + thePStart = StartPoint(); + thePEnd = EndPoint(); } - //! instantiates an infinite line. - void SetLine(const Handle(Geom_Line)& theLine) + //! Sets the infinite line. + //! @param[in] theLine the geometric line + void SetLine(const occ::handle& theLine) { myComponent = theLine; - myLineIsSegment = Standard_False; + myLineIsSegment = false; } - //! Sets the starting point thePStart and ending point thePEnd of the + //! Sets the starting point and ending point of the //! infinite line to create a finite line segment. - void SetPoints(const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd) + //! @param[in] thePStart the starting point + //! @param[in] thePEnd the ending point + void SetPoints(const occ::handle& thePStart, const occ::handle& thePEnd) { myStartPoint = thePStart; myEndPoint = thePEnd; - myLineIsSegment = Standard_True; + myLineIsSegment = true; } //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer". - Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& aColor) override; //! Provides the new width setting aValue for the line in //! the drawing tool, or "Drawer". - Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE; + Standard_EXPORT void SetWidth(const double aValue) override; //! Removes the color setting and returns the original color. - Standard_EXPORT void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Removes the width setting and returns the original width. - Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; + Standard_EXPORT void UnsetWidth() override; private: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; - Standard_EXPORT void ComputeInfiniteLine(const Handle(Prs3d_Presentation)& aPresentation); + Standard_EXPORT void ComputeInfiniteLine(const occ::handle& aPresentation); - Standard_EXPORT void ComputeSegmentLine(const Handle(Prs3d_Presentation)& aPresentation); + Standard_EXPORT void ComputeSegmentLine(const occ::handle& aPresentation); - Standard_EXPORT void ComputeInfiniteLineSelection(const Handle(SelectMgr_Selection)& aSelection); + Standard_EXPORT void ComputeInfiniteLineSelection( + const occ::handle& aSelection); - Standard_EXPORT void ComputeSegmentLineSelection(const Handle(SelectMgr_Selection)& aSelection); + Standard_EXPORT void ComputeSegmentLineSelection( + const occ::handle& aSelection); //! Replace aspects of already computed groups with the new value. - void replaceWithNewLineAspect(const Handle(Prs3d_LineAspect)& theAspect); + void replaceWithNewLineAspect(const occ::handle& theAspect); private: - Handle(Geom_Line) myComponent; - Handle(Geom_Point) myStartPoint; - Handle(Geom_Point) myEndPoint; - Standard_Boolean myLineIsSegment; + occ::handle myComponent; + occ::handle myStartPoint; + occ::handle myEndPoint; + bool myLineIsSegment; }; -DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject) - #endif // _AIS_Line_HeaderFile diff --git a/opencascade/AIS_ListIteratorOfListOfInteractive.hxx b/opencascade/AIS_ListIteratorOfListOfInteractive.hxx deleted file mode 100644 index c871b9b4a..000000000 --- a/opencascade/AIS_ListIteratorOfListOfInteractive.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef AIS_ListIteratorOfListOfInteractive_HeaderFile -#define AIS_ListIteratorOfListOfInteractive_HeaderFile - -#include - -#endif diff --git a/opencascade/AIS_ListOfInteractive.hxx b/opencascade/AIS_ListOfInteractive.hxx index e110f2fd8..3f8a870c5 100644 --- a/opencascade/AIS_ListOfInteractive.hxx +++ b/opencascade/AIS_ListOfInteractive.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-12-11 -// Created by: Robert COUBLANC -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,14 +11,28 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AIS_ListOfInteractive_HeaderFile -#define AIS_ListOfInteractive_HeaderFile +//! @file AIS_ListOfInteractive.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _AIS_ListOfInteractive_hxx +#define _AIS_ListOfInteractive_hxx + +#include #include #include -typedef NCollection_List AIS_ListOfInteractive; -typedef NCollection_List::Iterator +Standard_HEADER_DEPRECATED( + "AIS_ListOfInteractive.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("AIS_ListOfInteractive is deprecated, use " + "NCollection_List> directly") +typedef NCollection_List> AIS_ListOfInteractive; +Standard_DEPRECATED( + "AIS_ListIteratorOfListOfInteractive is deprecated, use " + "NCollection_List>::Iterator directly") +typedef NCollection_List>::Iterator AIS_ListIteratorOfListOfInteractive; -#endif +#endif // _AIS_ListOfInteractive_hxx diff --git a/opencascade/AIS_Manipulator.hxx b/opencascade/AIS_Manipulator.hxx index 925d67b07..ba3a3cce0 100644 --- a/opencascade/AIS_Manipulator.hxx +++ b/opencascade/AIS_Manipulator.hxx @@ -28,10 +28,6 @@ #include #include -NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject)) - -DEFINE_STANDARD_HANDLE(AIS_Manipulator, AIS_InteractiveObject) - //! Interactive object class to manipulate local transformation of another interactive //! object or a group of objects via mouse. //! It manages three types of manipulations in 3D space: @@ -47,9 +43,9 @@ DEFINE_STANDARD_HANDLE(AIS_Manipulator, AIS_InteractiveObject) //! for an interactive object: //! Step 1. Create manipulator object and adjust it appearance: //! @code -//! Handle(AIS_Manipulator) aManipulator = new AIS_Manipulator(); -//! aManipulator->SetPart (0, AIS_Manipulator::Scaling, Standard_False); -//! aManipulator->SetPart (1, AIS_Manipulator::Rotation, Standard_False); +//! occ::handle aManipulator = new AIS_Manipulator(); +//! aManipulator->SetPart (0, AIS_Manipulator::Scaling, false); +//! aManipulator->SetPart (1, AIS_Manipulator::Rotation, false); //! // Attach manipulator to already displayed object and manage manipulation modes //! aManipulator->AttachToObject (anAISObject); //! aManipulator->EnableMode (AIS_Manipulator::Translation); @@ -62,7 +58,7 @@ DEFINE_STANDARD_HANDLE(AIS_Manipulator, AIS_InteractiveObject) //! If this mode is activated, no selection will be performed for manipulator. //! It can be activated with highlighting. To enable this: //! @code -//! aManipulator->SetModeActivationOnDetection (Standard_True); +//! aManipulator->SetModeActivationOnDetection (true); //! @endcode //! Step 2. To perform transformation of object use next code in your event processing chain: //! @code @@ -80,7 +76,7 @@ DEFINE_STANDARD_HANDLE(AIS_Manipulator, AIS_InteractiveObject) //! } //! ... //! // or catch mouse button up event (apply) or escape event (cancel) -//! aManipulator->StopTransform(/*Standard_Boolean toApply*/); +//! aManipulator->StopTransform(/*bool toApply*/); //! @endcode //! Step 3. To deactivate current manipulation mode use: //! @code aManipulator->DeactivateCurrentMode(); @@ -105,17 +101,16 @@ public: //! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation //! (selection) mode. //! @warning Raises program error if axis index is < 0 or > 2. - Standard_EXPORT void SetPart(const Standard_Integer theAxisIndex, + Standard_EXPORT void SetPart(const int theAxisIndex, const AIS_ManipulatorMode theMode, - const Standard_Boolean theIsEnabled); + const bool theIsEnabled); //! Disable or enable visual parts for translation, rotation or scaling for ALL axes. //! By default all parts are enabled (will be displayed). //! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation //! (selection) mode. //! @warning Raises program error if axis index is < 0 or > 2. - Standard_EXPORT void SetPart(const AIS_ManipulatorMode theMode, - const Standard_Boolean theIsEnabled); + Standard_EXPORT void SetPart(const AIS_ManipulatorMode theMode, const bool theIsEnabled); //! Behavior settings to be applied when performing transformation: //! - FollowTranslation - whether the manipulator will be moved together with an object. @@ -124,47 +119,48 @@ public: { OptionsForAttach() - : AdjustPosition(Standard_True), - AdjustSize(Standard_False), - EnableModes(Standard_True) + : AdjustPosition(true), + AdjustSize(false), + EnableModes(true) { } - OptionsForAttach& SetAdjustPosition(const Standard_Boolean theApply) + OptionsForAttach& SetAdjustPosition(const bool theApply) { AdjustPosition = theApply; return *this; } - OptionsForAttach& SetAdjustSize(const Standard_Boolean theApply) + OptionsForAttach& SetAdjustSize(const bool theApply) { AdjustSize = theApply; return *this; } - OptionsForAttach& SetEnableModes(const Standard_Boolean theApply) + OptionsForAttach& SetEnableModes(const bool theApply) { EnableModes = theApply; return *this; } - Standard_Boolean AdjustPosition; - Standard_Boolean AdjustSize; - Standard_Boolean EnableModes; + bool AdjustPosition; + bool AdjustSize; + bool EnableModes; }; //! Attaches himself to the input interactive object and become displayed in the same context. //! It is placed in the center of object bounding box, and its size is adjusted to the object //! bounding box. - Standard_EXPORT void Attach(const Handle(AIS_InteractiveObject)& theObject, - const OptionsForAttach& theOptions = OptionsForAttach()); + Standard_EXPORT void Attach(const occ::handle& theObject, + const OptionsForAttach& theOptions = OptionsForAttach()); //! Attaches himself to the input interactive object group and become displayed in the same //! context. It become attached to the first object, baut manage manipulation of the whole group. //! It is placed in the center of object bounding box, and its size is adjusted to the object //! bounding box. - Standard_EXPORT void Attach(const Handle(AIS_ManipulatorObjectSequence)& theObject, - const OptionsForAttach& theOptions = OptionsForAttach()); + Standard_EXPORT void Attach( + const occ::handle>>& theObject, + const OptionsForAttach& theOptions = OptionsForAttach()); //! Enable manipualtion mode. //! @warning It activates selection mode in the current context. @@ -174,13 +170,13 @@ public: //! Enables mode activation on detection (highlighting). //! By default, mode is activated on selection of manipulator part. //! @warning If this mode is enabled, selection of parts does nothing. - void SetModeActivationOnDetection(const Standard_Boolean theToEnable) + void SetModeActivationOnDetection(const bool theToEnable) { myIsActivationOnDetection = theToEnable; } //! @return true if manual mode activation is enabled. - Standard_Boolean IsModeActivationOnDetection() const { return myIsActivationOnDetection; } + bool IsModeActivationOnDetection() const { return myIsActivationOnDetection; } public: //! Drag object in the viewer. @@ -191,22 +187,21 @@ public: //! @param[in] theDragTo drag end point //! @param[in] theAction drag action //! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start) - Standard_EXPORT virtual Standard_Boolean ProcessDragging( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const Handle(SelectMgr_EntityOwner)& theOwner, - const Graphic3d_Vec2i& theDragFrom, - const Graphic3d_Vec2i& theDragTo, - const AIS_DragAction theAction) Standard_OVERRIDE; + Standard_EXPORT bool ProcessDragging(const occ::handle& theCtx, + const occ::handle& theView, + const occ::handle& theOwner, + const NCollection_Vec2& theDragFrom, + const NCollection_Vec2& theDragTo, + const AIS_DragAction theAction) override; //! Init start (reference) transformation. //! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform - //! and is used only for custom transform set. If Transform(const Standard_Integer, const - //! Standard_Integer) is used, initial data is set automatically, and it is reset on + //! and is used only for custom transform set. If Transform(const int, const + //! int) is used, initial data is set automatically, and it is reset on //! DeactivateCurrentMode call if it is not reset yet. - Standard_EXPORT void StartTransform(const Standard_Integer theX, - const Standard_Integer theY, - const Handle(V3d_View)& theView); + Standard_EXPORT void StartTransform(const int theX, + const int theY, + const occ::handle& theView); //! Apply to the owning objects the input transformation. //! @remark The transformation is set using SetLocalTransformation for owning objects. @@ -218,8 +213,8 @@ public: Standard_EXPORT void Transform(const gp_Trsf& aTrsf); //! Apply camera transformation to flat skin manipulator - Standard_EXPORT void RecomputeTransformation(const Handle(Graphic3d_Camera)& theCamera) - Standard_OVERRIDE; + Standard_EXPORT void RecomputeTransformation( + const occ::handle& theCamera) override; //! Recomputes sensitive primitives for the given selection mode. //! @param theMode selection mode to recompute sensitive primitives @@ -229,23 +224,23 @@ public: //! @param[in] theToApply option to apply or to cancel the started transformation. //! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform //! and is used only for custom transform set. - Standard_EXPORT void StopTransform(const Standard_Boolean theToApply = Standard_True); + Standard_EXPORT void StopTransform(const bool theToApply = true); //! Apply transformation made from mouse moving from start position //! (save on the first Transform() call and reset on DeactivateCurrentMode() call.) //! to the in/out mouse position (theX, theY) - Standard_EXPORT gp_Trsf Transform(const Standard_Integer theX, - const Standard_Integer theY, - const Handle(V3d_View)& theView); + Standard_EXPORT gp_Trsf Transform(const int theX, + const int theY, + const occ::handle& theView); //! Computes transformation of parent object according to the active mode and input motion vector. //! You can use this method to get object transformation according to current mode or use own //! algorithm to implement any other transformation for modes. //! @return transformation of parent object. - Standard_EXPORT Standard_Boolean ObjectTransformation(const Standard_Integer theX, - const Standard_Integer theY, - const Handle(V3d_View)& theView, - gp_Trsf& theTrsf); + Standard_EXPORT bool ObjectTransformation(const int theX, + const int theY, + const occ::handle& theView, + gp_Trsf& theTrsf); //! Make inactive the current selected manipulator part and reset current axis index and current //! mode. After its call HasActiveMode() returns false. @@ -256,30 +251,31 @@ public: Standard_EXPORT void Detach(); //! @return all owning objects. - Standard_EXPORT Handle(AIS_ManipulatorObjectSequence) Objects() const; + Standard_EXPORT occ::handle>> Objects() + const; //! @return the first (leading) object of the owning objects. - Standard_EXPORT Handle(AIS_InteractiveObject) Object() const; + Standard_EXPORT occ::handle Object() const; //! @return one of the owning objects. //! @warning raises program error if theIndex is more than owning objects count or less than 1. - Standard_EXPORT Handle(AIS_InteractiveObject) Object(const Standard_Integer theIndex) const; + Standard_EXPORT occ::handle Object(const int theIndex) const; //! @return true if manipulator is attached to some interactive object (has owning object). - Standard_Boolean IsAttached() const { return HasOwner(); } + bool IsAttached() const { return HasOwner(); } //! @return true if some part of manipulator is selected (transformation mode is active, and //! owning object can be transformed). - Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; } + bool HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; } - Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; } + bool HasActiveTransformation() { return myHasStartedTransformation; } gp_Trsf StartTransformation() const { return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf(); } - gp_Trsf StartTransformation(Standard_Integer theIndex) const + gp_Trsf StartTransformation(int theIndex) const { Standard_ProgramError_Raise_if( theIndex < 1 || theIndex > Objects()->Upper(), @@ -294,10 +290,10 @@ public: //! @name Configuration of graphical transformations //! properties and local transformation to achieve necessary visual effect. //! @warning revise use of AdjustSize argument of of \sa AttachToObjects method //! when enabling zoom persistence. - Standard_EXPORT void SetZoomPersistence(const Standard_Boolean theToEnable); + Standard_EXPORT void SetZoomPersistence(const bool theToEnable); //! Returns state of zoom persistence mode, whether it turned on or off. - Standard_Boolean ZoomPersistence() const { return myIsZoomPersistentMode; } + bool ZoomPersistence() const { return myIsZoomPersistentMode; } //! Redefines transform persistence management to setup transformation for sub-presentation of //! axes. @@ -308,8 +304,8 @@ public: //! @name Configuration of graphical transformations //! ZoomPersistence mode, silently does nothing in release mode. //! @warning revise use of AdjustSize argument of of \sa AttachToObjects method //! when enabling zoom persistence. - Standard_EXPORT virtual void SetTransformPersistence( - const Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE; + Standard_EXPORT void SetTransformPersistence( + const occ::handle& theTrsfPers) override; public: //! @name Setters for parameters enum ManipulatorSkin @@ -326,7 +322,7 @@ public: //! @name Setters for parameters AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; } - Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; } + int ActiveAxisIndex() const { return myCurrentIndex; } //! @return poition of manipulator interactive object. const gp_Ax2& Position() const { return myPosition; } @@ -334,13 +330,13 @@ public: //! @name Setters for parameters //! Sets position of the manipulator object. Standard_EXPORT void SetPosition(const gp_Ax2& thePosition); - Standard_ShortReal Size() const { return myAxes[0].Size(); } + float Size() const { return myAxes[0].Size(); } //! Sets size (length of side of the manipulator cubic bounding box. - Standard_EXPORT void SetSize(const Standard_ShortReal theSideLength); + Standard_EXPORT void SetSize(const float theSideLength); //! Sets gaps between translator, scaler and rotator sub-presentations. - Standard_EXPORT void SetGap(const Standard_ShortReal theValue); + Standard_EXPORT void SetGap(const float theValue); public: //! Behavior settings to be applied when performing transformation: @@ -350,33 +346,33 @@ public: { BehaviorOnTransform() - : FollowTranslation(Standard_True), - FollowRotation(Standard_True), - FollowDragging(Standard_True) + : FollowTranslation(true), + FollowRotation(true), + FollowDragging(true) { } - BehaviorOnTransform& SetFollowTranslation(const Standard_Boolean theApply) + BehaviorOnTransform& SetFollowTranslation(const bool theApply) { FollowTranslation = theApply; return *this; } - BehaviorOnTransform& SetFollowRotation(const Standard_Boolean theApply) + BehaviorOnTransform& SetFollowRotation(const bool theApply) { FollowRotation = theApply; return *this; } - BehaviorOnTransform& SetFollowDragging(const Standard_Boolean theApply) + BehaviorOnTransform& SetFollowDragging(const bool theApply) { FollowDragging = theApply; return *this; } - Standard_Boolean FollowTranslation; - Standard_Boolean FollowRotation; - Standard_Boolean FollowDragging; + bool FollowTranslation; + bool FollowRotation; + bool FollowDragging; }; //! Sets behavior settings for transformation action carried on the manipulator, @@ -396,45 +392,45 @@ public: //! @name Presentation computation //! Fills presentation. //! @note Manipulator presentation does not use display mode and for all modes has the same //! presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode = 0) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode = 0) override; //! Computes selection sensitive zones (triangulation) for manipulator. //! @param[in] theNode Selection mode that is treated as transformation mode. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden //! methods. - virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; } + bool IsAutoHilight() const override { return false; } //! Method which clear all selected owners belonging - //! to this selectable object ( for fast presentation draw ). - Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE; + //! to this selectable object (for fast presentation draw). + Standard_EXPORT void ClearSelected() override; - //! Method which draws selected owners ( for fast presentation draw ). - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM, - const SelectMgr_SequenceOfOwner& theSeq) - Standard_OVERRIDE; + //! Method which draws selected owners (for fast presentation draw). + Standard_EXPORT void HilightSelected( + const occ::handle& thePM, + const NCollection_Sequence>& theSeq) override; //! Method which hilight an owner belonging to - //! this selectable object ( for fast presentation draw ). - Standard_EXPORT virtual void HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE; + //! this selectable object (for fast presentation draw). + Standard_EXPORT void HilightOwnerWithColor( + const occ::handle& thePM, + const occ::handle& theStyle, + const occ::handle& theOwner) override; protected: Standard_EXPORT void init(); Standard_EXPORT void updateTransformation(); - Standard_EXPORT Handle(Prs3d_Presentation) getHighlightPresentation( - const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT occ::handle getHighlightPresentation( + const occ::handle& theOwner) const; - Standard_EXPORT Handle(Graphic3d_Group) getGroup(const Standard_Integer theIndex, - const AIS_ManipulatorMode theMode) const; + Standard_EXPORT occ::handle getGroup(const int theIndex, + const AIS_ManipulatorMode theMode) const; Standard_EXPORT void attachToPoint(const gp_Pnt& thePoint); @@ -442,7 +438,8 @@ protected: Standard_EXPORT void adjustSize(const Bnd_Box& theBox); - Standard_EXPORT void setTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers); + Standard_EXPORT void setTransformPersistence( + const occ::handle& theTrsfPers); //! Redefines local transformation management method to inform user of improper use. //! @warning this interactive object does not support setting custom local transformation, @@ -450,8 +447,7 @@ protected: //! without need for recomputing presentation. //! @warning Invokes debug assertion in debug to catch incompatible usage of the //! method, silently does nothing in release mode. - Standard_EXPORT virtual void setLocalTransformation(const Handle(TopLoc_Datum3D)& theTrsf) - Standard_OVERRIDE; + Standard_EXPORT void setLocalTransformation(const occ::handle& theTrsf) override; using AIS_InteractiveObject::SetLocalTransformation; // hide visibility protected: //! @name Auxiliary classes to fill presentation with proper primitives @@ -464,13 +460,13 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv myArray.Nullify(); } - const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; } + const occ::handle& Triangulation() const { return myTriangulation; } - const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; } + const occ::handle& Array() const { return myArray; } protected: - Handle(Poly_Triangulation) myTriangulation; - Handle(Graphic3d_ArrayOfTriangles) myArray; + occ::handle myTriangulation; + occ::handle myArray; }; class Disk : public Quadric @@ -483,19 +479,19 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv { } - ~Disk() {} + ~Disk() override = default; - void Init(const Standard_ShortReal theInnerRadius, - const Standard_ShortReal theOuterRadius, - const gp_Ax1& thePosition, - const Standard_Real theAngle, - const Standard_Integer theSlicesNb = 20, - const Standard_Integer theStacksNb = 20); + void Init(const float theInnerRadius, + const float theOuterRadius, + const gp_Ax1& thePosition, + const double theAngle, + const int theSlicesNb = 20, + const int theStacksNb = 20); protected: - gp_Ax1 myPosition; - Standard_ShortReal myInnerRad; - Standard_ShortReal myOuterRad; + gp_Ax1 myPosition; + float myInnerRad; + float myOuterRad; }; class Sphere : public Quadric @@ -507,42 +503,40 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv { } - void Init(const Standard_ShortReal theRadius, - const gp_Pnt& thePosition, - const ManipulatorSkin theSkinMode, - const Standard_Integer theSlicesNb = 20, - const Standard_Integer theStacksNb = 20); + void Init(const float theRadius, + const gp_Pnt& thePosition, + const ManipulatorSkin theSkinMode, + const int theSlicesNb = 20, + const int theStacksNb = 20); protected: - gp_Pnt myPosition; - Standard_ShortReal myRadius; + gp_Pnt myPosition; + float myRadius; }; class Cube { public: - Cube() {} + Cube() = default; - ~Cube() {} + ~Cube() = default; - void Init(const gp_Ax1& thePosition, - const Standard_ShortReal myBoxSize, - const ManipulatorSkin theSkinMode); + void Init(const gp_Ax1& thePosition, const float myBoxSize, const ManipulatorSkin theSkinMode); - const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; } + const occ::handle& Triangulation() const { return myTriangulation; } - const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; } + const occ::handle& Array() const { return myArray; } private: - void addTriangle(const Standard_Integer theIndex, - const gp_Pnt& theP1, - const gp_Pnt& theP2, - const gp_Pnt& theP3, - const gp_Dir& theNormal); + void addTriangle(const int theIndex, + const gp_Pnt& theP1, + const gp_Pnt& theP2, + const gp_Pnt& theP3, + const gp_Dir& theNormal); protected: - Handle(Poly_Triangulation) myTriangulation; - Handle(Graphic3d_ArrayOfTriangles) myArray; + occ::handle myTriangulation; + occ::handle myArray; }; class Sector : public Quadric @@ -554,18 +548,18 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv { } - ~Sector() {} + ~Sector() override = default; - void Init(const Standard_ShortReal theRadius, - const gp_Ax1& thePosition, - const gp_Dir& theXDirection, - const ManipulatorSkin theSkinMode, - const Standard_Integer theSlicesNb = 5, - const Standard_Integer theStacksNb = 5); + void Init(const float theRadius, + const gp_Ax1& thePosition, + const gp_Dir& theXDirection, + const ManipulatorSkin theSkinMode, + const int theSlicesNb = 5, + const int theStacksNb = 5); protected: - gp_Ax1 myPosition; - Standard_ShortReal myRadius; + gp_Ax1 myPosition; + float myRadius; }; //! The class describes on axis sub-object. @@ -576,14 +570,14 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv class Axis { public: - Axis(const gp_Ax1& theAxis = gp_Ax1(), - const Quantity_Color& theColor = Quantity_Color(), - const Standard_ShortReal theLength = 10.0f); + Axis(const gp_Ax1& theAxis = gp_Ax1(), + const Quantity_Color& theColor = Quantity_Color(), + const float theLength = 10.0f); - void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Handle(Prs3d_ShadingAspect)& theAspect, - const ManipulatorSkin theSkinMode); + void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const occ::handle& theAspect, + const ManipulatorSkin theSkinMode); const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; } @@ -591,7 +585,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv const gp_Ax1& Position() const { return myPosition; } - void SetTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers) + void SetTransformPersistence(const occ::handle& theTrsfPers) { if (!myHighlightTranslator.IsNull()) { @@ -614,7 +608,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv } } - void Transform(const Handle(TopLoc_Datum3D)& theTransformation) + void Transform(const occ::handle& theTransformation) { if (!myHighlightTranslator.IsNull()) { @@ -637,60 +631,66 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv } } - Standard_Boolean HasTranslation() const { return myHasTranslation; } + bool HasTranslation() const { return myHasTranslation; } - Standard_Boolean HasRotation() const { return myHasRotation; } + bool HasRotation() const { return myHasRotation; } - Standard_Boolean HasScaling() const { return myHasScaling; } + bool HasScaling() const { return myHasScaling; } - Standard_Boolean HasDragging() const { return myHasDragging; } + bool HasDragging() const { return myHasDragging; } - void SetTranslation(const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; } + void SetTranslation(const bool theIsEnabled) { myHasTranslation = theIsEnabled; } - void SetRotation(const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; } + void SetRotation(const bool theIsEnabled) { myHasRotation = theIsEnabled; } - void SetScaling(const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; } + void SetScaling(const bool theIsEnabled) { myHasScaling = theIsEnabled; } - void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; } + void SetDragging(const bool theIsEnabled) { myHasDragging = theIsEnabled; } Quantity_Color Color() const { return myColor; } - Standard_ShortReal AxisLength() const { return myLength; } + float AxisLength() const { return myLength; } - Standard_ShortReal BoxSize() const { return myBoxSize; } + float BoxSize() const { return myBoxSize; } - Standard_ShortReal AxisRadius() const { return myAxisRadius; } + float AxisRadius() const { return myAxisRadius; } - Standard_ShortReal Indent() const { return myIndent; } + float Indent() const { return myIndent; } - void SetAxisRadius(const Standard_ShortReal theValue) { myAxisRadius = theValue; } + void SetAxisRadius(const float theValue) { myAxisRadius = theValue; } - const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const + const occ::handle& TranslatorHighlightPrs() const { return myHighlightTranslator; } - const Handle(Prs3d_Presentation)& RotatorHighlightPrs() const { return myHighlightRotator; } + const occ::handle& RotatorHighlightPrs() const + { + return myHighlightRotator; + } - const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; } + const occ::handle& ScalerHighlightPrs() const { return myHighlightScaler; } - const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; } + const occ::handle& DraggerHighlightPrs() const + { + return myHighlightDragger; + } - const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; } + const occ::handle& TranslatorGroup() const { return myTranslatorGroup; } - const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; } + const occ::handle& RotatorGroup() const { return myRotatorGroup; } - const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; } + const occ::handle& ScalerGroup() const { return myScalerGroup; } - const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; } + const occ::handle& DraggerGroup() const { return myDraggerGroup; } - const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; } + const occ::handle& TriangleArray() const { return myTriangleArray; } - void SetIndent(const Standard_ShortReal theValue) { myIndent = theValue; } + void SetIndent(const float theValue) { myIndent = theValue; } - Standard_ShortReal Size() const { return myInnerRadius + myDiskThickness + myIndent * 2; } + float Size() const { return myInnerRadius + myDiskThickness + myIndent * 2; } - Standard_ShortReal InnerRadius() const { return myInnerRadius + myIndent * 2.0f; } + float InnerRadius() const { return myInnerRadius + myIndent * 2.0f; } gp_Pnt ScalerCenter(const gp_Pnt& theLocation) const { @@ -698,7 +698,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv + myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f); } - void SetSize(const Standard_ShortReal theValue) + void SetSize(const float theValue) { if (myIndent > theValue * 0.1f) { @@ -709,16 +709,16 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv } else // use pre-set value of predent { - Standard_ShortReal aLength = theValue - 2 * myIndent; - myLength = aLength * 0.8f; - myBoxSize = aLength * 0.15f; - myDiskThickness = aLength * 0.05f; + float aLength = theValue - 2 * myIndent; + myLength = aLength * 0.8f; + myBoxSize = aLength * 0.15f; + myDiskThickness = aLength * 0.05f; } myInnerRadius = myIndent * 2 + myBoxSize + myLength; myAxisRadius = myBoxSize / 4.0f; } - Standard_Integer FacettesNumber() const { return myFacettesNumber; } + int FacettesNumber() const { return myFacettesNumber; } public: const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; } @@ -738,22 +738,22 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv gp_Ax1 myPosition; //!< Position of the axis including local transformation. Quantity_Color myColor; - Standard_Boolean myHasTranslation; - Standard_ShortReal myLength; //!< Length of translation axis. - Standard_ShortReal myAxisRadius; + bool myHasTranslation; + float myLength; //!< Length of translation axis. + float myAxisRadius; - Standard_Boolean myHasScaling; - Standard_ShortReal myBoxSize; //!< Size of scaling cube. + bool myHasScaling; + float myBoxSize; //!< Size of scaling cube. - Standard_Boolean myHasRotation; - Standard_ShortReal myInnerRadius; //!< Radius of rotation circle. - Standard_ShortReal myDiskThickness; - Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator. + bool myHasRotation; + float myInnerRadius; //!< Radius of rotation circle. + float myDiskThickness; + float myIndent; //!< Gap between visual part of the manipulator. - Standard_Boolean myHasDragging; + bool myHasDragging; protected: - Standard_Integer myFacettesNumber; + int myFacettesNumber; gp_Pnt myArrowTipPos; Sector mySector; @@ -762,53 +762,53 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv Cube myCube; gp_Pnt myCubePos; - Handle(Graphic3d_Group) myTranslatorGroup; - Handle(Graphic3d_Group) myScalerGroup; - Handle(Graphic3d_Group) myRotatorGroup; - Handle(Graphic3d_Group) myDraggerGroup; + occ::handle myTranslatorGroup; + occ::handle myScalerGroup; + occ::handle myRotatorGroup; + occ::handle myDraggerGroup; - Handle(Prs3d_Presentation) myHighlightTranslator; - Handle(Prs3d_Presentation) myHighlightScaler; - Handle(Prs3d_Presentation) myHighlightRotator; - Handle(Prs3d_Presentation) myHighlightDragger; + occ::handle myHighlightTranslator; + occ::handle myHighlightScaler; + occ::handle myHighlightRotator; + occ::handle myHighlightDragger; - Handle(Graphic3d_ArrayOfTriangles) myTriangleArray; + occ::handle myTriangleArray; }; protected: - Axis myAxes[3]; //!< Tree axes of the manipulator. - Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator. - // clang-format off + Axis myAxes[3]; //!< Tree axes of the manipulator. + Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator. + // clang-format off gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes. Disk myCircle; //!< Outer circle - Handle(Graphic3d_Group) myCircleGroup; + occ::handle myCircleGroup; Disk mySector; //!< Sector indicating the rotation angle - Handle(Graphic3d_Group) mySectorGroup; + occ::handle mySectorGroup; - Standard_Integer myCurrentIndex; //!< Index of active axis. + int myCurrentIndex; //!< Index of active axis. AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode. ManipulatorSkin mySkinMode; //!< Name of active skin mode. - Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection). - Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation. + bool myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection). + bool myIsZoomPersistentMode; //!< Zoom persistence mode activation. BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object. protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface. NCollection_Sequence myStartTrsfs; //!< Owning object transformation for start. It is used internally. - Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()). - // clang-format on - gp_Ax2 myStartPosition; //! Start position of manipulator. - gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick. - Standard_Real myPrevState; //! Previous value of angle during rotation. + bool myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()). + // clang-format on + gp_Ax2 myStartPosition; //! Start position of manipulator. + gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick. + double myPrevState; //! Previous value of angle during rotation. //! Aspect used to color current detected part and current selected part. - Handle(Prs3d_ShadingAspect) myHighlightAspect; + occ::handle myHighlightAspect; //! Aspect used to color sector part when it's selected. - Handle(Prs3d_ShadingAspect) myDraggerHighlight; + occ::handle myDraggerHighlight; public: DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject) diff --git a/opencascade/AIS_ManipulatorOwner.hxx b/opencascade/AIS_ManipulatorOwner.hxx index 0bde34d1b..5b971468e 100644 --- a/opencascade/AIS_ManipulatorOwner.hxx +++ b/opencascade/AIS_ManipulatorOwner.hxx @@ -21,37 +21,34 @@ #include #include -DEFINE_STANDARD_HANDLE(AIS_ManipulatorOwner, SelectMgr_EntityOwner) - //! Entity owner for selection management of AIS_Manipulator object. class AIS_ManipulatorOwner : public SelectMgr_EntityOwner { public: DEFINE_STANDARD_RTTIEXT(AIS_ManipulatorOwner, SelectMgr_EntityOwner) - Standard_EXPORT AIS_ManipulatorOwner(const Handle(SelectMgr_SelectableObject)& theSelObject, - const Standard_Integer theIndex, - const AIS_ManipulatorMode theMode, - const Standard_Integer thePriority = 0); + Standard_EXPORT AIS_ManipulatorOwner(const occ::handle& theSelObject, + const int theIndex, + const AIS_ManipulatorMode theMode, + const int thePriority = 0); - Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void HilightWithColor(const occ::handle& thePM, + const occ::handle& theStyle, + const int theMode) override; - Standard_EXPORT Standard_Boolean - IsHilighted(const Handle(PrsMgr_PresentationManager)& thePM, - const Standard_Integer theMode) const Standard_OVERRIDE; + Standard_EXPORT bool IsHilighted(const occ::handle& thePM, + const int theMode) const override; - Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePM, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Unhilight(const occ::handle& thePM, + const int theMode) override; AIS_ManipulatorMode Mode() const { return myMode; } //! @return index of manipulator axis. - Standard_Integer Index() const { return myIndex; } + int Index() const { return myIndex; } protected: - Standard_Integer myIndex; //!< index of manipulator axis. + int myIndex; //!< index of manipulator axis. AIS_ManipulatorMode myMode; //!< manipulation (highlight) mode. }; diff --git a/opencascade/AIS_MaxRadiusDimension.hxx b/opencascade/AIS_MaxRadiusDimension.hxx deleted file mode 100644 index e8614a4ce..000000000 --- a/opencascade/AIS_MaxRadiusDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_MaxRadiusDimension_HeaderFile -#define _AIS_MaxRadiusDimension_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_MaxRadiusDimension AIS_MaxRadiusDimension; - -#endif // _AIS_MaxRadiusDimension_HeaderFile diff --git a/opencascade/AIS_MediaPlayer.hxx b/opencascade/AIS_MediaPlayer.hxx index e9b485bfc..0dc5fd38a 100644 --- a/opencascade/AIS_MediaPlayer.hxx +++ b/opencascade/AIS_MediaPlayer.hxx @@ -29,7 +29,7 @@ public: Standard_EXPORT AIS_MediaPlayer(); //! Destructor. - Standard_EXPORT virtual ~AIS_MediaPlayer(); + Standard_EXPORT ~AIS_MediaPlayer() override; //! Setup callback to be called on queue progress (e.g. when new frame should be displayed). void SetCallback(Graphic3d_MediaTextureSet::CallbackOnUpdate_t theCallbackFunction, @@ -39,15 +39,17 @@ public: } //! Open specified file. - Standard_EXPORT void OpenInput(const TCollection_AsciiString& thePath, - Standard_Boolean theToWait); + Standard_EXPORT void OpenInput(const TCollection_AsciiString& thePath, bool theToWait); //! Display new frame. - Standard_EXPORT bool PresentFrame(const Graphic3d_Vec2i& theLeftCorner, - const Graphic3d_Vec2i& theMaxSize); + Standard_EXPORT bool PresentFrame(const NCollection_Vec2& theLeftCorner, + const NCollection_Vec2& theMaxSize); //! Return player context. - const Handle(Media_PlayerContext)& PlayerContext() const { return myFramePair->PlayerContext(); } + const occ::handle& PlayerContext() const + { + return myFramePair->PlayerContext(); + } //! Switch playback state. Standard_EXPORT void PlayPause(); @@ -65,31 +67,28 @@ public: //! @name AIS_InteractiveObject interface protected: //! Accept only display mode 0. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Compute presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; protected: //! Update frame size. - Standard_EXPORT bool updateSize(const Graphic3d_Vec2i& theLeftCorner, - const Graphic3d_Vec2i& theMaxSize); + Standard_EXPORT bool updateSize(const NCollection_Vec2& theLeftCorner, + const NCollection_Vec2& theMaxSize); protected: - Handle(Graphic3d_MediaTextureSet) myFramePair; - Handle(Graphic3d_AspectFillArea3d) myFrameAspect; - Graphic3d_Vec2i myFrameBottomLeft; - Graphic3d_Vec2i myFrameSize; - bool myToClosePlayer; + occ::handle myFramePair; + occ::handle myFrameAspect; + NCollection_Vec2 myFrameBottomLeft; + NCollection_Vec2 myFrameSize; + bool myToClosePlayer; }; #endif // _AIS_MediaPlayer_HeaderFile diff --git a/opencascade/AIS_MidPointRelation.hxx b/opencascade/AIS_MidPointRelation.hxx deleted file mode 100644 index a58e04900..000000000 --- a/opencascade/AIS_MidPointRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_MidPointRelation_HeaderFile -#define _AIS_MidPointRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_MidPointRelation AIS_MidPointRelation; - -#endif // _AIS_MidPointRelation_HeaderFile diff --git a/opencascade/AIS_MinRadiusDimension.hxx b/opencascade/AIS_MinRadiusDimension.hxx deleted file mode 100644 index dce761bb1..000000000 --- a/opencascade/AIS_MinRadiusDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_MinRadiusDimension_HeaderFile -#define _AIS_MinRadiusDimension_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_MinRadiusDimension AIS_MinRadiusDimension; - -#endif // _AIS_MinRadiusDimension_HeaderFile diff --git a/opencascade/AIS_MouseGesture.hxx b/opencascade/AIS_MouseGesture.hxx index dcf9ee9bb..0bd5c39a4 100644 --- a/opencascade/AIS_MouseGesture.hxx +++ b/opencascade/AIS_MouseGesture.hxx @@ -45,7 +45,5 @@ enum AIS_MouseGesture }; //! Map defining mouse gestures. -typedef NCollection_DataMap AIS_MouseGestureMap; -typedef NCollection_DataMap AIS_MouseSelectionSchemeMap; #endif // _AIS_MouseGesture_HeaderFile diff --git a/opencascade/AIS_MultipleConnectedInteractive.hxx b/opencascade/AIS_MultipleConnectedInteractive.hxx index 2902d5955..5a1b721bf 100644 --- a/opencascade/AIS_MultipleConnectedInteractive.hxx +++ b/opencascade/AIS_MultipleConnectedInteractive.hxx @@ -37,55 +37,50 @@ public: //! reference. Locates instance in theLocation and applies specified transformation persistence //! mode. //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive) - Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, - const Handle(TopLoc_Datum3D)& theLocation, - const Handle(Graphic3d_TransformPers)& theTrsfPers) + occ::handle Connect( + const occ::handle& theAnotherObj, + const occ::handle& theLocation, + const occ::handle& theTrsfPers) { return connect(theAnotherObj, theLocation, theTrsfPers); } - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Object; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Object; } - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; } + int Signature() const override { return 1; } //! Returns true if the object is connected to others. - Standard_EXPORT Standard_Boolean HasConnection() const; + Standard_EXPORT bool HasConnection() const; //! Removes the connection with theInteractive. - Standard_EXPORT void Disconnect(const Handle(AIS_InteractiveObject)& theInteractive); + Standard_EXPORT void Disconnect(const occ::handle& theInteractive); //! Clears all the connections to objects. Standard_EXPORT void DisconnectAll(); //! Informs the graphic context that the interactive Object //! may be decomposed into sub-shapes for dynamic selection. - Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE; + Standard_EXPORT bool AcceptShapeDecomposition() const override; //! Returns common entity owner if the object is an assembly - virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE + const occ::handle& GetAssemblyOwner() const override { return myAssemblyOwner; } //! Returns the owner of mode for selection of object as a whole - virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE - { - return myAssemblyOwner; - } + occ::handle GlobalSelOwner() const override { return myAssemblyOwner; } //! Assigns interactive context. - Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& theCtx) - Standard_OVERRIDE; + Standard_EXPORT void SetContext(const occ::handle& theCtx) override; public: // short aliases to Connect() method //! Establishes the connection between the Connected Interactive Object, theInteractive, and its //! reference. Copies local transformation and transformation persistence mode from //! theInteractive. //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive) - Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj) + occ::handle Connect( + const occ::handle& theAnotherObj) { return connect(theAnotherObj, theAnotherObj->LocalTransformationGeom(), @@ -96,8 +91,9 @@ public: // short aliases to Connect() method //! reference. Locates instance in theLocation and copies transformation persistence mode from //! theInteractive. //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive) - Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, - const gp_Trsf& theLocation) + occ::handle Connect( + const occ::handle& theAnotherObj, + const gp_Trsf& theLocation) { return connect(theAnotherObj, new TopLoc_Datum3D(theLocation), @@ -108,9 +104,10 @@ public: // short aliases to Connect() method //! reference. Locates instance in theLocation and applies specified transformation persistence //! mode. //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive) - Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, - const gp_Trsf& theLocation, - const Handle(Graphic3d_TransformPers)& theTrsfPers) + occ::handle Connect( + const occ::handle& theAnotherObj, + const gp_Trsf& theLocation, + const occ::handle& theTrsfPers) { return connect(theAnotherObj, new TopLoc_Datum3D(theLocation), theTrsfPers); } @@ -122,28 +119,26 @@ protected: //! compute anything, but just uses the //! presentation of this last object, with //! a transformation if there's one stored. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Establishes the connection between the Connected Interactive Object, theInteractive, and its //! reference. Locates instance in theLocation and applies specified transformation persistence //! mode. //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive) - Standard_EXPORT virtual Handle(AIS_InteractiveObject) connect( - const Handle(AIS_InteractiveObject)& theInteractive, - const Handle(TopLoc_Datum3D)& theLocation, - const Handle(Graphic3d_TransformPers)& theTrsfPers); + Standard_EXPORT virtual occ::handle connect( + const occ::handle& theInteractive, + const occ::handle& theLocation, + const occ::handle& theTrsfPers); private: //! Computes the selection for whole subtree in scene hierarchy. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& aSelection, + const int aMode) override; protected: - Handle(SelectMgr_EntityOwner) myAssemblyOwner; + occ::handle myAssemblyOwner; }; -DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject) - #endif // _AIS_MultipleConnectedInteractive_HeaderFile diff --git a/opencascade/AIS_NArray1OfEntityOwner.hxx b/opencascade/AIS_NArray1OfEntityOwner.hxx index 9c5199d9e..3cccfaba1 100644 --- a/opencascade/AIS_NArray1OfEntityOwner.hxx +++ b/opencascade/AIS_NArray1OfEntityOwner.hxx @@ -1,4 +1,4 @@ -// Copyright (c) 2020 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -11,12 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _AIS_NArray1OfEntityOwner_HeaderFile -#define _AIS_NArray1OfEntityOwner_HeaderFile +//! @file AIS_NArray1OfEntityOwner.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1> directly instead. +#ifndef _AIS_NArray1OfEntityOwner_hxx +#define _AIS_NArray1OfEntityOwner_hxx + +#include #include #include -typedef NCollection_Array1 AIS_NArray1OfEntityOwner; +Standard_HEADER_DEPRECATED( + "AIS_NArray1OfEntityOwner.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Array1> directly.") + + Standard_DEPRECATED("AIS_NArray1OfEntityOwner is deprecated, use " + "NCollection_Array1> directly") +typedef NCollection_Array1> AIS_NArray1OfEntityOwner; -#endif // _AIS_NArray1OfEntityOwner_HeaderFile +#endif // _AIS_NArray1OfEntityOwner_hxx diff --git a/opencascade/AIS_NListOfEntityOwner.hxx b/opencascade/AIS_NListOfEntityOwner.hxx index 140c85cdd..66ca2e608 100644 --- a/opencascade/AIS_NListOfEntityOwner.hxx +++ b/opencascade/AIS_NListOfEntityOwner.hxx @@ -1,6 +1,4 @@ -// Created on: 2003-05-04 -// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com) -// Copyright (c) 2003-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _AIS_NListTransient_HeaderFile -#define _AIS_NListTransient_HeaderFile +//! @file AIS_NListOfEntityOwner.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_List> directly instead. +#ifndef _AIS_NListOfEntityOwner_hxx +#define _AIS_NListOfEntityOwner_hxx + +#include #include #include -typedef NCollection_List AIS_NListOfEntityOwner; +Standard_HEADER_DEPRECATED("AIS_NListOfEntityOwner.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_List> directly.") + + Standard_DEPRECATED("AIS_NListOfEntityOwner is deprecated, use " + "NCollection_List> directly") +typedef NCollection_List> AIS_NListOfEntityOwner; -#endif +#endif // _AIS_NListOfEntityOwner_hxx diff --git a/opencascade/AIS_OffsetDimension.hxx b/opencascade/AIS_OffsetDimension.hxx deleted file mode 100644 index cb9b27f2c..000000000 --- a/opencascade/AIS_OffsetDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_OffsetDimension_HeaderFile -#define _AIS_OffsetDimension_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_OffsetDimension AIS_OffsetDimension; - -#endif // _AIS_OffsetDimension_HeaderFile diff --git a/opencascade/AIS_ParallelRelation.hxx b/opencascade/AIS_ParallelRelation.hxx deleted file mode 100644 index c4b0d78f4..000000000 --- a/opencascade/AIS_ParallelRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_ParallelRelation_HeaderFile -#define _AIS_ParallelRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_ParallelRelation AIS_ParallelRelation; - -#endif // _AIS_ParallelRelation_HeaderFile diff --git a/opencascade/AIS_PerpendicularRelation.hxx b/opencascade/AIS_PerpendicularRelation.hxx deleted file mode 100644 index 1e1a08933..000000000 --- a/opencascade/AIS_PerpendicularRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_PerpendicularRelation_HeaderFile -#define _AIS_PerpendicularRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_PerpendicularRelation AIS_PerpendicularRelation; - -#endif // _AIS_PerpendicularRelation_HeaderFile diff --git a/opencascade/AIS_Plane.hxx b/opencascade/AIS_Plane.hxx index d1f512159..078cf3baa 100644 --- a/opencascade/AIS_Plane.hxx +++ b/opencascade/AIS_Plane.hxx @@ -34,82 +34,79 @@ public: //! initializes the plane aComponent. If //! the mode aCurrentMode equals true, the drawing //! tool, "Drawer" is not initialized. - Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, - const Standard_Boolean aCurrentMode = Standard_False); + Standard_EXPORT AIS_Plane(const occ::handle& aComponent, + const bool aCurrentMode = false); //! initializes the plane aComponent and //! the point aCenter. If the mode aCurrentMode //! equals true, the drawing tool, "Drawer" is not //! initialized. aCurrentMode equals true, the drawing //! tool, "Drawer" is not initialized. - Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, - const gp_Pnt& aCenter, - const Standard_Boolean aCurrentMode = Standard_False); + Standard_EXPORT AIS_Plane(const occ::handle& aComponent, + const gp_Pnt& aCenter, + const bool aCurrentMode = false); //! initializes the plane aComponent, the //! point aCenter, and the minimum and maximum //! points, aPmin and aPmax. If the mode //! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized. - Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, - const gp_Pnt& aCenter, - const gp_Pnt& aPmin, - const gp_Pnt& aPmax, - const Standard_Boolean aCurrentMode = Standard_False); + Standard_EXPORT AIS_Plane(const occ::handle& aComponent, + const gp_Pnt& aCenter, + const gp_Pnt& aPmin, + const gp_Pnt& aPmax, + const bool aCurrentMode = false); - Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent, - const AIS_TypeOfPlane aPlaneType, - const Standard_Boolean aCurrentMode = Standard_False); + Standard_EXPORT AIS_Plane(const occ::handle& aComponent, + const AIS_TypeOfPlane aPlaneType, + const bool aCurrentMode = false); //! Same value for x and y directions - Standard_EXPORT void SetSize(const Standard_Real aValue); + Standard_EXPORT void SetSize(const double aValue); //! Sets the size defined by the length along the X axis //! XVal and the length along the Y axis YVal. - Standard_EXPORT void SetSize(const Standard_Real Xval, const Standard_Real YVal); + Standard_EXPORT void SetSize(const double Xval, const double YVal); Standard_EXPORT void UnsetSize(); - Standard_EXPORT Standard_Boolean Size(Standard_Real& X, Standard_Real& Y) const; + Standard_EXPORT bool Size(double& X, double& Y) const; - Standard_Boolean HasOwnSize() const { return myHasOwnSize; } + bool HasOwnSize() const { return myHasOwnSize; } //! Sets transform persistence for zoom with value of minimum size - Standard_EXPORT void SetMinimumSize(const Standard_Real theValue); + Standard_EXPORT void SetMinimumSize(const double theValue); //! Unsets transform persistence zoom Standard_EXPORT void UnsetMinimumSize(); //! Returns true if transform persistence for zoom is set - Standard_EXPORT Standard_Boolean HasMinimumSize() const; + Standard_EXPORT bool HasMinimumSize() const; - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; } + int Signature() const override { return 7; } - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Returns the component specified in SetComponent. - const Handle(Geom_Plane)& Component() { return myComponent; } + const occ::handle& Component() { return myComponent; } //! Creates an instance of the plane aComponent. - Standard_EXPORT void SetComponent(const Handle(Geom_Plane)& aComponent); + Standard_EXPORT void SetComponent(const occ::handle& aComponent); //! Returns the settings for the selected plane //! aComponent, provided in SetPlaneAttributes. //! These include the points aCenter, aPmin, and aPmax - Standard_EXPORT Standard_Boolean PlaneAttributes(Handle(Geom_Plane)& aComponent, - gp_Pnt& aCenter, - gp_Pnt& aPmin, - gp_Pnt& aPmax); + Standard_EXPORT bool PlaneAttributes(occ::handle& aComponent, + gp_Pnt& aCenter, + gp_Pnt& aPmin, + gp_Pnt& aPmax); //! Allows you to provide settings other than default ones //! for the selected plane. These include: center point //! aCenter, maximum aPmax and minimum aPmin. - Standard_EXPORT void SetPlaneAttributes(const Handle(Geom_Plane)& aComponent, - const gp_Pnt& aCenter, - const gp_Pnt& aPmin, - const gp_Pnt& aPmax); + Standard_EXPORT void SetPlaneAttributes(const occ::handle& aComponent, + const gp_Pnt& aCenter, + const gp_Pnt& aPmin, + const gp_Pnt& aPmax); //! Returns the coordinates of the center point. const gp_Pnt& Center() const { return myCenter; } @@ -125,34 +122,32 @@ public: //! - AIS_ TOPL_XYPlane //! - AIS_ TOPL_XZPlane //! - AIS_ TOPL_YZPlane}. - Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent, - const AIS_TypeOfPlane aPlaneType); + Standard_EXPORT void SetAxis2Placement(const occ::handle& aComponent, + const AIS_TypeOfPlane aPlaneType); //! Returns the position of the plane's axis2 system //! identifying the x, y, or z axis and giving the plane a //! direction in 3D space. An axis2 system is a right-handed coordinate system. - Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement(); + Standard_EXPORT occ::handle Axis2Placement(); //! Returns the type of plane - xy, yz, xz or unknown. AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; } //! Returns the type of plane - xy, yz, or xz. - Standard_Boolean IsXYZPlane() { return myIsXYZPlane; } + bool IsXYZPlane() { return myIsXYZPlane; } //! Returns the non-default current display mode set by SetCurrentMode. - Standard_Boolean CurrentMode() { return myCurrentMode; } + bool CurrentMode() { return myCurrentMode; } //! Allows you to provide settings for a non-default //! current display mode. - void SetCurrentMode(const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; } + void SetCurrentMode(const bool theCurrentMode) { myCurrentMode = theCurrentMode; } //! Returns true if the display mode selected, aMode, is valid for planes. - Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer aMode) const - Standard_OVERRIDE; + Standard_EXPORT bool AcceptDisplayMode(const int aMode) const override; //! connection to default drawer implies a recomputation of Frame values. - Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& aCtx) - Standard_OVERRIDE; + Standard_EXPORT void SetContext(const occ::handle& aCtx) override; //! Returns the type of sensitivity for the plane; Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; } @@ -163,17 +158,17 @@ public: myTypeOfSensitivity = theTypeOfSensitivity; } - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; - Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& aColor) override; - Standard_EXPORT void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; private: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; Standard_EXPORT void ComputeFrame(); @@ -182,19 +177,17 @@ private: Standard_EXPORT void InitDrawerAttributes(); private: - Handle(Geom_Plane) myComponent; - Handle(Geom_Axis2Placement) myAx2; - gp_Pnt myCenter; - gp_Pnt myPmin; - gp_Pnt myPmax; - Standard_Boolean myCurrentMode; - Standard_Boolean myAutomaticPosition; - AIS_TypeOfPlane myTypeOfPlane; - Standard_Boolean myIsXYZPlane; - Standard_Boolean myHasOwnSize; - Select3D_TypeOfSensitivity myTypeOfSensitivity; + occ::handle myComponent; + occ::handle myAx2; + gp_Pnt myCenter; + gp_Pnt myPmin; + gp_Pnt myPmax; + bool myCurrentMode; + bool myAutomaticPosition; + AIS_TypeOfPlane myTypeOfPlane; + bool myIsXYZPlane; + bool myHasOwnSize; + Select3D_TypeOfSensitivity myTypeOfSensitivity; }; -DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject) - #endif // _AIS_Plane_HeaderFile diff --git a/opencascade/AIS_PlaneTrihedron.hxx b/opencascade/AIS_PlaneTrihedron.hxx index 39f445d3b..8d0d8ff00 100644 --- a/opencascade/AIS_PlaneTrihedron.hxx +++ b/opencascade/AIS_PlaneTrihedron.hxx @@ -38,7 +38,7 @@ class Geom_Plane; //! value for the representation of the axes. If you modify //! these dimensions, you must temporarily recover the //! Drawer object. From inside it, take the Aspects in -//! which the values for length are stocked, for example, +//! which the values for length are stocked, for example, //! PlaneAspect for planes and LineAspect for //! trihedra. Change these values and recalculate the presentation. class AIS_PlaneTrihedron : public AIS_InteractiveObject @@ -47,64 +47,58 @@ class AIS_PlaneTrihedron : public AIS_InteractiveObject public: //! Initializes the plane aPlane. The plane trihedron is //! constructed from this and an axis. - Standard_EXPORT AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane); + Standard_EXPORT AIS_PlaneTrihedron(const occ::handle& aPlane); //! Returns the component specified in SetComponent. - Standard_EXPORT Handle(Geom_Plane) Component(); + Standard_EXPORT occ::handle Component(); //! Creates an instance of the component object aPlane. - Standard_EXPORT void SetComponent(const Handle(Geom_Plane)& aPlane); + Standard_EXPORT void SetComponent(const occ::handle& aPlane); //! Returns the "XAxis". - Standard_EXPORT Handle(AIS_Line) XAxis() const; + Standard_EXPORT occ::handle XAxis() const; //! Returns the "YAxis". - Standard_EXPORT Handle(AIS_Line) YAxis() const; + Standard_EXPORT occ::handle YAxis() const; //! Returns the point of origin of the plane trihedron. - Standard_EXPORT Handle(AIS_Point) Position() const; + Standard_EXPORT occ::handle Position() const; //! Sets the length of the X and Y axes. - Standard_EXPORT void SetLength(const Standard_Real theLength); + Standard_EXPORT void SetLength(const double theLength); //! Returns the length of X and Y axes. - Standard_EXPORT Standard_Real GetLength() const; + Standard_EXPORT double GetLength() const; //! Returns true if the display mode selected, aMode, is valid. - Standard_EXPORT Standard_Boolean - AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE; + Standard_EXPORT bool AcceptDisplayMode(const int aMode) const override; - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 4; } + int Signature() const override { return 4; } //! Returns datum as the type of Interactive Object. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Allows you to provide settings for the color aColor. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; void SetXLabel(const TCollection_AsciiString& theLabel) { myXLabel = theLabel; } void SetYLabel(const TCollection_AsciiString& theLabel) { myYLabel = theLabel; } protected: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& theprsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& theprsMgr, + const occ::handle& thePrs, + const int theMode) override; private: - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; private: - Handle(Geom_Plane) myPlane; - Handle(AIS_InteractiveObject) myShapes[3]; - TCollection_AsciiString myXLabel; - TCollection_AsciiString myYLabel; + occ::handle myPlane; + occ::handle myShapes[3]; + TCollection_AsciiString myXLabel; + TCollection_AsciiString myYLabel; }; -DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject) - #endif // _AIS_PlaneTrihedron_HeaderFile diff --git a/opencascade/AIS_Point.hxx b/opencascade/AIS_Point.hxx index ae8187315..8488b1b2f 100644 --- a/opencascade/AIS_Point.hxx +++ b/opencascade/AIS_Point.hxx @@ -30,32 +30,28 @@ class AIS_Point : public AIS_InteractiveObject public: //! Initializes the point aComponent from which the point //! datum will be built. - Standard_EXPORT AIS_Point(const Handle(Geom_Point)& aComponent); + Standard_EXPORT AIS_Point(const occ::handle& aComponent); //! Returns index 1, the default index for a point. - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; } + int Signature() const override { return 1; } //! Indicates that a point is a datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Returns the component specified in SetComponent. - Standard_EXPORT Handle(Geom_Point) Component(); + Standard_EXPORT occ::handle Component(); //! Constructs an instance of the point aComponent. - Standard_EXPORT void SetComponent(const Handle(Geom_Point)& aComponent); + Standard_EXPORT void SetComponent(const occ::handle& aComponent); //! Returns true if the display mode selected is valid for point datums. - Standard_EXPORT Standard_Boolean - AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE; + Standard_EXPORT bool AcceptDisplayMode(const int aMode) const override; //! Allows you to provide settings for the Color. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Allows you to remove color settings. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Allows you to provide settings for a marker. These include //! - type of marker, @@ -67,31 +63,29 @@ public: Standard_EXPORT void UnsetMarker(); //! Returns true if the point datum has a marker. - Standard_Boolean HasMarker() const { return myHasTOM; } + bool HasMarker() const { return myHasTOM; } //! Converts a point into a vertex. Standard_EXPORT TopoDS_Vertex Vertex() const; protected: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; private: - Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& aSelection, + const int aMode) override; Standard_EXPORT void UpdatePointValues(); //! Replace aspects of already computed groups with the new value. - void replaceWithNewPointAspect(const Handle(Prs3d_PointAspect)& theAspect); + void replaceWithNewPointAspect(const occ::handle& theAspect); private: - Handle(Geom_Point) myComponent; - Standard_Boolean myHasTOM; - Aspect_TypeOfMarker myTOM; + occ::handle myComponent; + bool myHasTOM; + Aspect_TypeOfMarker myTOM; }; -DEFINE_STANDARD_HANDLE(AIS_Point, AIS_InteractiveObject) - #endif // _AIS_Point_HeaderFile diff --git a/opencascade/AIS_PointCloud.hxx b/opencascade/AIS_PointCloud.hxx index a56f810c9..5376e1a6d 100644 --- a/opencascade/AIS_PointCloud.hxx +++ b/opencascade/AIS_PointCloud.hxx @@ -20,10 +20,12 @@ #include #include #include -#include +#include +#include +#include #include -#include -#include +#include +#include class TColStd_HPackedMapOfInteger; @@ -64,7 +66,7 @@ public: //! Sets the points from array of points. //! Method will not copy the input data - array will be stored as handle. //! @param[in] thePoints the array of points - Standard_EXPORT virtual void SetPoints(const Handle(Graphic3d_ArrayOfPoints)& thePoints); + Standard_EXPORT virtual void SetPoints(const occ::handle& thePoints); //! Sets the points with optional colors. //! The input data will be copied into internal buffer. @@ -73,16 +75,17 @@ public: //! @param[in] theCoords the array of coordinates //! @param[in] theColors optional array of colors //! @param[in] theNormals optional array of normals - Standard_EXPORT virtual void SetPoints(const Handle(TColgp_HArray1OfPnt)& theCoords, - const Handle(Quantity_HArray1OfColor)& theColors = NULL, - const Handle(TColgp_HArray1OfDir)& theNormals = NULL); + Standard_EXPORT virtual void SetPoints( + const occ::handle>& theCoords, + const occ::handle>& theColors = nullptr, + const occ::handle>& theNormals = nullptr); public: //! Get the points array. //! Method might be overridden to fill in points array dynamically from application data //! structures. //! @return the array of points - Standard_EXPORT virtual const Handle(Graphic3d_ArrayOfPoints) GetPoints() const; + Standard_EXPORT virtual const occ::handle GetPoints() const; //! Get bounding box for presentation. Standard_EXPORT virtual Bnd_Box GetBoundingBox() const; @@ -90,75 +93,72 @@ public: public: //! Setup custom color. Affects presentation only when no per-point color attribute has been //! assigned. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Restore default color. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Setup custom material. Affects presentation only when normals are defined. - Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theMat) - Standard_OVERRIDE; + Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& theMat) override; //! Restore default material. - Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE; + Standard_EXPORT void UnsetMaterial() override; protected: //! Prepare presentation for this object. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Prepare selection for this object. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; private: - Handle(Graphic3d_ArrayOfPoints) myPoints; //!< points array for presentation - Bnd_Box myBndBox; //!< bounding box for presentation + occ::handle myPoints; //!< points array for presentation + Bnd_Box myBndBox; //!< bounding box for presentation }; -DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject) - //! Custom owner for highlighting selected points. class AIS_PointCloudOwner : public SelectMgr_EntityOwner { DEFINE_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner) public: //! Main constructor. - Standard_EXPORT AIS_PointCloudOwner(const Handle(AIS_PointCloud)& theOrigin); + Standard_EXPORT AIS_PointCloudOwner(const occ::handle& theOrigin); //! Destructor. - Standard_EXPORT virtual ~AIS_PointCloudOwner(); + Standard_EXPORT ~AIS_PointCloudOwner() override; //! Return selected points. //! WARNING! Indexation starts with 0 (shifted by -1 comparing to //! Graphic3d_ArrayOfPoints::Vertice()). - const Handle(TColStd_HPackedMapOfInteger)& SelectedPoints() const { return mySelPoints; } + const occ::handle& SelectedPoints() const { return mySelPoints; } //! Return last detected points. //! WARNING! Indexation starts with 0 (shifted by -1 comparing to //! Graphic3d_ArrayOfPoints::Vertice()). - const Handle(TColStd_HPackedMapOfInteger)& DetectedPoints() const { return myDetPoints; } + const occ::handle& DetectedPoints() const { return myDetPoints; } //! Always update dynamic highlighting. - Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE; + Standard_EXPORT bool IsForcedHilight() const override; //! Handle dynamic highlighting. - Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void HilightWithColor(const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) override; //! Removes highlighting. - Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Unhilight(const occ::handle& thePrsMgr, + const int theMode) override; //! Clears presentation. - Standard_EXPORT virtual void Clear(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Clear(const occ::handle& thePrsMgr, + const int theMode) override; protected: - Handle(TColStd_HPackedMapOfInteger) myDetPoints; //!< last detected points - Handle(TColStd_HPackedMapOfInteger) mySelPoints; //!< selected points + occ::handle myDetPoints; //!< last detected points + occ::handle mySelPoints; //!< selected points }; #endif // _AIS_PointCloud_HeaderFile diff --git a/opencascade/AIS_RadiusDimension.hxx b/opencascade/AIS_RadiusDimension.hxx deleted file mode 100644 index c48e4ebdc..000000000 --- a/opencascade/AIS_RadiusDimension.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_RadiusDimension_HeaderFile -#define _AIS_RadiusDimension_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_RadiusDimension AIS_RadiusDimension; - -#endif // _AIS_RadiusDimension_HeaderFile diff --git a/opencascade/AIS_Relation.hxx b/opencascade/AIS_Relation.hxx deleted file mode 100644 index 45dfe3f84..000000000 --- a/opencascade/AIS_Relation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_Relation_HeaderFile -#define _AIS_Relation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_Relation AIS_Relation; - -#endif // _AIS_Relation_HeaderFile diff --git a/opencascade/AIS_RubberBand.hxx b/opencascade/AIS_RubberBand.hxx index 1119b065a..362a99b40 100644 --- a/opencascade/AIS_RubberBand.hxx +++ b/opencascade/AIS_RubberBand.hxx @@ -19,11 +19,10 @@ #include #include #include -#include +#include +#include #include -DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject) - //! Presentation for drawing rubber band selection. //! It supports rectangle and polygonal selection. //! It is constructed in 2d overlay. @@ -46,8 +45,8 @@ public: //! @warning It binds this object with Graphic3d_ZLayerId_TopOSD layer. Standard_EXPORT AIS_RubberBand(const Quantity_Color& theLineColor, const Aspect_TypeOfLine theType, - const Standard_Real theLineWidth = 1.0, - const Standard_Boolean theIsPolygonClosed = Standard_True); + const double theLineWidth = 1.0, + const bool theIsPolygonClosed = true); //! Constructs the rubber band with defined filling and line parameters. //! @param[in] theLineColor color of rubber band lines @@ -60,28 +59,28 @@ public: Standard_EXPORT AIS_RubberBand(const Quantity_Color& theLineColor, const Aspect_TypeOfLine theType, const Quantity_Color theFillColor, - const Standard_Real theTransparency = 1.0, - const Standard_Real theLineWidth = 1.0, - const Standard_Boolean theIsPolygonClosed = Standard_True); + const double theTransparency = 1.0, + const double theLineWidth = 1.0, + const bool theIsPolygonClosed = true); - Standard_EXPORT virtual ~AIS_RubberBand(); + Standard_EXPORT ~AIS_RubberBand() override; //! Sets rectangle bounds. - Standard_EXPORT void SetRectangle(const Standard_Integer theMinX, - const Standard_Integer theMinY, - const Standard_Integer theMaxX, - const Standard_Integer theMaxY); + Standard_EXPORT void SetRectangle(const int theMinX, + const int theMinY, + const int theMaxX, + const int theMaxY); //! Adds last point to the list of points. They are used to build polygon for rubber band. //! @sa RemoveLastPoint(), GetPoints() - Standard_EXPORT void AddPoint(const Graphic3d_Vec2i& thePoint); + Standard_EXPORT void AddPoint(const NCollection_Vec2& thePoint); //! Remove last point from the list of points for the rubber band polygon. //! @sa AddPoint(), GetPoints() Standard_EXPORT void RemoveLastPoint(); //! @return points for the rubber band polygon. - Standard_EXPORT const NCollection_Sequence& Points() const; + Standard_EXPORT const NCollection_Sequence>& Points() const; //! Remove all points for the rubber band polygon. void ClearPoints() { myPoints.Clear(); } @@ -99,10 +98,10 @@ public: Standard_EXPORT void SetFillColor(const Quantity_Color& theColor); //! Sets width of line for rubber band presentation. - Standard_EXPORT void SetLineWidth(const Standard_Real theWidth) const; + Standard_EXPORT void SetLineWidth(const double theWidth) const; //! @return width of lines. - Standard_EXPORT Standard_Real LineWidth() const; + Standard_EXPORT double LineWidth() const; //! Sets type of line for rubber band presentation. Standard_EXPORT void SetLineType(const Aspect_TypeOfLine theType); @@ -112,57 +111,53 @@ public: //! Sets fill transparency. //! @param[in] theValue the transparency value. 1.0 is for transparent background - Standard_EXPORT void SetFillTransparency(const Standard_Real theValue) const; + Standard_EXPORT void SetFillTransparency(const double theValue) const; //! @return fill transparency. - Standard_EXPORT Standard_Real FillTransparency() const; + Standard_EXPORT double FillTransparency() const; //! Enable or disable filling of rubber band. - Standard_EXPORT void SetFilling(const Standard_Boolean theIsFilling); + Standard_EXPORT void SetFilling(const bool theIsFilling); //! Enable filling of rubber band with defined parameters. //! @param[in] theColor color of filling //! @param[in] theTransparency transparency of the filling. 0 is for opaque filling. - Standard_EXPORT void SetFilling(const Quantity_Color theColor, - const Standard_Real theTransparency); + Standard_EXPORT void SetFilling(const Quantity_Color theColor, const double theTransparency); //! @return true if filling of rubber band is enabled. - Standard_EXPORT Standard_Boolean IsFilling() const; + Standard_EXPORT bool IsFilling() const; //! @return true if automatic closing of rubber band is enabled. - Standard_EXPORT Standard_Boolean IsPolygonClosed() const; + Standard_EXPORT bool IsPolygonClosed() const; //! Automatically create an additional line connecting the first and //! the last screen points to close the boundary polyline - Standard_EXPORT void SetPolygonClosed(Standard_Boolean theIsPolygonClosed); + Standard_EXPORT void SetPolygonClosed(bool theIsPolygonClosed); protected: //! Returns true if the interactive object accepts the display mode. - Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Computes presentation of rubber band. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Does not fill selection primitives for rubber band. - virtual void ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/, - const Standard_Integer /*aMode*/) Standard_OVERRIDE {}; + void ComputeSelection(const occ::handle& /*aSelection*/, + const int /*aMode*/) override {}; //! Fills triangles primitive array for rubber band filling. //! It uses Delaunay triangulation. //! @return true if array of triangles is successfully filled. - Standard_EXPORT Standard_Boolean fillTriangles(); + Standard_EXPORT bool fillTriangles(); protected: - NCollection_Sequence myPoints; //!< Array of screen points + NCollection_Sequence> myPoints; //!< Array of screen points - Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for rubber band filling - Handle(Graphic3d_ArrayOfPolylines) myBorders; //!< Polylines for rubber band borders + occ::handle myTriangles; //!< Triangles for rubber band filling + occ::handle myBorders; //!< Polylines for rubber band borders - Standard_Boolean myIsPolygonClosed; //!< automatic closing of rubber-band flag + bool myIsPolygonClosed; //!< automatic closing of rubber-band flag }; #endif diff --git a/opencascade/AIS_Selection.hxx b/opencascade/AIS_Selection.hxx index 59f142b11..652ddf912 100644 --- a/opencascade/AIS_Selection.hxx +++ b/opencascade/AIS_Selection.hxx @@ -17,8 +17,9 @@ #ifndef _AIS_Selection_HeaderFile #define _AIS_Selection_HeaderFile -#include -#include +#include +#include +#include #include #include #include @@ -44,65 +45,70 @@ public: //! @param[in] theSelScheme selection scheme //! @param[in] theIsDetected flag of object detection //! @return result of selection - Standard_EXPORT virtual AIS_SelectStatus Select(const Handle(SelectMgr_EntityOwner)& theOwner, - const Handle(SelectMgr_Filter)& theFilter, - const AIS_SelectionScheme theSelScheme, - const Standard_Boolean theIsDetected); + Standard_EXPORT virtual AIS_SelectStatus Select( + const occ::handle& theOwner, + const occ::handle& theFilter, + const AIS_SelectionScheme theSelScheme, + const bool theIsDetected); //! the object is always add int the selection. //! faster when the number of objects selected is great. Standard_EXPORT virtual AIS_SelectStatus AddSelect( - const Handle(SelectMgr_EntityOwner)& theObject); + const occ::handle& theObject); //! clears the selection and adds the object in the selection. //! @param[in] theObject element to change selection state //! @param[in] theFilter context filter //! @param[in] theIsDetected flag of object detection - virtual void ClearAndSelect(const Handle(SelectMgr_EntityOwner)& theObject, - const Handle(SelectMgr_Filter)& theFilter, - const Standard_Boolean theIsDetected) + virtual void ClearAndSelect(const occ::handle& theObject, + const occ::handle& theFilter, + const bool theIsDetected) { Clear(); Select(theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected); } //! checks if the object is in the selection. - Standard_Boolean IsSelected(const Handle(SelectMgr_EntityOwner)& theObject) const + bool IsSelected(const occ::handle& theObject) const { return myResultMap.IsBound(theObject); } //! Return the list of selected objects. - const AIS_NListOfEntityOwner& Objects() const { return myresult; } + const NCollection_List>& Objects() const { return myresult; } //! Return the number of selected objects. - Standard_Integer Extent() const { return myresult.Size(); } + int Extent() const { return myresult.Length(); } //! Return true if list of selected objects is empty. - Standard_Boolean IsEmpty() const { return myresult.IsEmpty(); } + bool IsEmpty() const { return myresult.IsEmpty(); } public: //! Start iteration through selected objects. - void Init() { myIterator = AIS_NListOfEntityOwner::Iterator(myresult); } + void Init() + { + myIterator = NCollection_List>::Iterator(myresult); + } //! Return true if iterator points to selected object. - Standard_Boolean More() const { return myIterator.More(); } + bool More() const { return myIterator.More(); } //! Continue iteration through selected objects. void Next() { myIterator.Next(); } //! Return selected object at iterator position. - const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); } + const occ::handle& Value() const { return myIterator.Value(); } //! Select or deselect owners depending on the selection scheme. //! @param[in] thePickedOwners elements to change selection state //! @param[in] theSelScheme selection scheme, defines how owner is selected //! @param[in] theToAllowSelOverlap selection flag, if true - overlapped entities are allowed //! @param[in] theFilter context filter to skip not acceptable owners - Standard_EXPORT virtual void SelectOwners(const AIS_NArray1OfEntityOwner& thePickedOwners, - const AIS_SelectionScheme theSelScheme, - const Standard_Boolean theToAllowSelOverlap, - const Handle(SelectMgr_Filter)& theFilter); + Standard_EXPORT virtual void SelectOwners( + const NCollection_Array1>& thePickedOwners, + const AIS_SelectionScheme theSelScheme, + const bool theToAllowSelOverlap, + const occ::handle& theFilter); protected: //! Append the owner into the current selection if filter is Ok. @@ -110,15 +116,15 @@ protected: //! @param[in] theFilter context filter to skip not acceptable owners //! @return result of selection Standard_EXPORT virtual AIS_SelectStatus appendOwner( - const Handle(SelectMgr_EntityOwner)& theOwner, - const Handle(SelectMgr_Filter)& theFilter); + const occ::handle& theOwner, + const occ::handle& theFilter); protected: - AIS_NListOfEntityOwner myresult; - AIS_NListOfEntityOwner::Iterator myIterator; - NCollection_DataMap myResultMap; + NCollection_List> myresult; + NCollection_List>::Iterator myIterator; + NCollection_DataMap, + NCollection_List>::Iterator> + myResultMap; }; -DEFINE_STANDARD_HANDLE(AIS_Selection, Standard_Transient) - #endif // _AIS_Selection_HeaderFile diff --git a/opencascade/AIS_Shape.hxx b/opencascade/AIS_Shape.hxx index 4797532de..afab2dc64 100644 --- a/opencascade/AIS_Shape.hxx +++ b/opencascade/AIS_Shape.hxx @@ -26,7 +26,7 @@ //! A framework to manage presentation and selection of shapes. //! AIS_Shape is the interactive object which is used the -//! most by applications. There are standard functions +//! most by applications. There are standard functions //! available which allow you to prepare selection //! operations on the constituent elements of shapes - //! vertices, edges, faces etc - in an open local context. @@ -52,10 +52,10 @@ //! generate texture coordinates, appropriate shading attribute should be set before computing //! presentation in AIS_Shaded display mode: //! @code -//! Handle(AIS_Shape) aPrs = new AIS_Shape(); +//! occ::handle aPrs = new AIS_Shape(); //! aPrs->Attributes()->SetupOwnShadingAspect(); //! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn(); -//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual +//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2D //! (Graphic3d_NOT_2D_ALUMINUM)); //! @endcode //! The texture itself is parametrized in (0,1)x(0,1). @@ -68,25 +68,16 @@ public: Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap); //! Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; } + int Signature() const override { return 0; } //! Returns Object as the type of Interactive Object. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Shape; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Shape; } //! Returns true if the Interactive Object accepts shape decomposition. - virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE - { - return Standard_True; - } + bool AcceptShapeDecomposition() const override { return true; } //! Return true if specified display mode is supported. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode >= 0 && theMode <= 2; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode >= 0 && theMode <= 2; } //! Returns this shape object. const TopoDS_Shape& Shape() const { return myshape; } @@ -95,43 +86,42 @@ public: void SetShape(const TopoDS_Shape& theShape) { myshape = theShape; - myCompBB = Standard_True; + myCompBB = true; } //! Alias for ::SetShape(). void Set(const TopoDS_Shape& theShape) { SetShape(theShape); } //! Sets a local value for deviation coefficient for this specific shape. - Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient(); + Standard_EXPORT bool SetOwnDeviationCoefficient(); //! Sets a local value for deviation angle for this specific shape. - Standard_EXPORT Standard_Boolean SetOwnDeviationAngle(); + Standard_EXPORT bool SetOwnDeviationAngle(); //! Sets a local value for deviation coefficient for this specific shape. - Standard_EXPORT void SetOwnDeviationCoefficient(const Standard_Real aCoefficient); + Standard_EXPORT void SetOwnDeviationCoefficient(const double aCoefficient); //! this compute a new angle and Deviation from the value anAngle //! and set the values stored in myDrawer with these that become local to the shape - Standard_EXPORT void SetAngleAndDeviation(const Standard_Real anAngle); + Standard_EXPORT void SetAngleAndDeviation(const double anAngle); //! gives back the angle initial value put by the User. - Standard_EXPORT Standard_Real UserAngle() const; + Standard_EXPORT double UserAngle() const; //! sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation - Standard_EXPORT void SetOwnDeviationAngle(const Standard_Real anAngle); + Standard_EXPORT void SetOwnDeviationAngle(const double anAngle); //! Returns true and the values of the deviation //! coefficient aCoefficient and the previous deviation //! coefficient aPreviousCoefficient. If these values are //! not already set, false is returned. - Standard_EXPORT Standard_Boolean - OwnDeviationCoefficient(Standard_Real& aCoefficient, Standard_Real& aPreviousCoefficient) const; + Standard_EXPORT bool OwnDeviationCoefficient(double& aCoefficient, + double& aPreviousCoefficient) const; //! Returns true and the values of the deviation angle //! anAngle and the previous deviation angle aPreviousAngle. //! If these values are not already set, false is returned. - Standard_EXPORT Standard_Boolean OwnDeviationAngle(Standard_Real& anAngle, - Standard_Real& aPreviousAngle) const; + Standard_EXPORT bool OwnDeviationAngle(double& anAngle, double& aPreviousAngle) const; //! Sets the type of HLR algorithm used by the shape void SetTypeOfHLR(const Prs3d_TypeOfHLR theTypeOfHLR) { myDrawer->SetTypeOfHLR(theTypeOfHLR); } @@ -152,30 +142,30 @@ public: //! Prs3d_Drawer_SeenLineAspect //! - hidden line color in hidden line mode: //! Prs3d_Drawer_HiddenLineAspect. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Removes settings for color in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Sets the value aValue for line width in the reconstructed compound shape. //! Changes line aspects for lines presentation. - Standard_EXPORT virtual void SetWidth(const Standard_Real aValue) Standard_OVERRIDE; + Standard_EXPORT void SetWidth(const double aValue) override; //! Removes the setting for line width in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE; + Standard_EXPORT void UnsetWidth() override; //! Allows you to provide settings for the material aName //! in the reconstructed compound shape. - Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& aName) Standard_OVERRIDE; + Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& aName) override; //! Removes settings for material in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE; + Standard_EXPORT void UnsetMaterial() override; //! Sets the value aValue for transparency in the reconstructed compound shape. - Standard_EXPORT virtual void SetTransparency(const Standard_Real aValue = 0.6) Standard_OVERRIDE; + Standard_EXPORT void SetTransparency(const double aValue = 0.6) override; //! Removes the setting for transparency in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; + Standard_EXPORT void UnsetTransparency() override; //! Constructs a bounding box with which to reconstruct //! compound topological shapes for presentation. @@ -187,18 +177,18 @@ public: //! Returns the Color attributes of the shape accordingly to //! the current facing model; - Standard_EXPORT virtual void Color(Quantity_Color& aColor) const Standard_OVERRIDE; + Standard_EXPORT void Color(Quantity_Color& aColor) const override; //! Returns the NameOfMaterial attributes of the shape accordingly to //! the current facing model; - Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const Standard_OVERRIDE; + Standard_EXPORT Graphic3d_NameOfMaterial Material() const override; //! Returns the transparency attributes of the shape accordingly to //! the current facing model; - Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE; + Standard_EXPORT double Transparency() const override; //! Return shape type for specified selection mode. - static TopAbs_ShapeEnum SelectionType(const Standard_Integer theSelMode) + static TopAbs_ShapeEnum SelectionType(const int theSelMode) { switch (theSelMode) { @@ -225,7 +215,7 @@ public: } //! Return selection mode for specified shape type. - static Standard_Integer SelectionMode(const TopAbs_ShapeEnum theShapeType) + static int SelectionMode(const TopAbs_ShapeEnum theShapeType) { switch (theShapeType) { @@ -278,14 +268,14 @@ public: //! @name methods to alter texture mapping properties protected: //! Compute normal presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute projected presentation. - virtual void computeHLR(const Handle(Graphic3d_Camera)& theProjector, - const Handle(TopLoc_Datum3D)& theTrsf, - const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE + void computeHLR(const occ::handle& theProjector, + const occ::handle& theTrsf, + const occ::handle& thePrs) override { if (!theTrsf.IsNull() && theTrsf->Form() != gp_Identity) { @@ -300,51 +290,49 @@ protected: } //! Compute selection. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Create own aspects (if they do not exist) and set color to them. //! @return TRUE if new aspects have been created - Standard_EXPORT bool setColor(const Handle(Prs3d_Drawer)& theDrawer, - const Quantity_Color& theColor) const; + Standard_EXPORT bool setColor(const occ::handle& theDrawer, + const Quantity_Color& theColor) const; //! Create own aspects (if they do not exist) and set width to them. //! @return TRUE if new aspects have been created - Standard_EXPORT bool setWidth(const Handle(Prs3d_Drawer)& theDrawer, - const Standard_Real theWidth) const; + Standard_EXPORT bool setWidth(const occ::handle& theDrawer, + const double theWidth) const; - Standard_EXPORT void setTransparency(const Handle(Prs3d_Drawer)& theDrawer, - const Standard_Real theValue) const; + Standard_EXPORT void setTransparency(const occ::handle& theDrawer, + const double theValue) const; - Standard_EXPORT void setMaterial(const Handle(Prs3d_Drawer)& theDrawer, - const Graphic3d_MaterialAspect& theMaterial, - const Standard_Boolean theToKeepColor, - const Standard_Boolean theToKeepTransp) const; + Standard_EXPORT void setMaterial(const occ::handle& theDrawer, + const Graphic3d_MaterialAspect& theMaterial, + const bool theToKeepColor, + const bool theToKeepTransp) const; //! Replace aspects of already computed groups from drawer link by the new own value. Standard_EXPORT void replaceWithNewOwnAspects(); public: //! Compute HLR presentation for specified shape. - Standard_EXPORT static void computeHlrPresentation(const Handle(Graphic3d_Camera)& theProjector, - const Handle(Prs3d_Presentation)& thePrs, - const TopoDS_Shape& theShape, - const Handle(Prs3d_Drawer)& theDrawer); + Standard_EXPORT static void computeHlrPresentation( + const occ::handle& theProjector, + const occ::handle& thePrs, + const TopoDS_Shape& theShape, + const occ::handle& theDrawer); //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; protected: - TopoDS_Shape myshape; //!< shape to display - Bnd_Box myBB; //!< cached bounding box of the shape - gp_Pnt2d myUVOrigin; //!< UV origin vector for generating texture coordinates - gp_Pnt2d myUVRepeat; //!< UV repeat vector for generating texture coordinates - gp_Pnt2d myUVScale; //!< UV scale vector for generating texture coordinates - Standard_Real myInitAng; - Standard_Boolean myCompBB; //!< if TRUE, then bounding box should be recomputed + TopoDS_Shape myshape; //!< shape to display + Bnd_Box myBB; //!< cached bounding box of the shape + gp_Pnt2d myUVOrigin; //!< UV origin vector for generating texture coordinates + gp_Pnt2d myUVRepeat; //!< UV repeat vector for generating texture coordinates + gp_Pnt2d myUVScale; //!< UV scale vector for generating texture coordinates + double myInitAng; + bool myCompBB; //!< if TRUE, then bounding box should be recomputed }; -DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject) - #endif // _AIS_Shape_HeaderFile diff --git a/opencascade/AIS_SignatureFilter.hxx b/opencascade/AIS_SignatureFilter.hxx index 018cd8674..f1bed9db8 100644 --- a/opencascade/AIS_SignatureFilter.hxx +++ b/opencascade/AIS_SignatureFilter.hxx @@ -25,21 +25,18 @@ #include class SelectMgr_EntityOwner; -class AIS_SignatureFilter; -DEFINE_STANDARD_HANDLE(AIS_SignatureFilter, AIS_TypeFilter) - //! Selects Interactive Objects through their signatures //! and types. The signature provides an -//! additional characterization of an object's type, and +//! additional characterization of an object's type, and //! takes the form of an index. The filter questions each //! Interactive Object in local context to determine //! whether it has an non-null owner, and if so, whether //! it has the desired signature. If the object returns true //! in each case, it is kept. If not, it is rejected. -//! By default, the interactive object has a None type +//! By default, the interactive object has a None type //! and a signature of 0. If you want to give a particular //! type and signature to your Interactive Object, you -//! must redefine two virtual methods: Type and Signature. +//! must redefine two virtual methods: Type and Signature. //! This filter is only used in an open local contexts. //! In the Collector viewer, you can only locate //! Interactive Objects which answer positively to the @@ -63,19 +60,17 @@ public: //! specification, aGivenSignature, to that for type, //! aGivenKind, in AIS_TypeFilter. Standard_EXPORT AIS_SignatureFilter(const AIS_KindOfInteractive aGivenKind, - const Standard_Integer aGivenSignature); + const int aGivenSignature); //! Returns False if the transient is not an AIS_InteractiveObject. //! Returns False if the signature of InteractiveObject //! is not the same as the stored one in the filter... - Standard_EXPORT Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& anobj) const override; DEFINE_STANDARD_RTTIEXT(AIS_SignatureFilter, AIS_TypeFilter) -protected: private: - Standard_Integer mySig; + int mySig; }; #endif // _AIS_SignatureFilter_HeaderFile diff --git a/opencascade/AIS_SymmetricRelation.hxx b/opencascade/AIS_SymmetricRelation.hxx deleted file mode 100644 index d452b8b36..000000000 --- a/opencascade/AIS_SymmetricRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_SymmetricRelation_HeaderFile -#define _AIS_SymmetricRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_SymmetricRelation AIS_SymmetricRelation; - -#endif // _AIS_SymmetricRelation_HeaderFile diff --git a/opencascade/AIS_TangentRelation.hxx b/opencascade/AIS_TangentRelation.hxx deleted file mode 100644 index ea7159f05..000000000 --- a/opencascade/AIS_TangentRelation.hxx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2020 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _AIS_TangentRelation_HeaderFile -#define _AIS_TangentRelation_HeaderFile - -#include - -Standard_DEPRECATED("Deprecated alias to moved class") -typedef PrsDim_TangentRelation AIS_TangentRelation; - -#endif // _AIS_TangentRelation_HeaderFile diff --git a/opencascade/AIS_TextLabel.hxx b/opencascade/AIS_TextLabel.hxx index 7aabe006a..0e6d7b5d5 100644 --- a/opencascade/AIS_TextLabel.hxx +++ b/opencascade/AIS_TextLabel.hxx @@ -34,22 +34,19 @@ public: Standard_EXPORT AIS_TextLabel(); //! Return TRUE for supported display mode. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Setup color of entire text. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Setup transparency within [0, 1] range. - Standard_EXPORT virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE; + Standard_EXPORT void SetTransparency(const double theValue) override; //! Removes the transparency setting. - virtual void UnsetTransparency() Standard_OVERRIDE { SetTransparency(0.0); } + void UnsetTransparency() override { SetTransparency(0.0); } //! Material has no effect for text label. - virtual void SetMaterial(const Graphic3d_MaterialAspect&) Standard_OVERRIDE {} + void SetMaterial(const Graphic3d_MaterialAspect&) override {} //! Setup text. Standard_EXPORT void SetText(const TCollection_ExtendedString& theText); @@ -64,19 +61,19 @@ public: Standard_EXPORT void SetVJustification(const Graphic3d_VerticalTextAlignment theVJust); //! Setup angle. - Standard_EXPORT void SetAngle(const Standard_Real theAngle); + Standard_EXPORT void SetAngle(const double theAngle); //! Setup zoomable property. - Standard_EXPORT void SetZoomable(const Standard_Boolean theIsZoomable); + Standard_EXPORT void SetZoomable(const bool theIsZoomable); //! Setup height. - Standard_EXPORT void SetHeight(const Standard_Real theHeight); + Standard_EXPORT void SetHeight(const double theHeight); //! Setup font aspect. Standard_EXPORT void SetFontAspect(const Font_FontAspect theFontAspect); //! Setup font. - Standard_EXPORT void SetFont(Standard_CString theFont); + Standard_EXPORT void SetFont(const char* theFont); //! Setup label orientation in the model 3D space. Standard_EXPORT void SetOrientation3D(const gp_Ax2& theOrientation); @@ -100,20 +97,17 @@ public: Standard_EXPORT const gp_Ax2& Orientation3D() const; //! Returns true if the current text placement mode uses text orientation in the model 3D space. - Standard_EXPORT Standard_Boolean HasOrientation3D() const; + Standard_EXPORT bool HasOrientation3D() const; - Standard_EXPORT void SetFlipping(const Standard_Boolean theIsFlipping); + Standard_EXPORT void SetFlipping(const bool theIsFlipping); - Standard_EXPORT Standard_Boolean HasFlipping() const; + Standard_EXPORT bool HasFlipping() const; //! Returns flag if text uses position as point of attach - Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; } + bool HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; } //! Set flag if text uses position as point of attach - void SetOwnAnchorPoint(const Standard_Boolean theOwnAnchorPoint) - { - myHasOwnAnchorPoint = theOwnAnchorPoint; - } + void SetOwnAnchorPoint(const bool theOwnAnchorPoint) { myHasOwnAnchorPoint = theOwnAnchorPoint; } //! Define the display type of the text. //! @@ -130,48 +124,46 @@ public: //! Returns text presentation formatter; NULL by default, which means standard text formatter will //! be used. - const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; } + const occ::handle& TextFormatter() const { return myFormatter; } //! Setup text formatter for presentation. It's empty by default. - void SetTextFormatter(const Handle(Font_TextFormatter)& theFormatter) + void SetTextFormatter(const occ::handle& theFormatter) { myFormatter = theFormatter; } protected: //! Compute - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& theprsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& theprsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Calculate label center, width and height - Standard_EXPORT Standard_Boolean calculateLabelParams(const gp_Pnt& thePosition, - gp_Pnt& theCenterOfLabel, - Standard_Real& theWidth, - Standard_Real& theHeight) const; + Standard_EXPORT bool calculateLabelParams(const gp_Pnt& thePosition, + gp_Pnt& theCenterOfLabel, + double& theWidth, + double& theHeight) const; //! Calculate label transformation Standard_EXPORT gp_Trsf calculateLabelTrsf(const gp_Pnt& thePosition, gp_Pnt& theCenterOfLabel) const; protected: - Handle(Font_TextFormatter) myFormatter; + occ::handle myFormatter; TCollection_ExtendedString myText; gp_Ax2 myOrientation3D; - Standard_Boolean myHasOrientation3D; - Standard_Boolean myHasOwnAnchorPoint; - Standard_Boolean myHasFlipping; + bool myHasOrientation3D; + bool myHasOwnAnchorPoint; + bool myHasFlipping; public: //! CASCADE RTTI DEFINE_STANDARD_RTTIEXT(AIS_TextLabel, AIS_InteractiveObject) }; -DEFINE_STANDARD_HANDLE(AIS_TextLabel, AIS_InteractiveObject) - #endif // _AIS_TextLabel_HeaderFile diff --git a/opencascade/AIS_TexturedShape.hxx b/opencascade/AIS_TexturedShape.hxx index 1dd5bcec6..9e90f7552 100644 --- a/opencascade/AIS_TexturedShape.hxx +++ b/opencascade/AIS_TexturedShape.hxx @@ -64,10 +64,10 @@ public: //! @name main methods //! Please note that the data should be in Bottom-Up order, the flag of Image_PixMap::IsTopDown() //! will be ignored by graphic driver. Setting texture source using this method resets the source //! by filename (if was set previously). - Standard_EXPORT virtual void SetTexturePixMap(const Handle(Image_PixMap)& theTexturePixMap); + Standard_EXPORT virtual void SetTexturePixMap(const occ::handle& theTexturePixMap); //! @return flag to control texture mapping (for presentation mode 3) - Standard_Boolean TextureMapState() const { return myToMapTexture; } + bool TextureMapState() const { return myToMapTexture; } //! Enables texture mapping Standard_EXPORT void SetTextureMapOn(); @@ -76,10 +76,10 @@ public: //! @name main methods Standard_EXPORT void SetTextureMapOff(); //! @return path to the texture file - Standard_CString TextureFile() const { return myTextureFile.ToCString(); } + const char* TextureFile() const { return myTextureFile.ToCString(); } //! @return the source pixmap for texture map - const Handle(Image_PixMap)& TexturePixMap() const { return myTexturePixMap; } + const occ::handle& TexturePixMap() const { return myTexturePixMap; } public: //! @name methods to alter texture mapping properties //! Use this method to display the textured shape without recomputing the whole presentation. @@ -93,24 +93,23 @@ public: //! @name methods to alter texture mapping properties //! } //! else //! { - //! myAISContext->SetDisplayMode (myShape, 3, Standard_False); - //! myAISContext->Display (myShape, Standard_True); + //! myAISContext->SetDisplayMode (myShape, 3, false); + //! myAISContext->Display (myShape, true); //! } //! @endcode Standard_EXPORT void UpdateAttributes(); //! Sets the color. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Removes settings for the color. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; //! Sets the material aspect. - Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theAspect) - Standard_OVERRIDE; + Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& theAspect) override; //! Removes settings for material aspect. - Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE; + Standard_EXPORT void UnsetMaterial() override; //! Enables texture modulation Standard_EXPORT void EnableTextureModulate(); @@ -119,98 +118,93 @@ public: //! @name methods to alter texture mapping properties Standard_EXPORT void DisableTextureModulate(); //! @return texture repeat flag - Standard_Boolean TextureRepeat() const { return myToRepeat; } + bool TextureRepeat() const { return myToRepeat; } //! @return texture repeat U value - Standard_Real URepeat() const { return myUVRepeat.X(); } + double URepeat() const { return myUVRepeat.X(); } //! @return texture repeat V value - Standard_Real VRepeat() const { return myUVRepeat.Y(); } + double VRepeat() const { return myUVRepeat.Y(); } //! Sets the number of occurrences of the texture on each face. The texture itself is //! parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV //! space (Umin,Umax) by (Vmin,Vmax). If RepeatYN is set to false, texture coordinates are clamped //! in the range (0,1)x(0,1) of the face. - Standard_EXPORT void SetTextureRepeat(const Standard_Boolean theToRepeat, - const Standard_Real theURepeat = 1.0, - const Standard_Real theVRepeat = 1.0); + Standard_EXPORT void SetTextureRepeat(const bool theToRepeat, + const double theURepeat = 1.0, + const double theVRepeat = 1.0); //! @return true if texture UV origin has been modified - Standard_Boolean TextureOrigin() const { return myIsCustomOrigin; } + bool TextureOrigin() const { return myIsCustomOrigin; } //! @return texture origin U position (0.0 by default) - Standard_Real TextureUOrigin() const { return myUVOrigin.X(); } + double TextureUOrigin() const { return myUVOrigin.X(); } //! @return texture origin V position (0.0 by default) - Standard_Real TextureVOrigin() const { return myUVOrigin.Y(); } + double TextureVOrigin() const { return myUVOrigin.Y(); } //! Use this method to change the origin of the texture. The texel (0,0) will be mapped to the //! surface (UOrigin,VOrigin) - Standard_EXPORT void SetTextureOrigin(const Standard_Boolean theToSetTextureOrigin, - const Standard_Real theUOrigin = 0.0, - const Standard_Real theVOrigin = 0.0); + Standard_EXPORT void SetTextureOrigin(const bool theToSetTextureOrigin, + const double theUOrigin = 0.0, + const double theVOrigin = 0.0); //! @return true if scale factor should be applied to texture mapping - Standard_Boolean TextureScale() const { return myToScale; } + bool TextureScale() const { return myToScale; } //! @return scale factor for U coordinate (1.0 by default) - Standard_Real TextureScaleU() const { return myUVScale.X(); } + double TextureScaleU() const { return myUVScale.X(); } //! @return scale factor for V coordinate (1.0 by default) - Standard_Real TextureScaleV() const { return myUVScale.Y(); } + double TextureScaleV() const { return myUVScale.Y(); } //! Use this method to scale the texture (percent of the face). //! You can specify a scale factor for both U and V. //! Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat, //! the texture will appear twice on the face in each direction. - Standard_EXPORT void SetTextureScale(const Standard_Boolean theToSetTextureScale, - const Standard_Real theScaleU = 1.0, - const Standard_Real theScaleV = 1.0); + Standard_EXPORT void SetTextureScale(const bool theToSetTextureScale, + const double theScaleU = 1.0, + const double theScaleV = 1.0); //! @return true if displaying of triangles is requested - Standard_Boolean ShowTriangles() const { return myToShowTriangles; } + bool ShowTriangles() const { return myToShowTriangles; } //! Use this method to show the triangulation of the shape (for debugging etc.). - Standard_EXPORT void ShowTriangles(const Standard_Boolean theToShowTriangles); + Standard_EXPORT void ShowTriangles(const bool theToShowTriangles); //! @return true if texture color modulation is turned on - Standard_Boolean TextureModulate() const { return myModulate; } + bool TextureModulate() const { return myModulate; } //! Return true if specified display mode is supported (extends AIS_Shape with Display Mode 3). - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode >= 0 && theMode <= 3; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode >= 0 && theMode <= 3; } protected: //! @name overridden methods //! Compute presentation with texture mapping support. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; - Standard_EXPORT void updateAttributes(const Handle(Prs3d_Presentation)& thePrs); + Standard_EXPORT void updateAttributes(const occ::handle& thePrs); protected: //! @name presentation fields - Handle(Graphic3d_Texture2D) myTexture; - Handle(Graphic3d_AspectFillArea3d) myAspect; + occ::handle myTexture; + occ::handle myAspect; protected: //! @name texture source fields - Handle(Image_PixMap) myTexturePixMap; + occ::handle myTexturePixMap; TCollection_AsciiString myTextureFile; Graphic3d_NameOfTexture2D myPredefTexture; protected: //! @name texture mapping properties - Standard_Boolean myToMapTexture; - Standard_Boolean myModulate; - Standard_Boolean myIsCustomOrigin; - Standard_Boolean myToRepeat; - Standard_Boolean myToScale; - Standard_Boolean myToShowTriangles; + bool myToMapTexture; + bool myModulate; + bool myIsCustomOrigin; + bool myToRepeat; + bool myToScale; + bool myToShowTriangles; public: DEFINE_STANDARD_RTTIEXT(AIS_TexturedShape, AIS_Shape) }; -DEFINE_STANDARD_HANDLE(AIS_TexturedShape, AIS_Shape) - #endif // _AIS_TexturedShape_HeaderFile diff --git a/opencascade/AIS_Triangulation.hxx b/opencascade/AIS_Triangulation.hxx index a2ddb91fc..50dfcd5e7 100644 --- a/opencascade/AIS_Triangulation.hxx +++ b/opencascade/AIS_Triangulation.hxx @@ -16,14 +16,14 @@ #ifndef _AIS_Triangulation_HeaderFile #define _AIS_Triangulation_HeaderFile -#include +#include +#include +#include #include class Poly_Triangulation; -DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject) - -//! Interactive object that draws data from Poly_Triangulation, optionally with colors associated +//! Interactive object that draws data from Poly_Triangulation, optionally with colors associated //! with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers //! instead of classic Quantity_Color values. //! Interactive selection of triangles and vertices is not yet implemented. @@ -32,41 +32,41 @@ class AIS_Triangulation : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_Triangulation, AIS_InteractiveObject) public: //! Constructs the Triangulation display object - Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation); + Standard_EXPORT AIS_Triangulation(const occ::handle& aTriangulation); //! Set the color for each node. //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red //! Order of color components is essential for further usage by OpenGL - Standard_EXPORT void SetColors(const Handle(TColStd_HArray1OfInteger)& aColor); + Standard_EXPORT void SetColors(const occ::handle>& aColor); //! Get the color for each node. //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red - Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetColors() const; + Standard_EXPORT occ::handle> GetColors() const; //! Returns true if triangulation has vertex colors. - Standard_Boolean HasVertexColors() const { return (myFlagColor == 1); } + bool HasVertexColors() const { return (myFlagColor == 1); } - Standard_EXPORT void SetTriangulation(const Handle(Poly_Triangulation)& aTriangulation); + Standard_EXPORT void SetTriangulation(const occ::handle& aTriangulation); //! Returns Poly_Triangulation . - Standard_EXPORT Handle(Poly_Triangulation) GetTriangulation() const; + Standard_EXPORT occ::handle GetTriangulation() const; //! Sets the value aValue for transparency in the reconstructed compound shape. - Standard_EXPORT virtual void SetTransparency(const Standard_Real aValue = 0.6) Standard_OVERRIDE; + Standard_EXPORT void SetTransparency(const double aValue = 0.6) override; //! Removes the setting for transparency in the reconstructed compound shape. - Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; + Standard_EXPORT void UnsetTransparency() override; protected: Standard_EXPORT void updatePresentation(); private: - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; //! Attenuates 32-bit color by a given attenuation factor (0...1): //! aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red @@ -74,14 +74,14 @@ private: //! integer. Color attenuation is applied to the vertex colors in order to have correct visual //! result after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and //! flat. - Standard_EXPORT Graphic3d_Vec4ub attenuateColor(const Standard_Integer theColor, - const Standard_Real theComponent); - - Handle(Poly_Triangulation) myTriangulation; - Handle(TColStd_HArray1OfInteger) myColor; - Standard_Integer myFlagColor; - Standard_Integer myNbNodes; - Standard_Integer myNbTriangles; + Standard_EXPORT NCollection_Vec4 attenuateColor(const int theColor, + const double theComponent); + + occ::handle myTriangulation; + occ::handle> myColor; + int myFlagColor; + int myNbNodes; + int myNbTriangles; }; #endif // _AIS_Triangulation_HeaderFile diff --git a/opencascade/AIS_Trihedron.hxx b/opencascade/AIS_Trihedron.hxx index 760fcbc98..ddc8c4720 100644 --- a/opencascade/AIS_Trihedron.hxx +++ b/opencascade/AIS_Trihedron.hxx @@ -53,7 +53,7 @@ class AIS_Trihedron : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject) public: //! Initializes a trihedron entity. - Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& theComponent); + Standard_EXPORT AIS_Trihedron(const occ::handle& theComponent); //! Returns datum display mode. Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; } @@ -62,20 +62,20 @@ public: void SetDatumDisplayMode(Prs3d_DatumMode theMode) { myTrihDispMode = theMode; } //! Returns the right-handed coordinate system set in SetComponent. - const Handle(Geom_Axis2Placement)& Component() const { return myComponent; } + const occ::handle& Component() const { return myComponent; } //! Constructs the right-handed coordinate system aComponent. - Standard_EXPORT void SetComponent(const Handle(Geom_Axis2Placement)& theComponent); + Standard_EXPORT void SetComponent(const occ::handle& theComponent); //! Returns true if the trihedron object has a size other //! than the default size of 100 mm. along each axis. - Standard_Boolean HasOwnSize() const { return myHasOwnSize; } + bool HasOwnSize() const { return myHasOwnSize; } //! Returns the size of trihedron object; 100.0 by DEFAULT. - Standard_EXPORT Standard_Real Size() const; + Standard_EXPORT double Size() const; //! Sets the size of trihedron object. - Standard_EXPORT void SetSize(const Standard_Real theValue); + Standard_EXPORT void SetSize(const double theValue); //! Removes any non-default settings for size of this trihedron object. //! If the object has 1 color, the default size of the @@ -83,7 +83,7 @@ public: Standard_EXPORT void UnsetSize(); //! Returns true if trihedron has own text color - Standard_Boolean HasTextColor() const { return myHasOwnTextColor; } + bool HasTextColor() const { return myHasOwnTextColor; } //! Returns trihedron text color Standard_EXPORT Quantity_Color TextColor() const; @@ -95,7 +95,7 @@ public: Standard_EXPORT void SetTextColor(const Prs3d_DatumParts thePart, const Quantity_Color& theColor); //! Returns true if trihedron has own arrow color - Standard_Boolean HasArrowColor() const { return myHasOwnArrowColor; } + bool HasArrowColor() const { return myHasOwnArrowColor; } //! Returns trihedron arrow color Standard_EXPORT Quantity_Color ArrowColor() const; @@ -131,19 +131,16 @@ public: Standard_EXPORT void SetAxisColor(const Quantity_Color& theColor); //! Returns true if arrows are to be drawn - Standard_EXPORT Standard_Boolean ToDrawArrows() const; + Standard_EXPORT bool ToDrawArrows() const; //! Sets whether to draw the arrows in visualization - Standard_EXPORT void SetDrawArrows(const Standard_Boolean theToDraw); + Standard_EXPORT void SetDrawArrows(const bool theToDraw); //! Returns priority of selection for owner of the given type - Standard_Integer SelectionPriority(Prs3d_DatumParts thePart) - { - return mySelectionPriority[thePart]; - } + int SelectionPriority(Prs3d_DatumParts thePart) { return mySelectionPriority[thePart]; } //! Sets priority of selection for owner of the given type - void SetSelectionPriority(Prs3d_DatumParts thePart, Standard_Integer thePriority) + void SetSelectionPriority(Prs3d_DatumParts thePart, int thePriority) { mySelectionPriority[thePart] = thePriority; } @@ -159,102 +156,93 @@ public: public: //! Sets the color theColor for this trihedron object, it changes color of axes. - Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE; + Standard_EXPORT void SetColor(const Quantity_Color& theColor) override; //! Returns true if the display mode selected, aMode, is valid for trihedron datums. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Returns index 3, selection of the planes XOY, YOZ, XOZ. - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; } + int Signature() const override { return 3; } //! Indicates that the type of Interactive Object is datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE - { - return AIS_KindOfInteractive_Datum; - } + AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; } //! Removes the settings for color. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() override; public: //! Method which clear all selected owners belonging - //! to this selectable object ( for fast presentation draw ). - Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE; + //! to this selectable object (for fast presentation draw). + Standard_EXPORT void ClearSelected() override; - //! Method which draws selected owners ( for fast presentation draw ). - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM, - const SelectMgr_SequenceOfOwner& theOwners) - Standard_OVERRIDE; + //! Method which draws selected owners (for fast presentation draw). + Standard_EXPORT void HilightSelected( + const occ::handle& thePM, + const NCollection_Sequence>& theOwners) override; - //! Method which hilight an owner belonging to - //! this selectable object ( for fast presentation draw ). - Standard_EXPORT virtual void HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE; + //! Method which highlights an owner belonging to + //! this selectable object (for fast presentation draw). + Standard_EXPORT void HilightOwnerWithColor( + const occ::handle& thePM, + const occ::handle& theStyle, + const occ::handle& theOwner) override; protected: //! Compute trihedron presentation. - Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; protected: //! Creates a sensitive entity for the datum part that will be used in selection owner creation. - Standard_EXPORT Handle(Select3D_SensitiveEntity) createSensitiveEntity( - const Prs3d_DatumParts thePart, - const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT occ::handle createSensitiveEntity( + const Prs3d_DatumParts thePart, + const occ::handle& theOwner) const; //! Computes presentation for display mode equal 1. - Standard_EXPORT void computePresentation(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs); + Standard_EXPORT void computePresentation(const occ::handle& thePrsMgr, + const occ::handle& thePrs); //! Returns own datum aspect of trihedron, create this aspect if it was not created yet. Standard_EXPORT void setOwnDatumAspect(); //! Returns primitives. - const Handle(Graphic3d_ArrayOfPrimitives)& arrayOfPrimitives(Prs3d_DatumParts thePart) const + const occ::handle& arrayOfPrimitives(Prs3d_DatumParts thePart) const { return myPrimitives[thePart]; } //! Updates graphic groups for the current datum mode //! Parameters of datum position and orientation - Standard_EXPORT void updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, - Prs3d_DatumMode theMode, - const gp_Pnt& theOrigin, - const gp_Dir& theXDir, - const gp_Dir& theYDir, - const gp_Dir& theZDir); + Standard_EXPORT void updatePrimitives(const occ::handle& theAspect, + Prs3d_DatumMode theMode, + const gp_Pnt& theOrigin, + const gp_Dir& theXDir, + const gp_Dir& theYDir, + const gp_Dir& theZDir); protected: - Handle(Geom_Axis2Placement) myComponent; - Prs3d_DatumMode myTrihDispMode; - Standard_Boolean myHasOwnSize; - Standard_Boolean myHasOwnTextColor; - Standard_Boolean myHasOwnArrowColor; + occ::handle myComponent; + Prs3d_DatumMode myTrihDispMode; + bool myHasOwnSize; + bool myHasOwnTextColor; + bool myHasOwnArrowColor; TCollection_ExtendedString myLabels[Prs3d_DatumParts_NB]; - Standard_Integer mySelectionPriority[Prs3d_DatumParts_NB]; + int mySelectionPriority[Prs3d_DatumParts_NB]; - Handle(Graphic3d_Group) myPartToGroup[Prs3d_DatumParts_NB]; - NCollection_List mySelectedParts; - Handle(Graphic3d_AspectLine3d) myHiddenLineAspect; + occ::handle myPartToGroup[Prs3d_DatumParts_NB]; + NCollection_List mySelectedParts; + occ::handle myHiddenLineAspect; - Handle(Graphic3d_ArrayOfPrimitives) myPrimitives[Prs3d_DatumParts_NB]; + occ::handle myPrimitives[Prs3d_DatumParts_NB]; }; -DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject) - #endif // _AIS_Trihedron_HeaderFile diff --git a/opencascade/AIS_TrihedronOwner.hxx b/opencascade/AIS_TrihedronOwner.hxx index 3ddc1eefb..78d1fdb0c 100644 --- a/opencascade/AIS_TrihedronOwner.hxx +++ b/opencascade/AIS_TrihedronOwner.hxx @@ -25,33 +25,30 @@ class AIS_TrihedronOwner : public SelectMgr_EntityOwner DEFINE_STANDARD_RTTIEXT(AIS_TrihedronOwner, SelectMgr_EntityOwner) public: //! Creates an owner of AIS_Trihedron object. - Standard_EXPORT AIS_TrihedronOwner(const Handle(SelectMgr_SelectableObject)& theSelObject, - const Prs3d_DatumParts theDatumPart, - const Standard_Integer thePriority); + Standard_EXPORT AIS_TrihedronOwner(const occ::handle& theSelObject, + const Prs3d_DatumParts theDatumPart, + const int thePriority); //! Returns the datum part identifier. Prs3d_DatumParts DatumPart() const { return myDatumPart; } //! Highlights selectable object's presentation. - Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void HilightWithColor(const occ::handle& thePM, + const occ::handle& theStyle, + const int theMode) override; //! Returns true if the presentation manager thePM //! highlights selections corresponding to the selection mode aMode. - Standard_EXPORT Standard_Boolean - IsHilighted(const Handle(PrsMgr_PresentationManager)& thePM, - const Standard_Integer theMode) const Standard_OVERRIDE; + Standard_EXPORT bool IsHilighted(const occ::handle& thePM, + const int theMode) const override; //! Removes highlighting from the owner of a detected //! selectable object in the presentation manager thePM. - Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePM, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Unhilight(const occ::handle& thePM, + const int theMode) override; protected: Prs3d_DatumParts myDatumPart; //!< part of datum selected }; -DEFINE_STANDARD_HANDLE(AIS_TrihedronOwner, SelectMgr_EntityOwner) - #endif // _AIS_TrihedronOwner_HeaderFile diff --git a/opencascade/AIS_TypeFilter.hxx b/opencascade/AIS_TypeFilter.hxx index 2ef242254..51f98165c 100644 --- a/opencascade/AIS_TypeFilter.hxx +++ b/opencascade/AIS_TypeFilter.hxx @@ -24,15 +24,12 @@ #include class SelectMgr_EntityOwner; -class AIS_TypeFilter; -DEFINE_STANDARD_HANDLE(AIS_TypeFilter, SelectMgr_Filter) - //! Selects Interactive Objects through their types. The //! filter questions each Interactive Object in local context //! to determine whether it has an non-null owner, and if //! so, whether it is of the desired type. If the object //! returns true in each case, it is kept. If not, it is rejected. -//! By default, the interactive object has a None type +//! By default, the interactive object has a None type //! and a signature of 0. A filter for type specifies a //! choice of type out of a range at any level enumerated //! for type or kind. The choice could be for kind of @@ -40,7 +37,7 @@ DEFINE_STANDARD_HANDLE(AIS_TypeFilter, SelectMgr_Filter) //! plane or attribute. //! If you want to give a particular type and signature to //! your Interactive Object, you must redefine two virtual -//! methods: Type and Signature. +//! methods: Type and Signature. //! This filter is used in both Neutral Point and open local contexts. //! In the Collector viewer, you can only locate //! Interactive Objects which answer positively to the @@ -60,15 +57,12 @@ public: //! Returns False if the transient is not an Interactive //! Object, or if the type of the Interactive Object is not //! the same as that stored in the filter. - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const - Standard_OVERRIDE; + Standard_EXPORT bool IsOk(const occ::handle& anobj) const override; DEFINE_STANDARD_RTTIEXT(AIS_TypeFilter, SelectMgr_Filter) protected: AIS_KindOfInteractive myKind; - -private: }; #endif // _AIS_TypeFilter_HeaderFile diff --git a/opencascade/AIS_ViewController.hxx b/opencascade/AIS_ViewController.hxx index 116ec4f9d..f97db9e43 100644 --- a/opencascade/AIS_ViewController.hxx +++ b/opencascade/AIS_ViewController.hxx @@ -25,12 +25,13 @@ #include #include -#include +#include +#include +#include #include #include #include #include -#include class AIS_Animation; class AIS_AnimationCamera; @@ -50,7 +51,7 @@ class WNT_HIDSpaceMouse; //! - Mapping mouse/multi-touch input to View camera manipulations (panning/rotating/zooming). //! - Input events are not applied immediately but queued for separate processing from two working //! threads -//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing. +//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing. class AIS_ViewController : public Aspect_WindowInputListener { public: @@ -58,7 +59,7 @@ public: Standard_EXPORT AIS_ViewController(); //! Destructor. - Standard_EXPORT virtual ~AIS_ViewController(); + Standard_EXPORT ~AIS_ViewController() override; //! Return input buffer. const AIS_ViewInputBuffer& InputBuffer(AIS_ViewInputBufferType theType) const @@ -73,10 +74,10 @@ public: } //! Return view animation; empty (but not NULL) animation by default. - const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; } + const occ::handle& ViewAnimation() const { return myViewAnimation; } //! Set view animation to be handled within handleViewRedraw(). - void SetViewAnimation(const Handle(AIS_AnimationCamera)& theAnimation) + void SetViewAnimation(const occ::handle& theAnimation) { myViewAnimation = theAnimation; } @@ -85,10 +86,10 @@ public: Standard_EXPORT void AbortViewAnimation(); //! Return objects animation; empty (but not NULL) animation by default. - const Handle(AIS_Animation)& ObjectsAnimation() const { return myObjAnimation; } + const occ::handle& ObjectsAnimation() const { return myObjAnimation; } //! Set object animation to be handled within handleViewRedraw(). - void SetObjectsAnimation(const Handle(AIS_Animation)& theAnimation) + void SetObjectsAnimation(const occ::handle& theAnimation) { myObjAnimation = theAnimation; } @@ -235,13 +236,13 @@ public: //! @name global parameters void SetThrustSpeed(float theSpeed) { myThrustSpeed = theSpeed; } //! Return TRUE if previous position of MoveTo has been defined. - bool HasPreviousMoveTo() const { return myPrevMoveTo != Graphic3d_Vec2i(-1); } + bool HasPreviousMoveTo() const { return myPrevMoveTo != NCollection_Vec2(-1); } //! Return previous position of MoveTo event in 3D viewer. - const Graphic3d_Vec2i& PreviousMoveTo() const { return myPrevMoveTo; } + const NCollection_Vec2& PreviousMoveTo() const { return myPrevMoveTo; } //! Reset previous position of MoveTo. - void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i(-1); } + void ResetPreviousMoveTo() { myPrevMoveTo = NCollection_Vec2(-1); } //! Return TRUE to display auxiliary tracked XR devices (like tracking stations). bool ToDisplayXRAuxDevices() const { return myToDisplayXRAuxDevices; } @@ -263,42 +264,50 @@ public: //! @name keyboard input //! Default implementation updates internal cache. //! @param theKey key pressed //! @param theTime event timestamp - Standard_EXPORT virtual void KeyDown(Aspect_VKey theKey, - double theTime, - double thePressure = 1.0) Standard_OVERRIDE; + Standard_EXPORT void KeyDown(Aspect_VKey theKey, + double theTime, + double thePressure = 1.0) override; //! Release key. //! Default implementation updates internal cache. //! @param theKey key pressed //! @param theTime event timestamp - Standard_EXPORT virtual void KeyUp(Aspect_VKey theKey, double theTime) Standard_OVERRIDE; + Standard_EXPORT void KeyUp(Aspect_VKey theKey, double theTime) override; //! Simulate key up/down events from axis value. //! Default implementation updates internal cache. - Standard_EXPORT virtual void KeyFromAxis(Aspect_VKey theNegative, - Aspect_VKey thePositive, - double theTime, - double thePressure) Standard_OVERRIDE; + Standard_EXPORT void KeyFromAxis(Aspect_VKey theNegative, + Aspect_VKey thePositive, + double theTime, + double thePressure) override; //! Fetch active navigation actions. - Standard_EXPORT AIS_WalkDelta FetchNavigationKeys(Standard_Real theCrouchRatio, - Standard_Real theRunRatio); + Standard_EXPORT AIS_WalkDelta FetchNavigationKeys(double theCrouchRatio, double theRunRatio); public: //! @name mouse input //! Return map defining mouse gestures. - const AIS_MouseGestureMap& MouseGestureMap() const { return myMouseGestureMap; } + const NCollection_DataMap& MouseGestureMap() const + { + return myMouseGestureMap; + } //! Return map defining mouse gestures. - AIS_MouseGestureMap& ChangeMouseGestureMap() { return myMouseGestureMap; } + NCollection_DataMap& ChangeMouseGestureMap() + { + return myMouseGestureMap; + } //! Return map defining mouse selection schemes. - const AIS_MouseSelectionSchemeMap& MouseSelectionSchemes() const + const NCollection_DataMap& MouseSelectionSchemes() const { return myMouseSelectionSchemes; } //! Return map defining mouse gestures. - AIS_MouseSelectionSchemeMap& ChangeMouseSelectionSchemes() { return myMouseSelectionSchemes; } + NCollection_DataMap& ChangeMouseSelectionSchemes() + { + return myMouseSelectionSchemes; + } //! Return double click interval in seconds; 0.4 by default. double MouseDoubleClickInterval() const { return myMouseDoubleClickInt; } @@ -311,29 +320,30 @@ public: //! @name mouse input //! @param thePnt picking point //! @param theScheme selection scheme Standard_EXPORT virtual void SelectInViewer( - const Graphic3d_Vec2i& thePnt, - const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace); + const NCollection_Vec2& thePnt, + const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace); //! Perform selection in 3D viewer. //! This method is expected to be called from UI thread. //! @param thePnts picking point //! @param theScheme selection scheme Standard_EXPORT virtual void SelectInViewer( - const NCollection_Sequence& thePnts, - const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace); + const NCollection_Sequence>& thePnts, + const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace); //! Update rectangle selection tool. //! This method is expected to be called from UI thread. //! @param thePntFrom rectangle first corner //! @param thePntTo rectangle another corner - Standard_EXPORT virtual void UpdateRubberBand(const Graphic3d_Vec2i& thePntFrom, - const Graphic3d_Vec2i& thePntTo); + Standard_EXPORT virtual void UpdateRubberBand(const NCollection_Vec2& thePntFrom, + const NCollection_Vec2& thePntTo); //! Update polygonal selection tool. //! This method is expected to be called from UI thread. //! @param thePnt new point to add to polygon //! @param theToAppend append new point or update the last point - Standard_EXPORT virtual void UpdatePolySelection(const Graphic3d_Vec2i& thePnt, bool theToAppend); + Standard_EXPORT virtual void UpdatePolySelection(const NCollection_Vec2& thePnt, + bool theToAppend); //! Update zoom event (e.g. from mouse scroll). //! This method is expected to be called from UI thread. @@ -350,8 +360,7 @@ public: //! @name mouse input //! This method is expected to be called from UI thread. //! @param theDelta mouse cursor position and delta //! @return TRUE if new event has been created or FALSE if existing one has been updated - Standard_EXPORT virtual bool UpdateMouseScroll(const Aspect_ScrollDelta& theDelta) - Standard_OVERRIDE; + Standard_EXPORT bool UpdateMouseScroll(const Aspect_ScrollDelta& theDelta) override; //! Handle mouse button press/release event. //! This method is expected to be called from UI thread. @@ -361,10 +370,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if View should be redrawn - Standard_EXPORT virtual bool UpdateMouseButtons(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButtons, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) Standard_OVERRIDE; + Standard_EXPORT bool UpdateMouseButtons(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButtons, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) override; //! Handle mouse cursor movement event. //! This method is expected to be called from UI thread. @@ -374,10 +383,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if View should be redrawn - Standard_EXPORT virtual bool UpdateMousePosition(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButtons, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) Standard_OVERRIDE; + Standard_EXPORT bool UpdateMousePosition(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButtons, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) override; //! Handle mouse button click event (emulated by UpdateMouseButtons() while releasing single //! button). Note that as this method is called by UpdateMouseButtons(), it should be executed @@ -388,10 +397,10 @@ public: //! @name mouse input //! @param theModifiers key modifiers //! @param theIsDoubleClick flag indicating double mouse click //! @return TRUE if View should be redrawn - Standard_EXPORT virtual bool UpdateMouseClick(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButton, - Aspect_VKeyFlags theModifiers, - bool theIsDoubleClick); + Standard_EXPORT virtual bool UpdateMouseClick(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButton, + Aspect_VKeyFlags theModifiers, + bool theIsDoubleClick); using Aspect_WindowInputListener::PressMouseButton; using Aspect_WindowInputListener::ReleaseMouseButton; @@ -413,51 +422,48 @@ public: //! @name multi-touch input //! @param theId touch unique identifier //! @param thePnt touch coordinates //! @param theClearBefore if TRUE previously registered touches will be removed - Standard_EXPORT virtual void AddTouchPoint(Standard_Size theId, - const Graphic3d_Vec2d& thePnt, - Standard_Boolean theClearBefore = false) - Standard_OVERRIDE; + Standard_EXPORT void AddTouchPoint(size_t theId, + const NCollection_Vec2& thePnt, + bool theClearBefore = false) override; //! Remove touch point with the given ID. //! This method is expected to be called from UI thread. //! @param theId touch unique identifier //! @param theClearSelectPnts if TRUE will initiate clearing of selection points //! @return TRUE if point has been removed - Standard_EXPORT virtual bool RemoveTouchPoint(Standard_Size theId, - Standard_Boolean theClearSelectPnts = false) - Standard_OVERRIDE; + Standard_EXPORT bool RemoveTouchPoint(size_t theId, bool theClearSelectPnts = false) override; //! Update touch point with the given ID. //! If point with specified ID was not registered before, it will be added. //! This method is expected to be called from UI thread. //! @param theId touch unique identifier //! @param thePnt touch coordinates - Standard_EXPORT virtual void UpdateTouchPoint(Standard_Size theId, - const Graphic3d_Vec2d& thePnt) Standard_OVERRIDE; + Standard_EXPORT void UpdateTouchPoint(size_t theId, + const NCollection_Vec2& thePnt) override; using Aspect_WindowInputListener::HasTouchPoints; public: //! @name 3d mouse input //! Process 3d mouse input event (redirects to translation, rotation and keys). - Standard_EXPORT virtual bool Update3dMouse(const WNT_HIDSpaceMouse& theEvent) Standard_OVERRIDE; + Standard_EXPORT bool Update3dMouse(const WNT_HIDSpaceMouse& theEvent) override; public: //! @name resize events //! Handle expose event (window content has been invalidation and should be redrawn). //! Default implementation does nothing. - virtual void ProcessExpose() Standard_OVERRIDE {} + void ProcessExpose() override {} //! Handle window resize event. //! Default implementation does nothing. - virtual void ProcessConfigure(bool theIsResized) Standard_OVERRIDE { (void)theIsResized; } + void ProcessConfigure(bool theIsResized) override { (void)theIsResized; } //! Handle window input event immediately. //! Default implementation does nothing - input events are accumulated in internal buffer until //! explicit FlushViewEvents() call. - virtual void ProcessInput() Standard_OVERRIDE {} + void ProcessInput() override {} //! Handle focus event. //! Default implementation resets cached input state (pressed keys). - virtual void ProcessFocus(bool theIsActivated) Standard_OVERRIDE + void ProcessFocus(bool theIsActivated) override { if (!theIsActivated) { @@ -467,7 +473,7 @@ public: //! @name resize events //! Handle window close event. //! Default implementation does nothing. - virtual void ProcessClose() Standard_OVERRIDE {} + void ProcessClose() override {} public: using Aspect_WindowInputListener::EventTime; @@ -487,31 +493,31 @@ public: //! @param theCtx interactive context //! @param theView active view //! @param theToHandle if TRUE, the HandleViewEvents() will be called - Standard_EXPORT virtual void FlushViewEvents(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - Standard_Boolean theToHandle = Standard_False); + Standard_EXPORT virtual void FlushViewEvents(const occ::handle& theCtx, + const occ::handle& theView, + bool theToHandle = false); //! Process events within rendering thread. - Standard_EXPORT virtual void HandleViewEvents(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void HandleViewEvents(const occ::handle& theCtx, + const occ::handle& theView); public: //! Callback called by handleMoveTo() on Selection in 3D Viewer. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void OnSelectionChanged(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void OnSelectionChanged(const occ::handle& theCtx, + const occ::handle& theView); //! Callback called by handleMoveTo() on dragging object in 3D Viewer. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void OnObjectDragged(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - AIS_DragAction theAction); + Standard_EXPORT virtual void OnObjectDragged(const occ::handle& theCtx, + const occ::handle& theView, + AIS_DragAction theAction); //! Callback called by HandleViewEvents() on Selection of another (sub)view. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void OnSubviewChanged(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theOldView, - const Handle(V3d_View)& theNewView); + Standard_EXPORT virtual void OnSubviewChanged(const occ::handle& theCtx, + const occ::handle& theOldView, + const occ::handle& theNewView); //! Pick closest point under mouse cursor. //! This method is expected to be called from rendering thread. @@ -521,11 +527,11 @@ public: //! @param[in] theCursor mouse cursor //! @param[in] theToStickToPickRay when TRUE, the result point will lie on picking ray //! @return TRUE if result has been found - Standard_EXPORT virtual bool PickPoint(gp_Pnt& thePnt, - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const Graphic3d_Vec2i& theCursor, - bool theToStickToPickRay); + Standard_EXPORT virtual bool PickPoint(gp_Pnt& thePnt, + const occ::handle& theCtx, + const occ::handle& theView, + const NCollection_Vec2& theCursor, + bool theToStickToPickRay); //! Pick closest point by axis. //! This method is expected to be called from rendering thread. @@ -534,21 +540,21 @@ public: //! @param[in] theView active view //! @param[in] theAxis selection axis //! @return TRUE if result has been found - Standard_EXPORT virtual bool PickAxis(gp_Pnt& theTopPnt, - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const gp_Ax1& theAxis); + Standard_EXPORT virtual bool PickAxis(gp_Pnt& theTopPnt, + const occ::handle& theCtx, + const occ::handle& theView, + const gp_Ax1& theAxis); //! Compute rotation gravity center point depending on rotation mode. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual gp_Pnt GravityPoint(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual gp_Pnt GravityPoint(const occ::handle& theCtx, + const occ::handle& theView); //! Modify view camera to fit all objects. //! Default implementation fits either all visible and all selected objects (swapped on each //! call). - Standard_EXPORT virtual void FitAllAuto(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void FitAllAuto(const occ::handle& theCtx, + const occ::handle& theView); public: //! Handle hot-keys defining new camera orientation (Aspect_VKey_ViewTop and similar keys). @@ -556,25 +562,26 @@ public: //! orientation, when specific action key was pressed. This method is expected to be called from //! rendering thread. Standard_EXPORT virtual void handleViewOrientationKeys( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + const occ::handle& theCtx, + const occ::handle& theView); //! Perform navigation (Aspect_VKey_NavForward and similar keys). //! This method is expected to be called from rendering thread. Standard_EXPORT virtual AIS_WalkDelta handleNavigationKeys( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + const occ::handle& theCtx, + const occ::handle& theView); //! Perform immediate camera actions (rotate/zoom/pan) on gesture progress. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleCameraActions(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const AIS_WalkDelta& theWalk); + Standard_EXPORT virtual void handleCameraActions( + const occ::handle& theCtx, + const occ::handle& theView, + const AIS_WalkDelta& theWalk); //! Perform moveto/selection/dragging. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleMoveTo(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleMoveTo(const occ::handle& theCtx, + const occ::handle& theView); //! Return TRUE if another frame should be drawn right after this one. bool toAskNextFrame() const { return myToAskNextFrame; } @@ -592,10 +599,10 @@ public: void setPanningAnchorPoint(const gp_Pnt& thePnt) { myPanPnt3d = thePnt; } //! Handle panning event myGL.Panning. - Standard_EXPORT virtual void handlePanning(const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handlePanning(const occ::handle& theView); //! Handle Z rotation event myGL.ZRotate. - Standard_EXPORT virtual void handleZRotate(const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleZRotate(const occ::handle& theView); //! Return minimal camera distance for zoom operation. double MinZoomDistance() const { return myMinCamDistance; } @@ -605,23 +612,23 @@ public: //! Handle zoom event myGL.ZoomActions. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleZoom(const Handle(V3d_View)& theView, - const Aspect_ScrollDelta& theParams, - const gp_Pnt* thePnt); + Standard_EXPORT virtual void handleZoom(const occ::handle& theView, + const Aspect_ScrollDelta& theParams, + const gp_Pnt* thePnt); //! Handle ZScroll event myGL.ZoomActions. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleZFocusScroll(const Handle(V3d_View)& theView, - const Aspect_ScrollDelta& theParams); + Standard_EXPORT virtual void handleZFocusScroll(const occ::handle& theView, + const Aspect_ScrollDelta& theParams); //! Handle orbital rotation events myGL.OrbitRotation. //! @param theView view to modify //! @param thePnt 3D point to rotate around //! @param theToLockZUp amend camera to exclude roll angle (put camera Up vector to plane //! containing global Z and view direction) - Standard_EXPORT virtual void handleOrbitRotation(const Handle(V3d_View)& theView, - const gp_Pnt& thePnt, - bool theToLockZUp); + Standard_EXPORT virtual void handleOrbitRotation(const occ::handle& theView, + const gp_Pnt& thePnt, + bool theToLockZUp); //! Handle view direction rotation events myGL.ViewRotation. //! This method is expected to be called from rendering thread. @@ -630,59 +637,59 @@ public: //! @param thePitchExtra extra pitch increment //! @param theRoll roll value //! @param theToRestartOnIncrement flag indicating flight mode - Standard_EXPORT virtual void handleViewRotation(const Handle(V3d_View)& theView, - double theYawExtra, - double thePitchExtra, - double theRoll, - bool theToRestartOnIncrement); + Standard_EXPORT virtual void handleViewRotation(const occ::handle& theView, + double theYawExtra, + double thePitchExtra, + double theRoll, + bool theToRestartOnIncrement); //! Handle view redraw. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleViewRedraw(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleViewRedraw(const occ::handle& theCtx, + const occ::handle& theView); public: //! Perform XR input. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleXRInput(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const AIS_WalkDelta& theWalk); + Standard_EXPORT virtual void handleXRInput(const occ::handle& theCtx, + const occ::handle& theView, + const AIS_WalkDelta& theWalk); //! Handle trackpad view turn action. - Standard_EXPORT virtual void handleXRTurnPad(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleXRTurnPad(const occ::handle& theCtx, + const occ::handle& theView); //! Handle trackpad teleportation action. - Standard_EXPORT virtual void handleXRTeleport(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleXRTeleport(const occ::handle& theCtx, + const occ::handle& theView); //! Handle picking on trigger click. - Standard_EXPORT virtual void handleXRPicking(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleXRPicking(const occ::handle& theCtx, + const occ::handle& theView); //! Perform dynamic highlighting for active hand. - Standard_EXPORT virtual void handleXRHighlight(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleXRHighlight(const occ::handle& theCtx, + const occ::handle& theView); //! Display auxiliary XR presentations. - Standard_EXPORT virtual void handleXRPresentations(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleXRPresentations( + const occ::handle& theCtx, + const occ::handle& theView); //! Perform picking with/without dynamic highlighting for XR pose. - Standard_EXPORT virtual Standard_Integer handleXRMoveTo( - const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const gp_Trsf& thePose, - const Standard_Boolean theToHighlight); + Standard_EXPORT virtual int handleXRMoveTo(const occ::handle& theCtx, + const occ::handle& theView, + const gp_Trsf& thePose, + const bool theToHighlight); protected: //! Flush buffers. - Standard_EXPORT virtual void flushBuffers(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void flushBuffers(const occ::handle& theCtx, + const occ::handle& theView); //! Flush touch gestures. - Standard_EXPORT virtual void flushGestures(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void flushGestures(const occ::handle& theCtx, + const occ::handle& theView); //! Return current and previously fetched event times. //! This callback is intended to compute delta between sequentially processed events. @@ -697,69 +704,72 @@ protected: //! Perform selection via mouse click. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleSelectionPick(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleSelectionPick( + const occ::handle& theCtx, + const occ::handle& theView); //! Perform dynamic highlight on mouse move. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleDynamicHighlight(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleDynamicHighlight( + const occ::handle& theCtx, + const occ::handle& theView); //! Perform rubber-band selection. //! This method is expected to be called from rendering thread. - Standard_EXPORT virtual void handleSelectionPoly(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView); + Standard_EXPORT virtual void handleSelectionPoly( + const occ::handle& theCtx, + const occ::handle& theView); //! Lazy AIS_InteractiveContext::MoveTo() with myPrevMoveTo check. - Standard_EXPORT virtual void contextLazyMoveTo(const Handle(AIS_InteractiveContext)& theCtx, - const Handle(V3d_View)& theView, - const Graphic3d_Vec2i& thePnt); + Standard_EXPORT virtual void contextLazyMoveTo(const occ::handle& theCtx, + const occ::handle& theView, + const NCollection_Vec2& thePnt); protected: AIS_ViewInputBuffer myUI; //!< buffer for UI thread AIS_ViewInputBuffer myGL; //!< buffer for rendering thread // clang-format off - Standard_Real myLastEventsTime; //!< last fetched events timer value for computing delta/progress - Standard_Boolean myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one - Standard_Boolean myIsContinuousRedraw; //!< continuous redrawing (without immediate rendering optimization) + double myLastEventsTime; //!< last fetched events timer value for computing delta/progress + bool myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one + bool myIsContinuousRedraw; //!< continuous redrawing (without immediate rendering optimization) - Standard_Real myMinCamDistance; //!< minimal camera distance for zoom operation + double myMinCamDistance; //!< minimal camera distance for zoom operation AIS_RotationMode myRotationMode; //!< rotation mode AIS_NavigationMode myNavigationMode; //!< navigation mode (orbit rotation / first person) - Standard_ShortReal myMouseAccel; //!< mouse input acceleration ratio in First Person mode - Standard_ShortReal myOrbitAccel; //!< Orbit rotation acceleration ratio - Standard_Boolean myToShowPanAnchorPoint; //!< option displaying panning anchor point - Standard_Boolean myToShowRotateCenter; //!< option displaying rotation center point - Standard_Boolean myToLockOrbitZUp; //!< force camera up orientation within AIS_NavigationMode_Orbit rotation mode - Standard_Boolean myToInvertPitch; //!< flag inverting pitch direction while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown - Standard_Boolean myToAllowTouchZRotation; //!< enable z-rotation two-touches gesture; FALSE by default - Standard_Boolean myToAllowRotation; //!< enable rotation; TRUE by default - Standard_Boolean myToAllowPanning; //!< enable panning; TRUE by default - Standard_Boolean myToAllowZooming; //!< enable zooming; TRUE by default - Standard_Boolean myToAllowZFocus; //!< enable ZFocus change; TRUE by default - Standard_Boolean myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default - Standard_Boolean myToAllowDragging; //!< enable dragging object; TRUE by default - Standard_Boolean myToStickToRayOnZoom; //!< project picked point to ray while zooming at point, TRUE by default - Standard_Boolean myToStickToRayOnRotation; //!< project picked point to ray while rotating around point; TRUE by default - - Standard_ShortReal myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default - Standard_ShortReal myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default - Standard_ShortReal myThrustSpeed; //!< active thrust value - Standard_Boolean myHasThrust; //!< flag indicating active thrust - - Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation - Handle(AIS_Animation) myObjAnimation; //!< objects animation - Standard_Boolean myToPauseObjAnimation; //!< flag to pause objects animation on mouse click; FALSE by default - Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation - Handle(SelectMgr_EntityOwner) myDragOwner; //!< detected owner of currently dragged object - Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object - Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer - Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation + float myMouseAccel; //!< mouse input acceleration ratio in First Person mode + float myOrbitAccel; //!< Orbit rotation acceleration ratio + bool myToShowPanAnchorPoint; //!< option displaying panning anchor point + bool myToShowRotateCenter; //!< option displaying rotation center point + bool myToLockOrbitZUp; //!< force camera up orientation within AIS_NavigationMode_Orbit rotation mode + bool myToInvertPitch; //!< flag inverting pitch direction while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown + bool myToAllowTouchZRotation; //!< enable z-rotation two-touches gesture; FALSE by default + bool myToAllowRotation; //!< enable rotation; TRUE by default + bool myToAllowPanning; //!< enable panning; TRUE by default + bool myToAllowZooming; //!< enable zooming; TRUE by default + bool myToAllowZFocus; //!< enable ZFocus change; TRUE by default + bool myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default + bool myToAllowDragging; //!< enable dragging object; TRUE by default + bool myToStickToRayOnZoom; //!< project picked point to ray while zooming at point, TRUE by default + bool myToStickToRayOnRotation; //!< project picked point to ray while rotating around point; TRUE by default + + float myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default + float myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default + float myThrustSpeed; //!< active thrust value + bool myHasThrust; //!< flag indicating active thrust + + occ::handle myViewAnimation; //!< view animation + occ::handle myObjAnimation; //!< objects animation + bool myToPauseObjAnimation; //!< flag to pause objects animation on mouse click; FALSE by default + occ::handle myRubberBand; //!< Rubber-band presentation + occ::handle myDragOwner; //!< detected owner of currently dragged object + occ::handle myDragObject; //!< currently dragged object + NCollection_Vec2 myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer + bool myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation protected: //! @name XR input variables - NCollection_Array1 myXRPrsDevices; //!< array of XR tracked devices presentations + NCollection_Array1> myXRPrsDevices; //!< array of XR tracked devices presentations // clang-format on Quantity_Color myXRLaserTeleColor; //!< color of teleport laser Quantity_Color myXRLaserPickColor; //!< color of picking laser @@ -768,57 +778,57 @@ protected: //! @name XR input variables Aspect_XRHapticActionData myXRTeleportHaptic; //!< vibration on picking teleport destination Aspect_XRHapticActionData myXRPickingHaptic; //!< vibration on dynamic highlighting Aspect_XRHapticActionData myXRSelectHaptic; //!< vibration on selection - Standard_Real myXRLastPickDepthLeft; //!< last picking depth for left hand - Standard_Real myXRLastPickDepthRight; //!< last picking depth for right hand - Standard_Real myXRTurnAngle; //!< discrete turn angle for XR trackpad + double myXRLastPickDepthLeft; //!< last picking depth for left hand + double myXRLastPickDepthRight; //!< last picking depth for right hand + double myXRTurnAngle; //!< discrete turn angle for XR trackpad // clang-format off - Standard_Boolean myToDisplayXRAuxDevices; //!< flag to display auxiliary tracked XR devices - Standard_Boolean myToDisplayXRHands; //!< flag to display XR hands + bool myToDisplayXRAuxDevices; //!< flag to display auxiliary tracked XR devices + bool myToDisplayXRHands; //!< flag to display XR hands protected: //! @name mouse input variables - Standard_Real myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default - Standard_Real myMouseDoubleClickInt; //!< double click interval in seconds; 0.4 by default - Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default + double myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default + double myMouseDoubleClickInt; //!< double click interval in seconds; 0.4 by default + float myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default - AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures - AIS_MouseGestureMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging + NCollection_DataMap myMouseGestureMap; //!< map defining mouse gestures + NCollection_DataMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button) - AIS_MouseSelectionSchemeMap + NCollection_DataMap myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers - Standard_Boolean myMouseActiveIdleRotation; //!< flag indicating view idle rotation state - Graphic3d_Vec2i myMousePressPoint; //!< mouse position where active gesture was been initiated - Graphic3d_Vec2i myMouseProgressPoint; //!< gesture progress + bool myMouseActiveIdleRotation; //!< flag indicating view idle rotation state + NCollection_Vec2 myMousePressPoint; //!< mouse position where active gesture was been initiated + NCollection_Vec2 myMouseProgressPoint; //!< gesture progress OSD_Timer myMouseClickTimer; //!< timer for handling double-click event - Standard_Integer myMouseClickCounter; //!< counter for handling double-click event - Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0) - Standard_Boolean myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick + int myMouseClickCounter; //!< counter for handling double-click event + int myMouseSingleButton; //!< index of mouse button pressed alone (>0) + bool myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick protected: //! @name multi-touch input variables - Standard_ShortReal myTouchToleranceScale; //!< tolerance scale factor; 1.0 by default - Standard_ShortReal myTouchClickThresholdPx; //!< touch click threshold in pixels; 3 by default - Standard_ShortReal myTouchRotationThresholdPx; //!< threshold for starting one-touch rotation gesture in pixels; 6 by default - Standard_ShortReal myTouchZRotationThreshold; //!< threshold for starting two-touch Z-rotation gesture in radians; 2 degrees by default - Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default - Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default - Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default - Standard_ShortReal myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default + float myTouchToleranceScale; //!< tolerance scale factor; 1.0 by default + float myTouchClickThresholdPx; //!< touch click threshold in pixels; 3 by default + float myTouchRotationThresholdPx; //!< threshold for starting one-touch rotation gesture in pixels; 6 by default + float myTouchZRotationThreshold; //!< threshold for starting two-touch Z-rotation gesture in radians; 2 degrees by default + float myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default + float myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default + float myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default + float myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default Aspect_Touch myTouchClick; //!< single touch position for handling clicks OSD_Timer myTouchDoubleTapTimer; //!< timer for handling double tap - Graphic3d_Vec2d myStartPanCoord; //!< touch coordinates at the moment of starting panning gesture - Graphic3d_Vec2d myStartRotCoord; //!< touch coordinates at the moment of starting rotating gesture - Standard_Integer myNbTouchesLast; //!< number of touches within previous gesture flush to track gesture changes - Standard_Boolean myUpdateStartPointPan; //!< flag indicating that new anchor point should be picked for starting panning gesture - Standard_Boolean myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture - Standard_Boolean myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture + NCollection_Vec2 myStartPanCoord; //!< touch coordinates at the moment of starting panning gesture + NCollection_Vec2 myStartRotCoord; //!< touch coordinates at the moment of starting rotating gesture + int myNbTouchesLast; //!< number of touches within previous gesture flush to track gesture changes + bool myUpdateStartPointPan; //!< flag indicating that new anchor point should be picked for starting panning gesture + bool myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture + bool myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture protected: //! @name rotation/panning transient state variables - Handle(AIS_Point) myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top) - Handle(AIS_Point) myAnchorPointPrs2; //!< anchor point presentation (Graphic3d_ZLayerId_Topmost) + occ::handle myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top) + occ::handle myAnchorPointPrs2; //!< anchor point presentation (Graphic3d_ZLayerId_Topmost) gp_Pnt myPanPnt3d; //!< active panning anchor point gp_Pnt myRotatePnt3d; //!< active rotation center of gravity gp_Dir myCamStartOpUp; //!< camera Up direction at the beginning of rotation @@ -827,7 +837,7 @@ protected: //! @name rotation/panning transient state variables gp_Pnt myCamStartOpCenter; //!< camera Center position at the beginning of rotation gp_Vec myCamStartOpToCenter; //!< vector from rotation gravity point to camera Center at the beginning of rotation gp_Vec myCamStartOpToEye; //!< vector from rotation gravity point to camera Eye at the beginning of rotation - Graphic3d_Vec3d myRotateStartYawPitchRoll; //!< camera yaw pitch roll at the beginning of rotation + double myCurrentRollAngle; //!< current roll angle for instantaneous roll // clang-format on }; diff --git a/opencascade/AIS_ViewCube.hxx b/opencascade/AIS_ViewCube.hxx index 19d340a0f..a9ba6040e 100644 --- a/opencascade/AIS_ViewCube.hxx +++ b/opencascade/AIS_ViewCube.hxx @@ -18,7 +18,8 @@ #include #include -#include +#include +#include #include #include #include @@ -41,7 +42,7 @@ class V3d_View; //! The object is expected to behave like a trihedron in the view corner, //! therefore its position should be defined using transformation persistence flags: //! @code SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, -//! Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100)); @endcode +//! Aspect_TOTP_LEFT_LOWER, NCollection_Vec2 (100, 100)); @endcode //! //! View Cube parts are sensitive to detection, or dynamic highlighting (but not selection), //! and every its owner AIS_ViewCubeOwner corresponds to camera transformation. @@ -75,17 +76,17 @@ public: Standard_EXPORT AIS_ViewCube(); //! Return view animation. - const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; } + const occ::handle& ViewAnimation() const { return myViewAnimation; } //! Set view animation. - void SetViewAnimation(const Handle(AIS_AnimationCamera)& theAnimation) + void SetViewAnimation(const occ::handle& theAnimation) { myViewAnimation = theAnimation; } //! Return TRUE if automatic camera transformation on selection (highlighting) is enabled; TRUE by //! default. - Standard_Boolean ToAutoStartAnimation() const { return myToAutoStartAnim; } + bool ToAutoStartAnimation() const { return myToAutoStartAnim; } //! Enable/disable automatic camera transformation on selection (highlighting). //! The automatic logic can be disabled if application wants performing action manually @@ -93,7 +94,7 @@ public: void SetAutoStartAnimation(bool theToEnable) { myToAutoStartAnim = theToEnable; } //! Return TRUE if camera animation should be done in uninterruptible loop; TRUE by default. - Standard_Boolean IsFixedAnimationLoop() const { return myIsFixedAnimation; } + bool IsFixedAnimationLoop() const { return myIsFixedAnimation; } //! Set if camera animation should be done in uninterruptible loop. void SetFixedAnimationLoop(bool theToEnable) { myIsFixedAnimation = theToEnable; } @@ -111,19 +112,19 @@ protected: public: //! @name Geometry management API //! @return size (width and height) of View cube sides; 100 by default. - Standard_Real Size() const { return mySize; } + double Size() const { return mySize; } //! Sets size (width and height) of View cube sides. //! @param theToAdaptAnother if TRUE, then other parameters will be adapted to specified size - Standard_EXPORT void SetSize(Standard_Real theValue, Standard_Boolean theToAdaptAnother = true); + Standard_EXPORT void SetSize(double theValue, bool theToAdaptAnother = true); //! Return box facet extension to edge/corner facet split; 10 by default. - Standard_Real BoxFacetExtension() const { return myBoxFacetExtension; } + double BoxFacetExtension() const { return myBoxFacetExtension; } //! Set new value of box facet extension. - void SetBoxFacetExtension(Standard_Real theValue) + void SetBoxFacetExtension(double theValue) { - if (Abs(myBoxFacetExtension - theValue) > Precision::Confusion()) + if (std::abs(myBoxFacetExtension - theValue) > Precision::Confusion()) { myBoxFacetExtension = theValue; SetToUpdate(); @@ -131,12 +132,12 @@ public: //! @name Geometry management API } //! Return padding between axes and 3D part (box); 10 by default. - Standard_Real AxesPadding() const { return myAxesPadding; } + double AxesPadding() const { return myAxesPadding; } //! Set new value of padding between axes and 3D part (box). - void SetAxesPadding(Standard_Real theValue) + void SetAxesPadding(double theValue) { - if (Abs(myAxesPadding - theValue) > Precision::Confusion()) + if (std::abs(myAxesPadding - theValue) > Precision::Confusion()) { myAxesPadding = theValue; SetToUpdate(); @@ -144,12 +145,12 @@ public: //! @name Geometry management API } //! Return gap between box edges and box sides; 0 by default. - Standard_Real BoxEdgeGap() const { return myBoxEdgeGap; } + double BoxEdgeGap() const { return myBoxEdgeGap; } //! Set new value of box edges gap. - void SetBoxEdgeGap(Standard_Real theValue) + void SetBoxEdgeGap(double theValue) { - if (Abs(myBoxEdgeGap - theValue) > Precision::Confusion()) + if (std::abs(myBoxEdgeGap - theValue) > Precision::Confusion()) { myBoxEdgeGap = theValue; SetToUpdate(); @@ -157,12 +158,12 @@ public: //! @name Geometry management API } //! Return minimal size of box edge; 2 by default. - Standard_Real BoxEdgeMinSize() const { return myBoxEdgeMinSize; } + double BoxEdgeMinSize() const { return myBoxEdgeMinSize; } //! Set new value of box edge minimal size. - void SetBoxEdgeMinSize(Standard_Real theValue) + void SetBoxEdgeMinSize(double theValue) { - if (Abs(myBoxEdgeMinSize - theValue) > Precision::Confusion()) + if (std::abs(myBoxEdgeMinSize - theValue) > Precision::Confusion()) { myBoxEdgeMinSize = theValue; SetToUpdate(); @@ -170,12 +171,12 @@ public: //! @name Geometry management API } //! Return minimal size of box corner; 2 by default. - Standard_Real BoxCornerMinSize() const { return myCornerMinSize; } + double BoxCornerMinSize() const { return myCornerMinSize; } //! Set new value of box corner minimal size. - void SetBoxCornerMinSize(Standard_Real theValue) + void SetBoxCornerMinSize(double theValue) { - if (Abs(myCornerMinSize - theValue) > Precision::Confusion()) + if (std::abs(myCornerMinSize - theValue) > Precision::Confusion()) { myCornerMinSize = theValue; SetToUpdate(); @@ -184,19 +185,19 @@ public: //! @name Geometry management API //! Return relative radius of side corners (round rectangle); 0.0 by default. //! The value in within [0, 0.5] range meaning absolute radius = RoundRadius() / Size(). - Standard_Real RoundRadius() const { return myRoundRadius; } + double RoundRadius() const { return myRoundRadius; } //! Set relative radius of View Cube sides corners (round rectangle). //! The value should be within [0, 0.5] range. - Standard_EXPORT void SetRoundRadius(const Standard_Real theValue); + Standard_EXPORT void SetRoundRadius(const double theValue); //! Returns radius of axes of the trihedron; 1.0 by default. - Standard_Real AxesRadius() const { return myAxesRadius; } + double AxesRadius() const { return myAxesRadius; } //! Sets radius of axes of the trihedron. - void SetAxesRadius(const Standard_Real theRadius) + void SetAxesRadius(const double theRadius) { - if (Abs(myAxesRadius - theRadius) > Precision::Confusion()) + if (std::abs(myAxesRadius - theRadius) > Precision::Confusion()) { myAxesRadius = theRadius; SetToUpdate(); @@ -204,12 +205,12 @@ public: //! @name Geometry management API } //! Returns radius of cone of axes of the trihedron; 3.0 by default. - Standard_Real AxesConeRadius() const { return myAxesConeRadius; } + double AxesConeRadius() const { return myAxesConeRadius; } //! Sets radius of cone of axes of the trihedron. - void SetAxesConeRadius(Standard_Real theRadius) + void SetAxesConeRadius(double theRadius) { - if (Abs(myAxesConeRadius - theRadius) > Precision::Confusion()) + if (std::abs(myAxesConeRadius - theRadius) > Precision::Confusion()) { myAxesConeRadius = theRadius; SetToUpdate(); @@ -217,12 +218,12 @@ public: //! @name Geometry management API } //! Returns radius of sphere (central point) of the trihedron; 4.0 by default. - Standard_Real AxesSphereRadius() const { return myAxesSphereRadius; } + double AxesSphereRadius() const { return myAxesSphereRadius; } //! Sets radius of sphere (central point) of the trihedron. - void SetAxesSphereRadius(Standard_Real theRadius) + void SetAxesSphereRadius(double theRadius) { - if (Abs(myAxesSphereRadius - theRadius) > Precision::Confusion()) + if (std::abs(myAxesSphereRadius - theRadius) > Precision::Confusion()) { myAxesSphereRadius = theRadius; SetToUpdate(); @@ -230,10 +231,10 @@ public: //! @name Geometry management API } //! @return TRUE if trihedron is drawn; TRUE by default. - Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; } + bool ToDrawAxes() const { return myToDisplayAxes; } //! Enable/disable drawing of trihedron. - void SetDrawAxes(Standard_Boolean theValue) + void SetDrawAxes(bool theValue) { if (myToDisplayAxes != theValue) { @@ -243,10 +244,10 @@ public: //! @name Geometry management API } //! @return TRUE if edges of View Cube is drawn; TRUE by default. - Standard_Boolean ToDrawEdges() const { return myToDisplayEdges; } + bool ToDrawEdges() const { return myToDisplayEdges; } //! Enable/disable drawing of edges of View Cube. - void SetDrawEdges(Standard_Boolean theValue) + void SetDrawEdges(bool theValue) { if (myToDisplayEdges != theValue) { @@ -256,10 +257,10 @@ public: //! @name Geometry management API } //! Return TRUE if vertices (vertex) of View Cube is drawn; TRUE by default. - Standard_Boolean ToDrawVertices() const { return myToDisplayVertices; } + bool ToDrawVertices() const { return myToDisplayVertices; } //! Enable/disable drawing of vertices (corners) of View Cube. - void SetDrawVertices(Standard_Boolean theValue) + void SetDrawVertices(bool theValue) { if (myToDisplayVertices != theValue) { @@ -269,21 +270,20 @@ public: //! @name Geometry management API } //! Return TRUE if application expects Y-up viewer orientation instead of Z-up; FALSE by default. - Standard_Boolean IsYup() const { return myIsYup; } + bool IsYup() const { return myIsYup; } //! Set if application expects Y-up viewer orientation instead of Z-up. - Standard_EXPORT void SetYup(Standard_Boolean theIsYup, - Standard_Boolean theToUpdateLabels = Standard_True); + Standard_EXPORT void SetYup(bool theIsYup, bool theToUpdateLabels = true); public: //! @name Style management API //! Return shading style of box sides. - const Handle(Prs3d_ShadingAspect)& BoxSideStyle() const { return myDrawer->ShadingAspect(); } + const occ::handle& BoxSideStyle() const { return myDrawer->ShadingAspect(); } //! Return shading style of box edges. - const Handle(Prs3d_ShadingAspect)& BoxEdgeStyle() const { return myBoxEdgeAspect; } + const occ::handle& BoxEdgeStyle() const { return myBoxEdgeAspect; } //! Return shading style of box corners. - const Handle(Prs3d_ShadingAspect)& BoxCornerStyle() const { return myBoxCornerAspect; } + const occ::handle& BoxCornerStyle() const { return myBoxCornerAspect; } //! Return value of front color for the 3D part of object. const Quantity_Color& BoxColor() const { return myDrawer->ShadingAspect()->Color(); } @@ -304,15 +304,15 @@ public: //! @name Style management API } //! Return transparency for 3D part of object. - Standard_Real BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); } + double BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); } //! Set new value of transparency for 3D part of object. //! @param[in] theValue input transparency value - void SetBoxTransparency(Standard_Real theValue) + void SetBoxTransparency(double theValue) { - if (Abs(myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion() - || Abs(myBoxEdgeAspect->Transparency() - theValue) > Precision::Confusion() - || Abs(myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion()) + if (std::abs(myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion() + || std::abs(myBoxEdgeAspect->Transparency() - theValue) > Precision::Confusion() + || std::abs(myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion()) { myDrawer->ShadingAspect()->SetTransparency(theValue); myBoxEdgeAspect->SetTransparency(theValue); @@ -340,7 +340,7 @@ public: //! @name Style management API TCollection_AsciiString BoxSideLabel(V3d_TypeOfOrientation theSide) const { const TCollection_AsciiString* aLabel = myBoxSideLabels.Seek(theSide); - return aLabel != NULL ? *aLabel : TCollection_AsciiString(); + return aLabel != nullptr ? *aLabel : TCollection_AsciiString(); } //! Set box side label. @@ -378,13 +378,13 @@ public: //! @name Style management API } //! Return height of font - Standard_Real FontHeight() const { return myDrawer->TextAspect()->Height(); } + double FontHeight() const { return myDrawer->TextAspect()->Height(); } //! Change font height. Alias for: //! @code Attributes()->TextAspect()->SetHeight() @endcode - void SetFontHeight(Standard_Real theValue) + void SetFontHeight(double theValue) { - if (Abs(myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion()) + if (std::abs(myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion()) { myDrawer->TextAspect()->SetHeight(theValue); SetToUpdate(); @@ -396,7 +396,7 @@ public: //! @name Style management API TCollection_AsciiString AxisLabel(Prs3d_DatumParts theAxis) const { const TCollection_AsciiString* aLabel = myAxesLabels.Seek(theAxis); - return aLabel != NULL ? *aLabel : TCollection_AsciiString(); + return aLabel != nullptr ? *aLabel : TCollection_AsciiString(); } //! Set axes labels. @@ -413,10 +413,10 @@ public: //! @name Style management API public: //! Set new value of color for the whole object. //! @param[in] theColor input color value. - virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE { SetBoxColor(theColor); } + void SetColor(const Quantity_Color& theColor) override { SetBoxColor(theColor); } //! Reset color for the whole object. - virtual void UnsetColor() Standard_OVERRIDE + void UnsetColor() override { myDrawer->ShadingAspect()->SetColor(Quantity_NOC_WHITE); myBoxEdgeAspect->SetColor(Quantity_NOC_GRAY30); @@ -426,16 +426,13 @@ public: //! Set new value of transparency for the whole object. //! @param[in] theValue input transparency value. - virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE - { - SetBoxTransparency(theValue); - } + void SetTransparency(const double theValue) override { SetBoxTransparency(theValue); } //! Reset transparency for the whole object. - virtual void UnsetTransparency() Standard_OVERRIDE { SetBoxTransparency(0.0f); } + void UnsetTransparency() override { SetBoxTransparency(0.0f); } //! Sets the material for the interactive object. - virtual void SetMaterial(const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE + void SetMaterial(const Graphic3d_MaterialAspect& theMat) override { myDrawer->ShadingAspect()->SetMaterial(theMat); myBoxEdgeAspect->SetMaterial(theMat); @@ -444,7 +441,7 @@ public: } //! Sets the material for the interactive object. - virtual void UnsetMaterial() Standard_OVERRIDE + void UnsetMaterial() override { Graphic3d_MaterialAspect aMat(Graphic3d_NameOfMaterial_UserDefined); aMat.SetColor(Quantity_NOC_WHITE); @@ -459,53 +456,53 @@ public: public: //! @name animation methods //! Return duration of animation in seconds; 0.5 sec by default - Standard_EXPORT Standard_Real Duration() const; + Standard_EXPORT double Duration() const; //! Set duration of animation. //! @param[in] theValue input value of duration in seconds - Standard_EXPORT void SetDuration(Standard_Real theValue); + Standard_EXPORT void SetDuration(double theValue); //! Return TRUE if new camera Up direction should be always set to default value for a new camera //! Direction; FALSE by default. When this flag is FALSE, the new camera Up will be set as current //! Up orthogonalized to the new camera Direction, and will set to default Up on second click. - Standard_Boolean ToResetCameraUp() const { return myToResetCameraUp; } + bool ToResetCameraUp() const { return myToResetCameraUp; } //! Set if new camera Up direction should be always set to default value for a new camera //! Direction. - void SetResetCamera(Standard_Boolean theToReset) { myToResetCameraUp = theToReset; } + void SetResetCamera(bool theToReset) { myToResetCameraUp = theToReset; } //! Return TRUE if animation should fit selected objects and FALSE to fit entire scene; TRUE by //! default. - Standard_Boolean ToFitSelected() const { return myToFitSelected; } + bool ToFitSelected() const { return myToFitSelected; } //! Set if animation should fit selected objects or to fit entire scene. - void SetFitSelected(Standard_Boolean theToFitSelected) { myToFitSelected = theToFitSelected; } + void SetFitSelected(bool theToFitSelected) { myToFitSelected = theToFitSelected; } //! @return TRUE if View Cube has unfinished animation of view camera. - Standard_EXPORT Standard_Boolean HasAnimation() const; + Standard_EXPORT bool HasAnimation() const; //! Start camera transformation corresponding to the input detected owner. //! @param[in] theOwner detected owner. - Standard_EXPORT virtual void StartAnimation(const Handle(AIS_ViewCubeOwner)& theOwner); + Standard_EXPORT virtual void StartAnimation(const occ::handle& theOwner); //! Perform one step of current camera transformation. //! theToUpdate[in] enable/disable update of view. //! @return TRUE if animation is not stopped. - Standard_EXPORT virtual Standard_Boolean UpdateAnimation(const Standard_Boolean theToUpdate); + Standard_EXPORT virtual bool UpdateAnimation(const bool theToUpdate); //! Perform camera transformation corresponding to the input detected owner. - Standard_EXPORT virtual void HandleClick(const Handle(AIS_ViewCubeOwner)& theOwner); + Standard_EXPORT virtual void HandleClick(const occ::handle& theOwner); protected: //! Perform internal single step of animation. //! @return FALSE if animation has been finished - Standard_EXPORT Standard_Boolean updateAnimation(); + Standard_EXPORT bool updateAnimation(); //! Fit selected/all into view. //! @param[in] theView view definition to retrieve scene bounding box //! @param theCamera [in,out] camera definition - Standard_EXPORT virtual void viewFitAll(const Handle(V3d_View)& theView, - const Handle(Graphic3d_Camera)& theCamera); + Standard_EXPORT virtual void viewFitAll(const occ::handle& theView, + const occ::handle& theCamera); protected: //! @name protected virtual API //! Method that is called after one step of transformation. @@ -516,15 +513,12 @@ protected: //! @name protected virtual API public: //! @name Presentation computation //! Return TRUE for supported display mode. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Global selection has no meaning for this class. - virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE + occ::handle GlobalSelOwner() const override { - return Handle(SelectMgr_EntityOwner)(); + return occ::handle(); } //! Compute 3D part of View Cube. @@ -532,49 +526,49 @@ public: //! @name Presentation computation //! @param[in] thePrs input presentation that is to be filled with flat presentation primitives. //! @param[in] theMode display mode. //! @warning this object accept only 0 display mode. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode = 0) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode = 0) override; //! Redefine computing of sensitive entities for View Cube. //! @param[in] theSelection input selection object that is to be filled with sensitive entities. //! @param[in] theMode selection mode. //! @warning object accepts only 0 selection mode. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSelection, + const int theMode) override; //! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden //! methods. - virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; } + bool IsAutoHilight() const override { return false; } //! Method which clear all selected owners belonging to this selectable object. //! @warning this object does not support selection. - virtual void ClearSelected() Standard_OVERRIDE {} + void ClearSelected() override {} //! Method which highlights input owner belonging to this selectable object. //! @param[in] thePM presentation manager //! @param[in] theStyle style for dynamic highlighting. //! @param[in] theOwner input entity owner. - Standard_EXPORT virtual void HilightOwnerWithColor( - const Handle(PrsMgr_PresentationManager)& thePM, - const Handle(Prs3d_Drawer)& theStyle, - const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE; + Standard_EXPORT void HilightOwnerWithColor( + const occ::handle& thePM, + const occ::handle& theStyle, + const occ::handle& theOwner) override; //! Method which draws selected owners. - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM, - const SelectMgr_SequenceOfOwner& theSeq) - Standard_OVERRIDE; + Standard_EXPORT void HilightSelected( + const occ::handle& thePM, + const NCollection_Sequence>& theSeq) override; //! Set default parameters for visual attributes //! @sa Attributes() - virtual void UnsetAttributes() Standard_OVERRIDE + void UnsetAttributes() override { setDefaultAttributes(); SetToUpdate(); } //! Set default parameters for dynamic highlighting attributes, reset highlight attributes - virtual void UnsetHilightAttributes() Standard_OVERRIDE + void UnsetHilightAttributes() override { myHilightDrawer.Nullify(); setDefaultHighlightAttributes(); @@ -590,10 +584,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv //! triangulation //! @param[in] theDir part to define Standard_EXPORT virtual void createBoxPartTriangles( - const Handle(Graphic3d_ArrayOfTriangles)& theTris, - Standard_Integer& theNbNodes, - Standard_Integer& theNbTris, - V3d_TypeOfOrientation theDir) const; + const occ::handle& theTris, + int& theNbNodes, + int& theNbTris, + V3d_TypeOfOrientation theDir) const; //! Create triangulation for a box side. //! @param theTris [in,out] triangulation to fill, or NULL to return size @@ -603,10 +597,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv //! triangulation //! @param[in] theDir part to define Standard_EXPORT virtual void createBoxSideTriangles( - const Handle(Graphic3d_ArrayOfTriangles)& theTris, - Standard_Integer& theNbNodes, - Standard_Integer& theNbTris, - V3d_TypeOfOrientation theDir) const; + const occ::handle& theTris, + int& theNbNodes, + int& theNbTris, + V3d_TypeOfOrientation theDir) const; //! Create triangulation for a box edge. //! @param theTris [in,out] triangulation to fill, or NULL to return size @@ -616,10 +610,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv //! triangulation //! @param[in] theDir part to define Standard_EXPORT virtual void createBoxEdgeTriangles( - const Handle(Graphic3d_ArrayOfTriangles)& theTris, - Standard_Integer& theNbNodes, - Standard_Integer& theNbTris, - V3d_TypeOfOrientation theDir) const; + const occ::handle& theTris, + int& theNbNodes, + int& theNbTris, + V3d_TypeOfOrientation theDir) const; //! Create triangulation for a box corner (vertex). //! @param theTris [in,out] triangulation to fill, or NULL to return size @@ -629,10 +623,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv //! triangulation //! @param[in] theDir part to define Standard_EXPORT virtual void createBoxCornerTriangles( - const Handle(Graphic3d_ArrayOfTriangles)& theTris, - Standard_Integer& theNbNodes, - Standard_Integer& theNbTris, - V3d_TypeOfOrientation theDir) const; + const occ::handle& theTris, + int& theNbNodes, + int& theNbTris, + V3d_TypeOfOrientation theDir) const; protected: //! Create triangulation for a rectangle with round corners. @@ -645,47 +639,47 @@ protected: //! @param[in] theRadius radius at corners //! @param[in] theTrsf transformation Standard_EXPORT static void createRoundRectangleTriangles( - const Handle(Graphic3d_ArrayOfTriangles)& theTris, - Standard_Integer& theNbNodes, - Standard_Integer& theNbTris, - const gp_XY& theSize, - Standard_Real theRadius, - const gp_Trsf& theTrsf); + const occ::handle& theTris, + int& theNbNodes, + int& theNbTris, + const gp_XY& theSize, + double theRadius, + const gp_Trsf& theTrsf); protected: NCollection_DataMap myBoxSideLabels; //!< map with box side labels NCollection_DataMap - myAxesLabels; //!< map with axes labels - Handle(Prs3d_ShadingAspect) myBoxEdgeAspect; //!< style for box edges - Handle(Prs3d_ShadingAspect) myBoxCornerAspect; //!< style for box corner - - Standard_Real mySize; //!< size of box side, length of one axis - Standard_Real myBoxEdgeMinSize; //!< minimal size of box edge - Standard_Real myBoxEdgeGap; //!< gap between box side and box edge - Standard_Real myBoxFacetExtension; //!< box facet extension - Standard_Real myAxesPadding; //!< Padding between box and axes + myAxesLabels; //!< map with axes labels + occ::handle myBoxEdgeAspect; //!< style for box edges + occ::handle myBoxCornerAspect; //!< style for box corner + + double mySize; //!< size of box side, length of one axis + double myBoxEdgeMinSize; //!< minimal size of box edge + double myBoxEdgeGap; //!< gap between box side and box edge + double myBoxFacetExtension; //!< box facet extension + double myAxesPadding; //!< Padding between box and axes // clang-format off - Standard_Real myAxesRadius; //!< radius of axes of the trihedron; 1.0 by default - Standard_Real myAxesConeRadius; //!< radius of cone of axes of the trihedron; 3.0 by default - Standard_Real myAxesSphereRadius; //!< radius of sphere (central point) of the trihedron; 4.0 by default - Standard_Real myCornerMinSize; //!< minimal size of box corner - Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range - Standard_Boolean myToDisplayAxes; //!< trihedron visibility - Standard_Boolean myToDisplayEdges; //!< box edges visibility - Standard_Boolean myToDisplayVertices; //!< box corners (vertices) visibility - Standard_Boolean myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up + double myAxesRadius; //!< radius of axes of the trihedron; 1.0 by default + double myAxesConeRadius; //!< radius of cone of axes of the trihedron; 3.0 by default + double myAxesSphereRadius; //!< radius of sphere (central point) of the trihedron; 4.0 by default + double myCornerMinSize; //!< minimal size of box corner + double myRoundRadius; //!< relative round radius within [0; 0.5] range + bool myToDisplayAxes; //!< trihedron visibility + bool myToDisplayEdges; //!< box edges visibility + bool myToDisplayVertices; //!< box corners (vertices) visibility + bool myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up // clang-format on -protected: //! @name Animation options - Handle(AIS_AnimationCamera) myViewAnimation; //!< Camera animation object - Handle(Graphic3d_Camera) myStartState; //!< Start state of view camera - Handle(Graphic3d_Camera) myEndState; //!< End state of view camera - Standard_Boolean myToAutoStartAnim; //!< start animation automatically on click - Standard_Boolean myIsFixedAnimation; //!< fixed-loop animation - Standard_Boolean myToFitSelected; //!< fit selected or fit entire scene +protected: //! @name Animation options + occ::handle myViewAnimation; //!< Camera animation object + occ::handle myStartState; //!< Start state of view camera + occ::handle myEndState; //!< End state of view camera + bool myToAutoStartAnim; //!< start animation automatically on click + bool myIsFixedAnimation; //!< fixed-loop animation + bool myToFitSelected; //!< fit selected or fit entire scene // clang-format off - Standard_Boolean myToResetCameraUp; //!< always reset camera up direction to default + bool myToResetCameraUp; //!< always reset camera up direction to default // clang-format on }; @@ -696,10 +690,11 @@ class AIS_ViewCubeOwner : public SelectMgr_EntityOwner DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner) public: //! Main constructor. - AIS_ViewCubeOwner(const Handle(AIS_ViewCube)& theObject, - V3d_TypeOfOrientation theOrient, - Standard_Integer thePriority = 5) - : SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)theObject, thePriority), + AIS_ViewCubeOwner(const occ::handle& theObject, + V3d_TypeOfOrientation theOrient, + int thePriority = 5) + : SelectMgr_EntityOwner((const occ::handle&)theObject, + thePriority), myMainOrient(theOrient) { myFromDecomposition = true; @@ -707,16 +702,16 @@ public: //! @return TRUE. This owner will always call method //! Hilight for its Selectable Object when the owner is detected. - virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE { return Standard_True; } + bool IsForcedHilight() const override { return true; } //! Return new orientation to set. V3d_TypeOfOrientation MainOrientation() const { return myMainOrient; } //! Handle mouse button click event. - virtual Standard_Boolean HandleMouseClick(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButton, - Aspect_VKeyFlags theModifiers, - bool theIsDoubleClick) Standard_OVERRIDE + bool HandleMouseClick(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButton, + Aspect_VKeyFlags theModifiers, + bool theIsDoubleClick) override { (void)thePoint; (void)theButton; @@ -724,7 +719,7 @@ public: (void)theIsDoubleClick; AIS_ViewCube* aCubePrs = dynamic_cast(mySelectable); aCubePrs->HandleClick(this); - return Standard_True; + return true; } protected: @@ -737,13 +732,12 @@ class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray) public: //! Constructor. - Standard_EXPORT AIS_ViewCubeSensitive(const Handle(SelectMgr_EntityOwner)& theOwner, - const Handle(Graphic3d_ArrayOfTriangles)& theTris); + Standard_EXPORT AIS_ViewCubeSensitive(const occ::handle& theOwner, + const occ::handle& theTris); //! Checks whether element overlaps current selecting volume. - Standard_EXPORT virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager& theMgr, - SelectBasics_PickResult& thePickResult) - Standard_OVERRIDE; + Standard_EXPORT bool Matches(SelectBasics_SelectingVolumeManager& theMgr, + SelectBasics_PickResult& thePickResult) override; protected: //! Checks if picking ray can be used for detection. diff --git a/opencascade/AIS_ViewInputBuffer.hxx b/opencascade/AIS_ViewInputBuffer.hxx index 9c420cbb8..9c6564635 100644 --- a/opencascade/AIS_ViewInputBuffer.hxx +++ b/opencascade/AIS_ViewInputBuffer.hxx @@ -17,7 +17,8 @@ #include #include -#include +#include +#include #include #include @@ -61,8 +62,8 @@ public: struct _highlighting { - bool ToHilight; //!< perform dynamic highlighting at specified point - Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting + bool ToHilight; //!< perform dynamic highlighting at specified point + NCollection_Vec2 Point; //!< the new point for dynamic highlighting _highlighting() : ToHilight(false) @@ -72,10 +73,10 @@ public: struct _selection { - AIS_ViewSelectionTool Tool; //!< perform selection - AIS_SelectionScheme Scheme; //!< selection scheme - NCollection_Sequence Points; //!< the points for selection - bool ToApplyTool; //!< apply rubber-band selection tool + AIS_ViewSelectionTool Tool; //!< perform selection + AIS_SelectionScheme Scheme; //!< selection scheme + NCollection_Sequence> Points; //!< the points for selection + bool ToApplyTool; //!< apply rubber-band selection tool _selection() : Tool(AIS_ViewSelectionTool_Picking), @@ -87,10 +88,10 @@ public: struct _panningParams { - bool ToStart; //!< start panning - Graphic3d_Vec2i PointStart; //!< panning start point - bool ToPan; //!< perform panning - Graphic3d_Vec2i Delta; //!< panning delta + bool ToStart; //!< start panning + NCollection_Vec2 PointStart; //!< panning start point + bool ToPan; //!< perform panning + NCollection_Vec2 Delta; //!< panning delta _panningParams() : ToStart(false), @@ -101,13 +102,13 @@ public: struct _draggingParams { - bool ToStart; //!< start dragging - bool ToConfirm; //!< confirm dragging - bool ToMove; //!< perform dragging - bool ToStop; //!< stop dragging - bool ToAbort; //!< abort dragging (restore previous position) - Graphic3d_Vec2i PointStart; //!< drag start point - Graphic3d_Vec2i PointTo; //!< drag end point + bool ToStart; //!< start dragging + bool ToConfirm; //!< confirm dragging + bool ToMove; //!< perform dragging + bool ToStop; //!< stop dragging + bool ToAbort; //!< abort dragging (restore previous position) + NCollection_Vec2 PointStart; //!< drag start point + NCollection_Vec2 PointTo; //!< drag end point _draggingParams() : ToStart(false), @@ -121,10 +122,10 @@ public: struct _orbitRotation { - bool ToStart; //!< start orbit rotation - Graphic3d_Vec2d PointStart; //!< orbit rotation start point - bool ToRotate; //!< perform orbit rotation - Graphic3d_Vec2d PointTo; //!< orbit rotation end point + bool ToStart; //!< start orbit rotation + NCollection_Vec2 PointStart; //!< orbit rotation start point + bool ToRotate; //!< perform orbit rotation + NCollection_Vec2 PointTo; //!< orbit rotation end point _orbitRotation() : ToStart(false), @@ -135,10 +136,10 @@ public: struct _viewRotation { - bool ToStart; //!< start view rotation - Graphic3d_Vec2d PointStart; //!< view rotation start point - bool ToRotate; //!< perform view rotation - Graphic3d_Vec2d PointTo; //!< view rotation end point + bool ToStart; //!< start view rotation + NCollection_Vec2 PointStart; //!< view rotation start point + bool ToRotate; //!< perform view rotation + NCollection_Vec2 PointTo; //!< view rotation end point _viewRotation() : ToStart(false), @@ -149,9 +150,9 @@ public: struct _zrotateParams { - Graphic3d_Vec2i Point; //!< Z rotation start point - double Angle; //!< Z rotation angle - bool ToRotate; //!< start Z rotation + NCollection_Vec2 Point; //!< Z rotation start point + double Angle; //!< Z rotation angle + bool ToRotate; //!< start Z rotation _zrotateParams() : Angle(0.0), diff --git a/opencascade/AIS_WalkDelta.hxx b/opencascade/AIS_WalkDelta.hxx index 045df64db..5cfaaf05a 100644 --- a/opencascade/AIS_WalkDelta.hxx +++ b/opencascade/AIS_WalkDelta.hxx @@ -35,12 +35,12 @@ enum AIS_WalkRotation //! Walking value. struct AIS_WalkPart { - Standard_Real Value; //!< value - Standard_Real Pressure; //!< key pressure - Standard_Real Duration; //!< duration + double Value; //!< value + double Pressure; //!< key pressure + double Duration; //!< duration //! Return TRUE if delta is empty. - bool IsEmpty() const { return Abs(Value) <= RealSmall(); } + bool IsEmpty() const { return std::abs(Value) <= RealSmall(); } //! Empty constructor. AIS_WalkPart() diff --git a/opencascade/AIS_XRTrackedDevice.hxx b/opencascade/AIS_XRTrackedDevice.hxx index edb7a96ad..59ba7dc28 100644 --- a/opencascade/AIS_XRTrackedDevice.hxx +++ b/opencascade/AIS_XRTrackedDevice.hxx @@ -26,8 +26,8 @@ class AIS_XRTrackedDevice : public AIS_InteractiveObject DEFINE_STANDARD_RTTIEXT(AIS_XRTrackedDevice, AIS_InteractiveObject) public: //! Main constructor. - Standard_EXPORT AIS_XRTrackedDevice(const Handle(Graphic3d_ArrayOfTriangles)& theTris, - const Handle(Image_Texture)& theTexture); + Standard_EXPORT AIS_XRTrackedDevice(const occ::handle& theTris, + const occ::handle& theTexture); //! Empty constructor. Standard_EXPORT AIS_XRTrackedDevice(); @@ -45,32 +45,29 @@ public: Standard_EXPORT void SetLaserColor(const Quantity_Color& theColor); //! Return laser length. - Standard_ShortReal LaserLength() const { return myLaserLength; } + float LaserLength() const { return myLaserLength; } //! Set laser length. - Standard_EXPORT void SetLaserLength(Standard_ShortReal theLength); + Standard_EXPORT void SetLaserLength(float theLength); //! Return unit scale factor. - Standard_ShortReal UnitFactor() const { return myUnitFactor; } + float UnitFactor() const { return myUnitFactor; } //! Set unit scale factor. - void SetUnitFactor(Standard_ShortReal theFactor) { myUnitFactor = theFactor; } + void SetUnitFactor(float theFactor) { myUnitFactor = theFactor; } protected: //! Returns true for 0 mode. - virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } + bool AcceptDisplayMode(const int theMode) const override { return theMode == 0; } //! Compute presentation. - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void Compute(const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override; //! Compute selection. - Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) Standard_OVERRIDE; + Standard_EXPORT void ComputeSelection(const occ::handle& theSel, + const int theMode) override; //! Compute laser ray presentation. Standard_EXPORT void computeLaserRay(); @@ -80,14 +77,14 @@ private: class XRTexture; private: - Handle(Graphic3d_Group) myRayGroup; - - Handle(Graphic3d_ArrayOfTriangles) myTris; - Quantity_Color myLaserColor; - Standard_ShortReal myLaserLength; - Standard_ShortReal myUnitFactor; - Aspect_XRTrackedDeviceRole myRole; - Standard_Boolean myToShowAxes; + occ::handle myRayGroup; + + occ::handle myTris; + Quantity_Color myLaserColor; + float myLaserLength; + float myUnitFactor; + Aspect_XRTrackedDeviceRole myRole; + bool myToShowAxes; }; #endif // _AIS_XRTrackedDevice_HeaderFile diff --git a/opencascade/APIHeaderSection_EditHeader.hxx b/opencascade/APIHeaderSection_EditHeader.hxx index 7302db76f..dc2792d0d 100644 --- a/opencascade/APIHeaderSection_EditHeader.hxx +++ b/opencascade/APIHeaderSection_EditHeader.hxx @@ -27,38 +27,29 @@ class TCollection_HAsciiString; class Standard_Transient; class Interface_InterfaceModel; -class APIHeaderSection_EditHeader; -DEFINE_STANDARD_HANDLE(APIHeaderSection_EditHeader, IFSelect_Editor) - class APIHeaderSection_EditHeader : public IFSelect_Editor { public: Standard_EXPORT APIHeaderSection_EditHeader(); - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; + Standard_EXPORT TCollection_AsciiString Label() const override; - Standard_EXPORT Standard_Boolean - Recognize(const Handle(IFSelect_EditForm)& form) const Standard_OVERRIDE; + Standard_EXPORT bool Recognize(const occ::handle& form) const override; - Standard_EXPORT Handle(TCollection_HAsciiString) StringValue( - const Handle(IFSelect_EditForm)& form, - const Standard_Integer num) const Standard_OVERRIDE; + Standard_EXPORT occ::handle StringValue( + const occ::handle& form, + const int num) const override; - Standard_EXPORT Standard_Boolean - Apply(const Handle(IFSelect_EditForm)& form, - const Handle(Standard_Transient)& ent, - const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; + Standard_EXPORT bool Apply(const occ::handle& form, + const occ::handle& ent, + const occ::handle& model) const override; - Standard_EXPORT Standard_Boolean - Load(const Handle(IFSelect_EditForm)& form, - const Handle(Standard_Transient)& ent, - const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; + Standard_EXPORT bool Load(const occ::handle& form, + const occ::handle& ent, + const occ::handle& model) const override; DEFINE_STANDARD_RTTIEXT(APIHeaderSection_EditHeader, IFSelect_Editor) - -protected: -private: }; #endif // _APIHeaderSection_EditHeader_HeaderFile diff --git a/opencascade/APIHeaderSection_MakeHeader.hxx b/opencascade/APIHeaderSection_MakeHeader.hxx index ce2c1ca6d..c14cc3124 100644 --- a/opencascade/APIHeaderSection_MakeHeader.hxx +++ b/opencascade/APIHeaderSection_MakeHeader.hxx @@ -23,7 +23,9 @@ #include #include -#include +#include +#include +#include class HeaderSection_FileName; class HeaderSection_FileSchema; class HeaderSection_FileDescription; @@ -31,166 +33,172 @@ class StepData_StepModel; class Interface_Protocol; class TCollection_HAsciiString; -//! This class allows to consult and prepare/edit data stored in -//! a Step Model Header +//! This class allows to consult and prepare/edit data stored in +//! a Step Model Header class APIHeaderSection_MakeHeader { public: DEFINE_STANDARD_ALLOC //! Prepares a new MakeHeader from scratch - Standard_EXPORT APIHeaderSection_MakeHeader(const Standard_Integer shapetype = 0); + Standard_EXPORT APIHeaderSection_MakeHeader(const int shapetype = 0); //! Prepares a MakeHeader from the content of a StepModel //! See IsDone to know if the Header is well defined - Standard_EXPORT APIHeaderSection_MakeHeader(const Handle(StepData_StepModel)& model); + Standard_EXPORT APIHeaderSection_MakeHeader(const occ::handle& model); //! Cancels the former definition and gives a FileName //! To be used when a Model has no well defined Header - Standard_EXPORT void Init(const Standard_CString nameval); + Standard_EXPORT void Init(const char* const nameval); //! Returns True if all data have been defined (see also //! HasFn, HasFs, HasFd) - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! Creates an empty header for a new //! STEP model and allows the header fields to be completed. - Standard_EXPORT void Apply(const Handle(StepData_StepModel)& model) const; + Standard_EXPORT void Apply(const occ::handle& model) const; //! Builds a Header, creates a new StepModel, then applies the //! Header to the StepModel //! The Schema Name is taken from the Protocol (if it inherits //! from StepData, else it is left in blanks) - Standard_EXPORT Handle(StepData_StepModel) NewModel( - const Handle(Interface_Protocol)& protocol) const; + Standard_EXPORT occ::handle NewModel( + const occ::handle& protocol) const; //! Checks whether there is a //! file_name entity. Returns True if there is one. - Standard_EXPORT Standard_Boolean HasFn() const; + Standard_EXPORT bool HasFn() const; //! Returns the file_name entity. //! Returns an empty entity if the file_name entity is not initialized. - Standard_EXPORT Handle(HeaderSection_FileName) FnValue() const; + Standard_EXPORT occ::handle FnValue() const; - Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& aName); + Standard_EXPORT void SetName(const occ::handle& aName); //! Returns the name attribute for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) Name() const; + Standard_EXPORT occ::handle Name() const; - Standard_EXPORT void SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp); + Standard_EXPORT void SetTimeStamp(const occ::handle& aTimeStamp); //! Returns the value of the time_stamp attribute for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) TimeStamp() const; + Standard_EXPORT occ::handle TimeStamp() const; - Standard_EXPORT void SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor); + Standard_EXPORT void SetAuthor( + const occ::handle>>& aAuthor); - Standard_EXPORT void SetAuthorValue(const Standard_Integer num, - const Handle(TCollection_HAsciiString)& aAuthor); + Standard_EXPORT void SetAuthorValue(const int num, + const occ::handle& aAuthor); - Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Author() const; + Standard_EXPORT occ::handle>> Author() + const; //! Returns the value of the name attribute for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) AuthorValue(const Standard_Integer num) const; + Standard_EXPORT occ::handle AuthorValue(const int num) const; //! Returns the number of values for the author attribute in the file_name entity. - Standard_EXPORT Standard_Integer NbAuthor() const; + Standard_EXPORT int NbAuthor() const; Standard_EXPORT void SetOrganization( - const Handle(Interface_HArray1OfHAsciiString)& aOrganization); + const occ::handle>>& aOrganization); - Standard_EXPORT void SetOrganizationValue(const Standard_Integer num, - const Handle(TCollection_HAsciiString)& aOrganization); + Standard_EXPORT void SetOrganizationValue( + const int num, + const occ::handle& aOrganization); - Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Organization() const; + Standard_EXPORT occ::handle>> + Organization() const; //! Returns the value of attribute //! organization for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) OrganizationValue( - const Standard_Integer num) const; + Standard_EXPORT occ::handle OrganizationValue(const int num) const; //! Returns the number of values for //! the organization attribute in the file_name entity. - Standard_EXPORT Standard_Integer NbOrganization() const; + Standard_EXPORT int NbOrganization() const; Standard_EXPORT void SetPreprocessorVersion( - const Handle(TCollection_HAsciiString)& aPreprocessorVersion); + const occ::handle& aPreprocessorVersion); //! Returns the name of the preprocessor_version for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) PreprocessorVersion() const; + Standard_EXPORT occ::handle PreprocessorVersion() const; Standard_EXPORT void SetOriginatingSystem( - const Handle(TCollection_HAsciiString)& aOriginatingSystem); + const occ::handle& aOriginatingSystem); - Standard_EXPORT Handle(TCollection_HAsciiString) OriginatingSystem() const; + Standard_EXPORT occ::handle OriginatingSystem() const; - Standard_EXPORT void SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation); + Standard_EXPORT void SetAuthorisation( + const occ::handle& aAuthorisation); //! Returns the value of the authorization attribute for the file_name entity. - Standard_EXPORT Handle(TCollection_HAsciiString) Authorisation() const; + Standard_EXPORT occ::handle Authorisation() const; //! Checks whether there is a file_schema entity. Returns True if there is one. - Standard_EXPORT Standard_Boolean HasFs() const; + Standard_EXPORT bool HasFs() const; //! Returns the file_schema entity. Returns an empty entity if the file_schema entity is not //! initialized. - Standard_EXPORT Handle(HeaderSection_FileSchema) FsValue() const; + Standard_EXPORT occ::handle FsValue() const; Standard_EXPORT void SetSchemaIdentifiers( - const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers); + const occ::handle>>& + aSchemaIdentifiers); Standard_EXPORT void SetSchemaIdentifiersValue( - const Standard_Integer num, - const Handle(TCollection_HAsciiString)& aSchemaIdentifier); + const int num, + const occ::handle& aSchemaIdentifier); - Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) SchemaIdentifiers() const; + Standard_EXPORT occ::handle>> + SchemaIdentifiers() const; //! Returns the value of the schema_identifier attribute for the file_schema entity. - Standard_EXPORT Handle(TCollection_HAsciiString) SchemaIdentifiersValue( - const Standard_Integer num) const; + Standard_EXPORT occ::handle SchemaIdentifiersValue(const int num) const; //! Returns the number of values for the schema_identifier attribute in the file_schema entity. - Standard_EXPORT Standard_Integer NbSchemaIdentifiers() const; + Standard_EXPORT int NbSchemaIdentifiers() const; //! Add a subname of schema (if not yet in the list) Standard_EXPORT void AddSchemaIdentifier( - const Handle(TCollection_HAsciiString)& aSchemaIdentifier); + const occ::handle& aSchemaIdentifier); //! Checks whether there is a file_description entity. Returns True if there is one. - Standard_EXPORT Standard_Boolean HasFd() const; + Standard_EXPORT bool HasFd() const; //! Returns the file_description //! entity. Returns an empty entity if the file_description entity is not initialized. - Standard_EXPORT Handle(HeaderSection_FileDescription) FdValue() const; + Standard_EXPORT occ::handle FdValue() const; - Standard_EXPORT void SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription); + Standard_EXPORT void SetDescription( + const occ::handle>>& aDescription); - Standard_EXPORT void SetDescriptionValue(const Standard_Integer num, - const Handle(TCollection_HAsciiString)& aDescription); + Standard_EXPORT void SetDescriptionValue( + const int num, + const occ::handle& aDescription); - Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Description() const; + Standard_EXPORT occ::handle>> + Description() const; //! Returns the value of the //! description attribute for the file_description entity. - Standard_EXPORT Handle(TCollection_HAsciiString) DescriptionValue( - const Standard_Integer num) const; + Standard_EXPORT occ::handle DescriptionValue(const int num) const; //! Returns the number of values for //! the file_description entity in the STEP file header. - Standard_EXPORT Standard_Integer NbDescription() const; + Standard_EXPORT int NbDescription() const; Standard_EXPORT void SetImplementationLevel( - const Handle(TCollection_HAsciiString)& aImplementationLevel); + const occ::handle& aImplementationLevel); //! Returns the value of the //! implementation_level attribute for the file_description entity. - Standard_EXPORT Handle(TCollection_HAsciiString) ImplementationLevel() const; + Standard_EXPORT occ::handle ImplementationLevel() const; -protected: private: - Standard_Boolean done; - Handle(HeaderSection_FileName) fn; - Handle(HeaderSection_FileSchema) fs; - Handle(HeaderSection_FileDescription) fd; + bool done; + occ::handle fn; + occ::handle fs; + occ::handle fd; }; #endif // _APIHeaderSection_MakeHeader_HeaderFile diff --git a/opencascade/Adaptor2d_Curve2d.hxx b/opencascade/Adaptor2d_Curve2d.hxx index 7e7f988fe..66c62c1f7 100644 --- a/opencascade/Adaptor2d_Curve2d.hxx +++ b/opencascade/Adaptor2d_Curve2d.hxx @@ -17,6 +17,7 @@ #ifndef _Adaptor2d_Curve2d_HeaderFile #define _Adaptor2d_Curve2d_HeaderFile +#include #include #include #include @@ -27,15 +28,11 @@ #include #include #include -#include +#include -class gp_Pnt2d; -class gp_Vec2d; class Geom2d_BezierCurve; class Geom2d_BSplineCurve; -DEFINE_STANDARD_HANDLE(Adaptor2d_Curve2d, Standard_Transient) - //! Root class for 2D curves on which geometric //! algorithms work. //! An adapted curve is an interface between the @@ -52,84 +49,82 @@ class Adaptor2d_Curve2d : public Standard_Transient DEFINE_STANDARD_RTTIEXT(Adaptor2d_Curve2d, Standard_Transient) public: //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const; + Standard_EXPORT virtual occ::handle ShallowCopy() const; - Standard_EXPORT virtual Standard_Real FirstParameter() const; + Standard_EXPORT virtual double FirstParameter() const; - Standard_EXPORT virtual Standard_Real LastParameter() const; + Standard_EXPORT virtual double LastParameter() const; Standard_EXPORT virtual GeomAbs_Shape Continuity() const; - //! If necessary, breaks the curve in intervals of - //! continuity . And returns the number of + //! If necessary, breaks the curve in intervals of + //! continuity . And returns the number of //! intervals. - Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const; + Standard_EXPORT virtual int NbIntervals(const GeomAbs_Shape S) const; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; + Standard_EXPORT virtual void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const; + Standard_EXPORT virtual occ::handle Trim(const double First, + const double Last, + const double Tol) const; - Standard_EXPORT virtual Standard_Boolean IsClosed() const; + Standard_EXPORT virtual bool IsClosed() const; - Standard_EXPORT virtual Standard_Boolean IsPeriodic() const; + Standard_EXPORT virtual bool IsPeriodic() const; - Standard_EXPORT virtual Standard_Real Period() const; + Standard_EXPORT virtual double Period() const; //! Computes the point of parameter U on the curve. - Standard_EXPORT virtual gp_Pnt2d Value(const Standard_Real U) const; + Standard_EXPORT virtual gp_Pnt2d Value(const double U) const; //! Computes the point of parameter U on the curve. - Standard_EXPORT virtual void D0(const Standard_Real U, gp_Pnt2d& P) const; + Standard_EXPORT virtual void D0(const double U, gp_Pnt2d& P) const; //! Computes the point of parameter U on the curve with its //! first derivative. //! Raised if the continuity of the current interval //! is not C1. - Standard_EXPORT virtual void D1(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const; + Standard_EXPORT virtual void D1(const double U, gp_Pnt2d& P, gp_Vec2d& V) const; //! Returns the point P of parameter U, the first and second //! derivatives V1 and V2. //! Raised if the continuity of the current interval //! is not C2. - Standard_EXPORT virtual void D2(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2) const; + Standard_EXPORT virtual void D2(const double U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const; //! Returns the point P of parameter U, the first, the second //! and the third derivative. //! Raised if the continuity of the current interval //! is not C3. - Standard_EXPORT virtual void D3(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) const; + Standard_EXPORT virtual void D3(const double U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const; //! The returned vector gives the value of the derivative for the //! order of derivation N. //! Raised if the continuity of the current interval //! is not CN. //! Raised if N < 1. - Standard_EXPORT virtual gp_Vec2d DN(const Standard_Real U, const Standard_Integer N) const; + Standard_EXPORT virtual gp_Vec2d DN(const double U, const int N) const; - //! Returns the parametric resolution corresponding + //! Returns the parametric resolution corresponding //! to the real space resolution . - Standard_EXPORT virtual Standard_Real Resolution(const Standard_Real R3d) const; + Standard_EXPORT virtual double Resolution(const double R3d) const; - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. Standard_EXPORT virtual GeomAbs_CurveType GetType() const; @@ -143,20 +138,41 @@ public: Standard_EXPORT virtual gp_Parab2d Parabola() const; - Standard_EXPORT virtual Standard_Integer Degree() const; + Standard_EXPORT virtual int Degree() const; + + Standard_EXPORT virtual bool IsRational() const; + + Standard_EXPORT virtual int NbPoles() const; + + Standard_EXPORT virtual int NbKnots() const; - Standard_EXPORT virtual Standard_Boolean IsRational() const; + Standard_EXPORT virtual int NbSamples() const; + + Standard_EXPORT virtual occ::handle Bezier() const; + + Standard_EXPORT virtual occ::handle BSpline() const; + + //! Computes the point of parameter U on the curve. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Pnt2d EvalD0(const double theU) const; - Standard_EXPORT virtual Standard_Integer NbPoles() const; + //! Computes the point and first derivative at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom2d_Curve::ResD1 EvalD1(const double theU) const; - Standard_EXPORT virtual Standard_Integer NbKnots() const; + //! Computes the point and first two derivatives at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom2d_Curve::ResD2 EvalD2(const double theU) const; - Standard_EXPORT virtual Standard_Integer NbSamples() const; + //! Computes the point and first three derivatives at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom2d_Curve::ResD3 EvalD3(const double theU) const; - Standard_EXPORT virtual Handle(Geom2d_BezierCurve) Bezier() const; + //! Computes the Nth derivative at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Vec2d EvalDN(const double theU, const int theN) const; - Standard_EXPORT virtual Handle(Geom2d_BSplineCurve) BSpline() const; - Standard_EXPORT virtual ~Adaptor2d_Curve2d(); + Standard_EXPORT ~Adaptor2d_Curve2d() override; }; #endif // _Adaptor2d_Curve2d_HeaderFile diff --git a/opencascade/Adaptor2d_Line2d.hxx b/opencascade/Adaptor2d_Line2d.hxx index 8b94ed898..ef3927842 100644 --- a/opencascade/Adaptor2d_Line2d.hxx +++ b/opencascade/Adaptor2d_Line2d.hxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include class gp_Pnt2d; @@ -46,105 +46,97 @@ class Adaptor2d_Line2d : public Adaptor2d_Curve2d public: Standard_EXPORT Adaptor2d_Line2d(); - Standard_EXPORT Adaptor2d_Line2d(const gp_Pnt2d& P, - const gp_Dir2d& D, - const Standard_Real UFirst, - const Standard_Real ULast); + Standard_EXPORT Adaptor2d_Line2d(const gp_Pnt2d& P, + const gp_Dir2d& D, + const double UFirst, + const double ULast); //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ShallowCopy() const override; Standard_EXPORT void Load(const gp_Lin2d& L); - Standard_EXPORT void Load(const gp_Lin2d& L, - const Standard_Real UFirst, - const Standard_Real ULast); + Standard_EXPORT void Load(const gp_Lin2d& L, const double UFirst, const double ULast); - Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; + Standard_EXPORT double FirstParameter() const override; - Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; + Standard_EXPORT double LastParameter() const override; - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity() const override; - //! If necessary, breaks the curve in intervals of - //! continuity . And returns the number of + //! If necessary, breaks the curve in intervals of + //! continuity . And returns the number of //! intervals. - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT Handle(Adaptor2d_Curve2d) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; + Standard_EXPORT bool IsClosed() const override; - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT bool IsPeriodic() const override; - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; + Standard_EXPORT double Period() const override; - Standard_EXPORT gp_Pnt2d Value(const Standard_Real X) const Standard_OVERRIDE; + Standard_EXPORT gp_Pnt2d Value(const double X) const override; - Standard_EXPORT void D0(const Standard_Real X, gp_Pnt2d& P) const Standard_OVERRIDE; + Standard_EXPORT void D0(const double X, gp_Pnt2d& P) const override; - Standard_EXPORT void D1(const Standard_Real X, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE; + Standard_EXPORT void D1(const double X, gp_Pnt2d& P, gp_Vec2d& V) const override; - Standard_EXPORT void D2(const Standard_Real X, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2) const Standard_OVERRIDE; + Standard_EXPORT void D2(const double X, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const override; - Standard_EXPORT void D3(const Standard_Real X, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) const Standard_OVERRIDE; + Standard_EXPORT void D3(const double X, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const override; - Standard_EXPORT gp_Vec2d DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; + Standard_EXPORT gp_Vec2d DN(const double U, const int N) const override; - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; + Standard_EXPORT double Resolution(const double R3d) const override; - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_CurveType GetType() const override; - Standard_EXPORT gp_Lin2d Line() const Standard_OVERRIDE; + Standard_EXPORT gp_Lin2d Line() const override; - Standard_EXPORT gp_Circ2d Circle() const Standard_OVERRIDE; + Standard_EXPORT gp_Circ2d Circle() const override; - Standard_EXPORT gp_Elips2d Ellipse() const Standard_OVERRIDE; + Standard_EXPORT gp_Elips2d Ellipse() const override; - Standard_EXPORT gp_Hypr2d Hyperbola() const Standard_OVERRIDE; + Standard_EXPORT gp_Hypr2d Hyperbola() const override; - Standard_EXPORT gp_Parab2d Parabola() const Standard_OVERRIDE; + Standard_EXPORT gp_Parab2d Parabola() const override; - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + Standard_EXPORT int NbPoles() const override; - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + Standard_EXPORT int NbKnots() const override; - Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Bezier() const override; - Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE; + Standard_EXPORT occ::handle BSpline() const override; private: - Standard_Real myUfirst; - Standard_Real myUlast; - gp_Ax2d myAx2d; + double myUfirst; + double myUlast; + gp_Ax2d myAx2d; }; -DEFINE_STANDARD_HANDLE(Adaptor2d_Line2d, Adaptor2d_Curve2d) - #endif // _Adaptor2d_Line2d_HeaderFile diff --git a/opencascade/Adaptor2d_OffsetCurve.hxx b/opencascade/Adaptor2d_OffsetCurve.hxx index 1407f72e3..9a4c7e057 100644 --- a/opencascade/Adaptor2d_OffsetCurve.hxx +++ b/opencascade/Adaptor2d_OffsetCurve.hxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include class gp_Pnt2d; class gp_Vec2d; @@ -42,150 +42,142 @@ public: Standard_EXPORT Adaptor2d_OffsetCurve(); //! The curve is loaded. The Offset is set to 0. - Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_Curve2d)& C); + Standard_EXPORT Adaptor2d_OffsetCurve(const occ::handle& C); - //! Creates an OffsetCurve curve. + //! Creates an OffsetCurve curve. //! The Offset is set to Offset. - Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real Offset); + Standard_EXPORT Adaptor2d_OffsetCurve(const occ::handle& C, + const double Offset); //! Create an Offset curve. //! WFirst,WLast define the bounds of the Offset curve. - Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real Offset, - const Standard_Real WFirst, - const Standard_Real WLast); + Standard_EXPORT Adaptor2d_OffsetCurve(const occ::handle& C, + const double Offset, + const double WFirst, + const double WLast); - //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE; + //! Shallow copy of adaptor. + Standard_EXPORT occ::handle ShallowCopy() const override; - //! Changes the curve. The Offset is reset to 0. - Standard_EXPORT void Load(const Handle(Adaptor2d_Curve2d)& S); + //! Changes the curve. The Offset is reset to 0. + Standard_EXPORT void Load(const occ::handle& S); //! Changes the Offset on the current Curve. - Standard_EXPORT void Load(const Standard_Real Offset); + Standard_EXPORT void Load(const double Offset); //! Changes the Offset Curve on the current Curve. - Standard_EXPORT void Load(const Standard_Real Offset, - const Standard_Real WFirst, - const Standard_Real WLast); + Standard_EXPORT void Load(const double Offset, const double WFirst, const double WLast); - const Handle(Adaptor2d_Curve2d)& Curve() const { return myCurve; } + const occ::handle& Curve() const { return myCurve; } - Standard_Real Offset() const { return myOffset; } + double Offset() const { return myOffset; } - virtual Standard_Real FirstParameter() const Standard_OVERRIDE { return myFirst; } + double FirstParameter() const override { return myFirst; } - virtual Standard_Real LastParameter() const Standard_OVERRIDE { return myLast; } + double LastParameter() const override { return myLast; } - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity() const override; - //! If necessary, breaks the curve in intervals of - //! continuity . And returns the number of + //! If necessary, breaks the curve in intervals of + //! continuity . And returns the number of //! intervals. - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT Handle(Adaptor2d_Curve2d) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; + Standard_EXPORT bool IsClosed() const override; - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT bool IsPeriodic() const override; - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; + Standard_EXPORT double Period() const override; //! Computes the point of parameter U on the curve. - Standard_EXPORT gp_Pnt2d Value(const Standard_Real U) const Standard_OVERRIDE; + Standard_EXPORT gp_Pnt2d Value(const double U) const override; //! Computes the point of parameter U on the curve. - Standard_EXPORT void D0(const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; + Standard_EXPORT void D0(const double U, gp_Pnt2d& P) const override; //! Computes the point of parameter U on the curve with its //! first derivative. //! Raised if the continuity of the current interval //! is not C1. - Standard_EXPORT void D1(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE; + Standard_EXPORT void D1(const double U, gp_Pnt2d& P, gp_Vec2d& V) const override; //! Returns the point P of parameter U, the first and second //! derivatives V1 and V2. //! Raised if the continuity of the current interval //! is not C2. - Standard_EXPORT void D2(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2) const Standard_OVERRIDE; + Standard_EXPORT void D2(const double U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const override; //! Returns the point P of parameter U, the first, the second //! and the third derivative. //! Raised if the continuity of the current interval //! is not C3. - Standard_EXPORT void D3(const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) const Standard_OVERRIDE; + Standard_EXPORT void D3(const double U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const override; //! The returned vector gives the value of the derivative for the //! order of derivation N. //! Raised if the continuity of the current interval //! is not CN. //! Raised if N < 1. - Standard_EXPORT gp_Vec2d DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; + Standard_EXPORT gp_Vec2d DN(const double U, const int N) const override; - //! Returns the parametric resolution corresponding + //! Returns the parametric resolution corresponding //! to the real space resolution . - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; + Standard_EXPORT double Resolution(const double R3d) const override; - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_CurveType GetType() const override; - Standard_EXPORT gp_Lin2d Line() const Standard_OVERRIDE; + Standard_EXPORT gp_Lin2d Line() const override; - Standard_EXPORT gp_Circ2d Circle() const Standard_OVERRIDE; + Standard_EXPORT gp_Circ2d Circle() const override; - Standard_EXPORT gp_Elips2d Ellipse() const Standard_OVERRIDE; + Standard_EXPORT gp_Elips2d Ellipse() const override; - Standard_EXPORT gp_Hypr2d Hyperbola() const Standard_OVERRIDE; + Standard_EXPORT gp_Hypr2d Hyperbola() const override; - Standard_EXPORT gp_Parab2d Parabola() const Standard_OVERRIDE; + Standard_EXPORT gp_Parab2d Parabola() const override; - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + Standard_EXPORT int NbPoles() const override; - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + Standard_EXPORT int NbKnots() const override; - Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Bezier() const override; - Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE; + Standard_EXPORT occ::handle BSpline() const override; - Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE; + Standard_EXPORT int NbSamples() const override; private: - Handle(Adaptor2d_Curve2d) myCurve; - Standard_Real myOffset; - Standard_Real myFirst; - Standard_Real myLast; + occ::handle myCurve; + double myOffset; + double myFirst; + double myLast; }; -DEFINE_STANDARD_HANDLE(Adaptor2d_OffsetCurve, Adaptor2d_Curve2d) - #endif // _Adaptor2d_OffsetCurve_HeaderFile diff --git a/opencascade/Adaptor3d_Curve.hxx b/opencascade/Adaptor3d_Curve.hxx index b5fed646a..22c30846d 100644 --- a/opencascade/Adaptor3d_Curve.hxx +++ b/opencascade/Adaptor3d_Curve.hxx @@ -17,6 +17,7 @@ #ifndef _Adaptor3d_Curve_HeaderFile #define _Adaptor3d_Curve_HeaderFile +#include #include #include #include @@ -25,17 +26,13 @@ #include #include #include -#include +#include #include -class gp_Pnt; -class gp_Vec; class Geom_BezierCurve; class Geom_BSplineCurve; class Geom_OffsetCurve; -DEFINE_STANDARD_HANDLE(Adaptor3d_Curve, Standard_Transient) - //! Root class for 3D curves on which geometric //! algorithms work. //! An adapted curve is an interface between the @@ -54,80 +51,95 @@ class Adaptor3d_Curve : public Standard_Transient DEFINE_STANDARD_RTTIEXT(Adaptor3d_Curve, Standard_Transient) public: //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const; + Standard_EXPORT virtual occ::handle ShallowCopy() const; - Standard_EXPORT virtual Standard_Real FirstParameter() const; + Standard_EXPORT virtual double FirstParameter() const; - Standard_EXPORT virtual Standard_Real LastParameter() const; + Standard_EXPORT virtual double LastParameter() const; Standard_EXPORT virtual GeomAbs_Shape Continuity() const; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const; + Standard_EXPORT virtual int NbIntervals(const GeomAbs_Shape S) const; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; + Standard_EXPORT virtual void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT virtual Handle(Adaptor3d_Curve) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const; + Standard_EXPORT virtual occ::handle Trim(const double First, + const double Last, + const double Tol) const; - Standard_EXPORT virtual Standard_Boolean IsClosed() const; + Standard_EXPORT virtual bool IsClosed() const; - Standard_EXPORT virtual Standard_Boolean IsPeriodic() const; + Standard_EXPORT virtual bool IsPeriodic() const; - Standard_EXPORT virtual Standard_Real Period() const; + Standard_EXPORT virtual double Period() const; //! Computes the point of parameter U on the curve. - Standard_EXPORT virtual gp_Pnt Value(const Standard_Real U) const; + gp_Pnt Value(const double theU) const { return EvalD0(theU); } //! Computes the point of parameter U on the curve. - Standard_EXPORT virtual void D0(const Standard_Real U, gp_Pnt& P) const; + void D0(const double theU, gp_Pnt& theP) const { theP = EvalD0(theU); } //! Computes the point of parameter U on the curve with its //! first derivative. //! Raised if the continuity of the current interval //! is not C1. - Standard_EXPORT virtual void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const; + void D1(const double theU, gp_Pnt& theP, gp_Vec& theV) const + { + const Geom_Curve::ResD1 aRes = EvalD1(theU); + theP = aRes.Point; + theV = aRes.D1; + } //! Returns the point P of parameter U, the first and second //! derivatives V1 and V2. //! Raised if the continuity of the current interval //! is not C2. - Standard_EXPORT virtual void D2(const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const; + void D2(const double theU, gp_Pnt& theP, gp_Vec& theV1, gp_Vec& theV2) const + { + const Geom_Curve::ResD2 aRes = EvalD2(theU); + theP = aRes.Point; + theV1 = aRes.D1; + theV2 = aRes.D2; + } //! Returns the point P of parameter U, the first, the second //! and the third derivative. //! Raised if the continuity of the current interval //! is not C3. - Standard_EXPORT virtual void D3(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) const; + void D3(const double theU, gp_Pnt& theP, gp_Vec& theV1, gp_Vec& theV2, gp_Vec& theV3) const + { + const Geom_Curve::ResD3 aRes = EvalD3(theU); + theP = aRes.Point; + theV1 = aRes.D1; + theV2 = aRes.D2; + theV3 = aRes.D3; + } //! The returned vector gives the value of the derivative for the //! order of derivation N. //! Raised if the continuity of the current interval //! is not CN. //! Raised if N < 1. - Standard_EXPORT virtual gp_Vec DN(const Standard_Real U, const Standard_Integer N) const; + gp_Vec DN(const double theU, const int theN) const { return EvalDN(theU, theN); } - //! Returns the parametric resolution corresponding + //! Returns the parametric resolution corresponding //! to the real space resolution . - Standard_EXPORT virtual Standard_Real Resolution(const Standard_Real R3d) const; + Standard_EXPORT virtual double Resolution(const double R3d) const; - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. Standard_EXPORT virtual GeomAbs_CurveType GetType() const; @@ -141,21 +153,41 @@ public: Standard_EXPORT virtual gp_Parab Parabola() const; - Standard_EXPORT virtual Standard_Integer Degree() const; + Standard_EXPORT virtual int Degree() const; + + Standard_EXPORT virtual bool IsRational() const; + + Standard_EXPORT virtual int NbPoles() const; + + Standard_EXPORT virtual int NbKnots() const; - Standard_EXPORT virtual Standard_Boolean IsRational() const; + Standard_EXPORT virtual occ::handle Bezier() const; - Standard_EXPORT virtual Standard_Integer NbPoles() const; + Standard_EXPORT virtual occ::handle BSpline() const; + + Standard_EXPORT virtual occ::handle OffsetCurve() const; + + //! Computes the point of parameter U on the curve. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Pnt EvalD0(const double theU) const; - Standard_EXPORT virtual Standard_Integer NbKnots() const; + //! Computes the point and first derivative at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Curve::ResD1 EvalD1(const double theU) const; - Standard_EXPORT virtual Handle(Geom_BezierCurve) Bezier() const; + //! Computes the point and first two derivatives at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Curve::ResD2 EvalD2(const double theU) const; - Standard_EXPORT virtual Handle(Geom_BSplineCurve) BSpline() const; + //! Computes the point and first three derivatives at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Curve::ResD3 EvalD3(const double theU) const; - Standard_EXPORT virtual Handle(Geom_OffsetCurve) OffsetCurve() const; + //! Computes the Nth derivative at parameter U. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Vec EvalDN(const double theU, const int theN) const; - Standard_EXPORT virtual ~Adaptor3d_Curve(); + Standard_EXPORT ~Adaptor3d_Curve() override; }; #endif // _Adaptor3d_Curve_HeaderFile diff --git a/opencascade/Adaptor3d_CurveOnSurface.hxx b/opencascade/Adaptor3d_CurveOnSurface.hxx index cf9f072ff..0b3a5b5bf 100644 --- a/opencascade/Adaptor3d_CurveOnSurface.hxx +++ b/opencascade/Adaptor3d_CurveOnSurface.hxx @@ -21,10 +21,9 @@ #include #include #include -#include -#include - -DEFINE_STANDARD_HANDLE(Adaptor3d_CurveOnSurface, Adaptor3d_Curve) +#include +#include +#include //! An interface between the services provided by a curve //! lying on a surface from the package Geom and those @@ -37,183 +36,160 @@ class Adaptor3d_CurveOnSurface : public Adaptor3d_Curve public: Standard_EXPORT Adaptor3d_CurveOnSurface(); - Standard_EXPORT Adaptor3d_CurveOnSurface(const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT Adaptor3d_CurveOnSurface(const occ::handle& S); //! Creates a CurveOnSurface from the 2d curve and //! the surface . - Standard_EXPORT Adaptor3d_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C, - const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT Adaptor3d_CurveOnSurface(const occ::handle& C, + const occ::handle& S); //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ShallowCopy() const override; //! Changes the surface. - Standard_EXPORT void Load(const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT void Load(const occ::handle& S); //! Changes the 2d curve. - Standard_EXPORT void Load(const Handle(Adaptor2d_Curve2d)& C); + Standard_EXPORT void Load(const occ::handle& C); //! Load both curve and surface. - Standard_EXPORT void Load(const Handle(Adaptor2d_Curve2d)& C, const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT void Load(const occ::handle& C, + const occ::handle& S); - Standard_EXPORT const Handle(Adaptor2d_Curve2d)& GetCurve() const; + Standard_EXPORT const occ::handle& GetCurve() const; - Standard_EXPORT const Handle(Adaptor3d_Surface)& GetSurface() const; + Standard_EXPORT const occ::handle& GetSurface() const; - Standard_EXPORT Handle(Adaptor2d_Curve2d)& ChangeCurve(); + Standard_EXPORT occ::handle& ChangeCurve(); - Standard_EXPORT Handle(Adaptor3d_Surface)& ChangeSurface(); + Standard_EXPORT occ::handle& ChangeSurface(); - Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; + Standard_EXPORT double FirstParameter() const override; - Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; + Standard_EXPORT double LastParameter() const override; - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity() const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT Handle(Adaptor3d_Curve) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT gp_Pnt Value(const Standard_Real U) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve with its - //! first derivative. - //! Raised if the continuity of the current interval - //! is not C1. - Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first and second - //! derivatives V1 and V2. - //! Raised if the continuity of the current interval - //! is not C2. - Standard_EXPORT void D2(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first, the second - //! and the third derivative. - //! Raised if the continuity of the current interval - //! is not C3. - Standard_EXPORT void D3(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) const Standard_OVERRIDE; - - //! The returned vector gives the value of the derivative for the - //! order of derivation N. - //! Raised if the continuity of the current interval - //! is not CN. - //! Raised if N < 1. - Standard_EXPORT gp_Vec DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; - - //! Returns the parametric resolution corresponding + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; + + Standard_EXPORT bool IsClosed() const override; + + Standard_EXPORT bool IsPeriodic() const override; + + Standard_EXPORT double Period() const override; + + //! Point evaluation. Raises an exception on failure. + [[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(const double theU) const final; + + //! D1 evaluation. Raises an exception on failure. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double theU) const final; + + //! D2 evaluation. Raises an exception on failure. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double theU) const final; + + //! D3 evaluation. Raises an exception on failure. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double theU) const final; + + //! DN evaluation. Raises an exception on failure. + [[nodiscard]] Standard_EXPORT gp_Vec EvalDN(const double theU, const int theN) const final; + + //! Returns the parametric resolution corresponding //! to the real space resolution . - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; + Standard_EXPORT double Resolution(const double R3d) const override; - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_CurveType GetType() const override; - Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; + Standard_EXPORT gp_Lin Line() const override; - Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; + Standard_EXPORT gp_Circ Circle() const override; - Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; + Standard_EXPORT gp_Elips Ellipse() const override; - Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; + Standard_EXPORT gp_Hypr Hyperbola() const override; - Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; + Standard_EXPORT gp_Parab Parabola() const override; - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + Standard_EXPORT int NbPoles() const override; - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + Standard_EXPORT int NbKnots() const override; - Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Bezier() const override; - Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; + Standard_EXPORT occ::handle BSpline() const override; private: Standard_EXPORT void EvalKPart(); - //! Evaluates myFirstSurf and myLastSurf + //! Evaluates myFirstSurf and myLastSurf //! for trimming the curve on surface. - //! Following methods output left-bottom and right-top points + //! Following methods output left-bottom and right-top points //! of located part on surface //! for trimming the curve on surface. Standard_EXPORT void EvalFirstLastSurf(); - Standard_EXPORT void LocatePart(const gp_Pnt2d& UV, - const gp_Vec2d& DUV, - const Handle(Adaptor3d_Surface)& S, - gp_Pnt2d& LeftBot, - gp_Pnt2d& RightTop) const; + Standard_EXPORT void LocatePart(const gp_Pnt2d& UV, + const gp_Vec2d& DUV, + const occ::handle& S, + gp_Pnt2d& LeftBot, + gp_Pnt2d& RightTop) const; - Standard_EXPORT Standard_Boolean LocatePart_RevExt(const gp_Pnt2d& UV, - const gp_Vec2d& DUV, - const Handle(Adaptor3d_Surface)& S, - gp_Pnt2d& LeftBot, - gp_Pnt2d& RightTop) const; + Standard_EXPORT bool LocatePart_RevExt(const gp_Pnt2d& UV, + const gp_Vec2d& DUV, + const occ::handle& S, + gp_Pnt2d& LeftBot, + gp_Pnt2d& RightTop) const; - Standard_EXPORT Standard_Boolean LocatePart_Offset(const gp_Pnt2d& UV, - const gp_Vec2d& DUV, - const Handle(Adaptor3d_Surface)& S, - gp_Pnt2d& LeftBot, - gp_Pnt2d& RightTop) const; + Standard_EXPORT bool LocatePart_Offset(const gp_Pnt2d& UV, + const gp_Vec2d& DUV, + const occ::handle& S, + gp_Pnt2d& LeftBot, + gp_Pnt2d& RightTop) const; //! Extracts the numbers of knots which equal //! the point and checks derivative components - //! by zero equivalence. - Standard_EXPORT void FindBounds(const TColStd_Array1OfReal& Arr, - const Standard_Real XYComp, - const Standard_Real DUVComp, - Standard_Integer& Bnd1, - Standard_Integer& Bnd2, - Standard_Boolean& DerIsNull) const; + //! by zero equivalence. + Standard_EXPORT void FindBounds(const NCollection_Array1& Arr, + const double XYComp, + const double DUVComp, + int& Bnd1, + int& Bnd2, + bool& DerIsNull) const; private: - Handle(Adaptor3d_Surface) mySurface; - Handle(Adaptor2d_Curve2d) myCurve; - GeomAbs_CurveType myType; - gp_Circ myCirc; - gp_Lin myLin; - Handle(Adaptor3d_Surface) myFirstSurf; - Handle(Adaptor3d_Surface) myLastSurf; - Handle(TColStd_HSequenceOfReal) myIntervals; - GeomAbs_Shape myIntCont; + occ::handle mySurface; + occ::handle myCurve; + GeomAbs_CurveType myType; + gp_Circ myCirc; + gp_Lin myLin; + occ::handle myFirstSurf; + occ::handle myLastSurf; + occ::handle> myIntervals; + GeomAbs_Shape myIntCont; }; #endif // _Adaptor3d_CurveOnSurface_HeaderFile diff --git a/opencascade/Adaptor3d_HSurfaceTool.hxx b/opencascade/Adaptor3d_HSurfaceTool.hxx index 076d8a2a3..8296b412e 100644 --- a/opencascade/Adaptor3d_HSurfaceTool.hxx +++ b/opencascade/Adaptor3d_HSurfaceTool.hxx @@ -35,158 +35,156 @@ #include #include #include -#include +#include class Adaptor3d_HSurfaceTool { public: DEFINE_STANDARD_ALLOC - static Standard_Real FirstUParameter(const Handle(Adaptor3d_Surface)& theSurf) + static double FirstUParameter(const occ::handle& theSurf) { return theSurf->FirstUParameter(); } - static Standard_Real FirstVParameter(const Handle(Adaptor3d_Surface)& theSurf) + static double FirstVParameter(const occ::handle& theSurf) { return theSurf->FirstVParameter(); } - static Standard_Real LastUParameter(const Handle(Adaptor3d_Surface)& theSurf) + static double LastUParameter(const occ::handle& theSurf) { return theSurf->LastUParameter(); } - static Standard_Real LastVParameter(const Handle(Adaptor3d_Surface)& theSurf) + static double LastVParameter(const occ::handle& theSurf) { return theSurf->LastVParameter(); } - static Standard_Integer NbUIntervals(const Handle(Adaptor3d_Surface)& theSurf, - const GeomAbs_Shape theSh) + static int NbUIntervals(const occ::handle& theSurf, const GeomAbs_Shape theSh) { return theSurf->NbUIntervals(theSh); } - static Standard_Integer NbVIntervals(const Handle(Adaptor3d_Surface)& theSurf, - const GeomAbs_Shape theSh) + static int NbVIntervals(const occ::handle& theSurf, const GeomAbs_Shape theSh) { return theSurf->NbVIntervals(theSh); } - static void UIntervals(const Handle(Adaptor3d_Surface)& theSurf, - TColStd_Array1OfReal& theTab, - const GeomAbs_Shape theSh) + static void UIntervals(const occ::handle& theSurf, + NCollection_Array1& theTab, + const GeomAbs_Shape theSh) { theSurf->UIntervals(theTab, theSh); } - static void VIntervals(const Handle(Adaptor3d_Surface)& theSurf, - TColStd_Array1OfReal& theTab, - const GeomAbs_Shape theSh) + static void VIntervals(const occ::handle& theSurf, + NCollection_Array1& theTab, + const GeomAbs_Shape theSh) { theSurf->VIntervals(theTab, theSh); } //! If >= - static Handle(Adaptor3d_Surface) UTrim(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theFirst, - const Standard_Real theLast, - const Standard_Real theTol) + static occ::handle UTrim(const occ::handle& theSurf, + const double theFirst, + const double theLast, + const double theTol) { return theSurf->UTrim(theFirst, theLast, theTol); } //! If >= - static Handle(Adaptor3d_Surface) VTrim(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theFirst, - const Standard_Real theLast, - const Standard_Real theTol) + static occ::handle VTrim(const occ::handle& theSurf, + const double theFirst, + const double theLast, + const double theTol) { return theSurf->VTrim(theFirst, theLast, theTol); } - static Standard_Boolean IsUClosed(const Handle(Adaptor3d_Surface)& theSurf) + static bool IsUClosed(const occ::handle& theSurf) { return theSurf->IsUClosed(); } - static Standard_Boolean IsVClosed(const Handle(Adaptor3d_Surface)& theSurf) + static bool IsVClosed(const occ::handle& theSurf) { return theSurf->IsVClosed(); } - static Standard_Boolean IsUPeriodic(const Handle(Adaptor3d_Surface)& theSurf) + static bool IsUPeriodic(const occ::handle& theSurf) { return theSurf->IsUPeriodic(); } - static Standard_Real UPeriod(const Handle(Adaptor3d_Surface)& theSurf) + static double UPeriod(const occ::handle& theSurf) { return theSurf->UPeriod(); } - static Standard_Boolean IsVPeriodic(const Handle(Adaptor3d_Surface)& theSurf) + static bool IsVPeriodic(const occ::handle& theSurf) { return theSurf->IsVPeriodic(); } - static Standard_Real VPeriod(const Handle(Adaptor3d_Surface)& theSurf) + static double VPeriod(const occ::handle& theSurf) { return theSurf->VPeriod(); } - static gp_Pnt Value(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV) + static gp_Pnt Value(const occ::handle& theSurf, + const double theU, + const double theV) { return theSurf->Value(theU, theV); } - static void D0(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV, - gp_Pnt& thePnt) + static void D0(const occ::handle& theSurf, + const double theU, + const double theV, + gp_Pnt& thePnt) { theSurf->D0(theU, theV, thePnt); } - static void D1(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV, - gp_Pnt& thePnt, - gp_Vec& theD1U, - gp_Vec& theD1V) + static void D1(const occ::handle& theSurf, + const double theU, + const double theV, + gp_Pnt& thePnt, + gp_Vec& theD1U, + gp_Vec& theD1V) { theSurf->D1(theU, theV, thePnt, theD1U, theD1V); } - static void D2(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV, - gp_Pnt& thePnt, - gp_Vec& theD1U, - gp_Vec& theD1V, - gp_Vec& theD2U, - gp_Vec& theD2V, - gp_Vec& theD2UV) + static void D2(const occ::handle& theSurf, + const double theU, + const double theV, + gp_Pnt& thePnt, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV) { theSurf->D2(theU, theV, thePnt, theD1U, theD1V, theD2U, theD2V, theD2UV); } - static void D3(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV, - gp_Pnt& thePnt, - gp_Vec& theD1U, - gp_Vec& theD1V, - gp_Vec& theD2U, - gp_Vec& theD2V, - gp_Vec& theD2UV, - gp_Vec& theD3U, - gp_Vec& theD3V, - gp_Vec& theD3UUV, - gp_Vec& theD3UVV) + static void D3(const occ::handle& theSurf, + const double theU, + const double theV, + gp_Pnt& thePnt, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV, + gp_Vec& theD3U, + gp_Vec& theD3V, + gp_Vec& theD3UUV, + gp_Vec& theD3UVV) { theSurf->D3(theU, theV, @@ -202,93 +200,96 @@ public: theD3UVV); } - static gp_Vec DN(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theU, - const Standard_Real theV, - const Standard_Integer theNU, - const Standard_Integer theNV) + static gp_Vec DN(const occ::handle& theSurf, + const double theU, + const double theV, + const int theNU, + const int theNV) { return theSurf->DN(theU, theV, theNU, theNV); } - static Standard_Real UResolution(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theR3d) + static double UResolution(const occ::handle& theSurf, const double theR3d) { return theSurf->UResolution(theR3d); } - static Standard_Real VResolution(const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theR3d) + static double VResolution(const occ::handle& theSurf, const double theR3d) { return theSurf->VResolution(theR3d); } - static GeomAbs_SurfaceType GetType(const Handle(Adaptor3d_Surface)& theSurf) + static GeomAbs_SurfaceType GetType(const occ::handle& theSurf) { return theSurf->GetType(); } - static gp_Pln Plane(const Handle(Adaptor3d_Surface)& theSurf) { return theSurf->Plane(); } + static gp_Pln Plane(const occ::handle& theSurf) { return theSurf->Plane(); } - static gp_Cylinder Cylinder(const Handle(Adaptor3d_Surface)& theSurf) + static gp_Cylinder Cylinder(const occ::handle& theSurf) { return theSurf->Cylinder(); } - static gp_Cone Cone(const Handle(Adaptor3d_Surface)& theSurf) { return theSurf->Cone(); } + static gp_Cone Cone(const occ::handle& theSurf) { return theSurf->Cone(); } - static gp_Torus Torus(const Handle(Adaptor3d_Surface)& theSurf) { return theSurf->Torus(); } + static gp_Torus Torus(const occ::handle& theSurf) { return theSurf->Torus(); } - static gp_Sphere Sphere(const Handle(Adaptor3d_Surface)& theSurf) { return theSurf->Sphere(); } + static gp_Sphere Sphere(const occ::handle& theSurf) + { + return theSurf->Sphere(); + } - static Handle(Geom_BezierSurface) Bezier(const Handle(Adaptor3d_Surface)& theSurf) + static occ::handle Bezier(const occ::handle& theSurf) { return theSurf->Bezier(); } - static Handle(Geom_BSplineSurface) BSpline(const Handle(Adaptor3d_Surface)& theSurf) + static occ::handle BSpline(const occ::handle& theSurf) { return theSurf->BSpline(); } - static gp_Ax1 AxeOfRevolution(const Handle(Adaptor3d_Surface)& theSurf) + static gp_Ax1 AxeOfRevolution(const occ::handle& theSurf) { return theSurf->AxeOfRevolution(); } - static gp_Dir Direction(const Handle(Adaptor3d_Surface)& theSurf) { return theSurf->Direction(); } + static gp_Dir Direction(const occ::handle& theSurf) + { + return theSurf->Direction(); + } - static Handle(Adaptor3d_Curve) BasisCurve(const Handle(Adaptor3d_Surface)& theSurf) + static occ::handle BasisCurve(const occ::handle& theSurf) { return theSurf->BasisCurve(); } - static Handle(Adaptor3d_Surface) BasisSurface(const Handle(Adaptor3d_Surface)& theSurf) + static occ::handle BasisSurface(const occ::handle& theSurf) { return theSurf->BasisSurface(); } - static Standard_Real OffsetValue(const Handle(Adaptor3d_Surface)& theSurf) + static double OffsetValue(const occ::handle& theSurf) { return theSurf->OffsetValue(); } - Standard_EXPORT static Standard_Boolean IsSurfG1( - const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Boolean theAlongU, - const Standard_Real theAngTol = Precision::Angular()); + Standard_EXPORT static bool IsSurfG1(const occ::handle& theSurf, + const bool theAlongU, + const double theAngTol = Precision::Angular()); - Standard_EXPORT static Standard_Integer NbSamplesU(const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT static int NbSamplesU(const occ::handle& S); - Standard_EXPORT static Standard_Integer NbSamplesV(const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT static int NbSamplesV(const occ::handle& S); - Standard_EXPORT static Standard_Integer NbSamplesU(const Handle(Adaptor3d_Surface)& S, - const Standard_Real u1, - const Standard_Real u2); + Standard_EXPORT static int NbSamplesU(const occ::handle& S, + const double u1, + const double u2); - Standard_EXPORT static Standard_Integer NbSamplesV(const Handle(Adaptor3d_Surface)&, - const Standard_Real v1, - const Standard_Real v2); + Standard_EXPORT static int NbSamplesV(const occ::handle&, + const double v1, + const double v2); }; #endif // _Adaptor3d_HSurfaceTool_HeaderFile diff --git a/opencascade/Adaptor3d_HVertex.hxx b/opencascade/Adaptor3d_HVertex.hxx index ccb6ffcfd..15dee8cb4 100644 --- a/opencascade/Adaptor3d_HVertex.hxx +++ b/opencascade/Adaptor3d_HVertex.hxx @@ -21,9 +21,6 @@ #include #include -class Adaptor3d_HVertex; -DEFINE_STANDARD_HANDLE(Adaptor3d_HVertex, Standard_Transient) - class Adaptor3d_HVertex : public Standard_Transient { @@ -32,25 +29,24 @@ public: Standard_EXPORT Adaptor3d_HVertex(const gp_Pnt2d& P, const TopAbs_Orientation Ori, - const Standard_Real Resolution); + const double Resolution); Standard_EXPORT virtual gp_Pnt2d Value(); - Standard_EXPORT virtual Standard_Real Parameter(const Handle(Adaptor2d_Curve2d)& C); + Standard_EXPORT virtual double Parameter(const occ::handle& C); //! Parametric resolution (2d). - Standard_EXPORT virtual Standard_Real Resolution(const Handle(Adaptor2d_Curve2d)& C); + Standard_EXPORT virtual double Resolution(const occ::handle& C); Standard_EXPORT virtual TopAbs_Orientation Orientation(); - Standard_EXPORT virtual Standard_Boolean IsSame(const Handle(Adaptor3d_HVertex)& Other); + Standard_EXPORT virtual bool IsSame(const occ::handle& Other); DEFINE_STANDARD_RTTIEXT(Adaptor3d_HVertex, Standard_Transient) -protected: private: gp_Pnt2d myPnt; - Standard_Real myTol; + double myTol; TopAbs_Orientation myOri; }; diff --git a/opencascade/Adaptor3d_InterFunc.hxx b/opencascade/Adaptor3d_InterFunc.hxx index a8ed38a9a..8f1026f47 100644 --- a/opencascade/Adaptor3d_InterFunc.hxx +++ b/opencascade/Adaptor3d_InterFunc.hxx @@ -22,8 +22,8 @@ class Adaptor2d_Curve2d; //! Used to find the points U(t) = U0 or V(t) = V0 in -//! order to determine the Cn discontinuities of an -//! Adpator_CurveOnSurface relatively to the +//! order to determine the Cn discontinuities of an +//! Adpator_CurveOnSurface relatively to the //! discontinuities of the surface. Used to //! find the roots of the functions class Adaptor3d_InterFunc : public math_FunctionWithDerivative @@ -31,35 +31,33 @@ class Adaptor3d_InterFunc : public math_FunctionWithDerivative public: DEFINE_STANDARD_ALLOC - //! build the function U(t)=FixVal if Fix =1 or + //! build the function U(t)=FixVal if Fix =1 or //! V(t)=FixVal if Fix=2 - Standard_EXPORT Adaptor3d_InterFunc(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real FixVal, - const Standard_Integer Fix); + Standard_EXPORT Adaptor3d_InterFunc(const occ::handle& C, + const double FixVal, + const int Fix); //! computes the value of the function for the variable . //! Returns True if the calculation were successfully done, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const Standard_Real X, Standard_Real& F); + Standard_EXPORT bool Value(const double X, double& F) override; //! computes the derivative of the function //! for the variable . //! Returns True if the calculation were successfully done, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivative(const Standard_Real X, Standard_Real& D); + Standard_EXPORT bool Derivative(const double X, double& D) override; //! computes the value and the derivative of the //! function for the variable . //! Returns True if the calculation were successfully done, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const Standard_Real X, - Standard_Real& F, - Standard_Real& D); + Standard_EXPORT bool Values(const double X, double& F, double& D) override; private: - Handle(Adaptor2d_Curve2d) myCurve2d; - Standard_Real myFixVal; - Standard_Integer myFix; + occ::handle myCurve2d; + double myFixVal; + int myFix; }; #endif // _Adaptor3d_InterFunc_HeaderFile diff --git a/opencascade/Adaptor3d_IsoCurve.hxx b/opencascade/Adaptor3d_IsoCurve.hxx index d90c4ec57..e9d82c63c 100644 --- a/opencascade/Adaptor3d_IsoCurve.hxx +++ b/opencascade/Adaptor3d_IsoCurve.hxx @@ -18,13 +18,12 @@ #define _Adaptor3d_IsoCurve_HeaderFile #include +#include #include -DEFINE_STANDARD_HANDLE(Adaptor3d_IsoCurve, Adaptor3d_Curve) - -//! Defines an isoparametric curve on a surface. The -//! type of isoparametric curve (U or V) is defined -//! with the enumeration IsoType from GeomAbs if +//! Defines an isoparametric curve on a surface. The +//! type of isoparametric curve (U or V) is defined +//! with the enumeration IsoType from GeomAbs if //! NoneIso is given an error is raised. class Adaptor3d_IsoCurve : public Adaptor3d_Curve { @@ -34,155 +33,135 @@ public: Standard_EXPORT Adaptor3d_IsoCurve(); //! The surface is loaded. The iso is set to NoneIso. - Standard_EXPORT Adaptor3d_IsoCurve(const Handle(Adaptor3d_Surface)& S); - - //! Creates an IsoCurve curve. Iso defines the - //! type (isoU or isoU) Param defines the value of - //! the iso. The bounds of the iso are the bounds - //! of the surface. - Standard_EXPORT Adaptor3d_IsoCurve(const Handle(Adaptor3d_Surface)& S, - const GeomAbs_IsoType Iso, - const Standard_Real Param); - - //! Create an IsoCurve curve. Iso defines the type - //! (isoU or isov). Param defines the value of the + Standard_EXPORT Adaptor3d_IsoCurve(const occ::handle& S); + + //! Creates an IsoCurve curve. Iso defines the type + //! (isoU or isoU) Param defines the value of the + //! iso. The bounds of the iso are the bounds of + //! the surface. + Standard_EXPORT Adaptor3d_IsoCurve(const occ::handle& S, + const GeomAbs_IsoType Iso, + const double Param); + + //! Create an IsoCurve curve. Iso defines the type + //! (isoU or isov). Param defines the value of the //! iso. WFirst,WLast define the bounds of the iso. - Standard_EXPORT Adaptor3d_IsoCurve(const Handle(Adaptor3d_Surface)& S, - const GeomAbs_IsoType Iso, - const Standard_Real Param, - const Standard_Real WFirst, - const Standard_Real WLast); + Standard_EXPORT Adaptor3d_IsoCurve(const occ::handle& S, + const GeomAbs_IsoType Iso, + const double Param, + const double WFirst, + const double WLast); //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ShallowCopy() const override; - //! Changes the surface. The iso is reset to - //! NoneIso. - Standard_EXPORT void Load(const Handle(Adaptor3d_Surface)& S); + //! Changes the surface. The iso is reset to NoneIso. + Standard_EXPORT void Load(const occ::handle& S); //! Changes the iso on the current surface. - Standard_EXPORT void Load(const GeomAbs_IsoType Iso, const Standard_Real Param); + Standard_EXPORT void Load(const GeomAbs_IsoType Iso, const double Param); //! Changes the iso on the current surface. Standard_EXPORT void Load(const GeomAbs_IsoType Iso, - const Standard_Real Param, - const Standard_Real WFirst, - const Standard_Real WLast); + const double Param, + const double WFirst, + const double WLast); - const Handle(Adaptor3d_Surface)& Surface() const { return mySurface; } + const occ::handle& Surface() const { return mySurface; } GeomAbs_IsoType Iso() const { return myIso; } - Standard_Real Parameter() const { return myParameter; } + double Parameter() const { return myParameter; } - virtual Standard_Real FirstParameter() const Standard_OVERRIDE { return myFirst; } + double FirstParameter() const override { return myFirst; } - virtual Standard_Real LastParameter() const Standard_OVERRIDE { return myLast; } + double LastParameter() const override { return myLast; } - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity() const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT Handle(Adaptor3d_Curve) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT gp_Pnt Value(const Standard_Real U) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve. - Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve with its - //! first derivative. - //! Raised if the continuity of the current interval - //! is not C1. - Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first and second - //! derivatives V1 and V2. - //! Raised if the continuity of the current interval - //! is not C2. - Standard_EXPORT void D2(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first, the second - //! and the third derivative. - //! Raised if the continuity of the current interval - //! is not C3. - Standard_EXPORT void D3(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) const Standard_OVERRIDE; - - //! The returned vector gives the value of the derivative for the - //! order of derivation N. - //! Raised if the continuity of the current interval - //! is not CN. - //! Raised if N < 1. - Standard_EXPORT gp_Vec DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; - - //! Returns the parametric resolution corresponding + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; + + Standard_EXPORT bool IsClosed() const override; + + Standard_EXPORT bool IsPeriodic() const override; + + Standard_EXPORT double Period() const override; + + //! Computes the point of parameter theU on the curve. + [[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(const double theU) const final; + + //! Computes the point of parameter theU on the curve with its first derivative. + //! Raised if the continuity of the current interval is not C1. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double theU) const final; + + //! Returns the point and the first and second derivatives at parameter theU. + //! Raised if the continuity of the current interval is not C2. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double theU) const final; + + //! Returns the point and the first, second and third derivatives at parameter theU. + //! Raised if the continuity of the current interval is not C3. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double theU) const final; + + //! Returns the derivative of order theN at parameter theU. + //! Raised if the continuity of the current interval is not CN. + //! Raised if theN < 1. + [[nodiscard]] Standard_EXPORT gp_Vec EvalDN(const double theU, const int theN) const final; + + //! Returns the parametric resolution corresponding //! to the real space resolution . - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; + Standard_EXPORT double Resolution(const double R3d) const override; - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_CurveType GetType() const override; - Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; + Standard_EXPORT gp_Lin Line() const override; - Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; + Standard_EXPORT gp_Circ Circle() const override; - Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; + Standard_EXPORT gp_Elips Ellipse() const override; - Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; + Standard_EXPORT gp_Hypr Hyperbola() const override; - Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; + Standard_EXPORT gp_Parab Parabola() const override; - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + Standard_EXPORT int NbPoles() const override; - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + Standard_EXPORT int NbKnots() const override; - Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Bezier() const override; - Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; + Standard_EXPORT occ::handle BSpline() const override; private: - Handle(Adaptor3d_Surface) mySurface; - GeomAbs_IsoType myIso; - Standard_Real myFirst; - Standard_Real myLast; - Standard_Real myParameter; + occ::handle mySurface; + GeomAbs_IsoType myIso; + double myFirst; + double myLast; + double myParameter; }; #endif // _Adaptor3d_IsoCurve_HeaderFile diff --git a/opencascade/Adaptor3d_Surface.hxx b/opencascade/Adaptor3d_Surface.hxx index 67e62521d..db863e67c 100644 --- a/opencascade/Adaptor3d_Surface.hxx +++ b/opencascade/Adaptor3d_Surface.hxx @@ -18,6 +18,7 @@ #define _Adaptor3d_Surface_HeaderFile #include +#include #include #include #include @@ -29,23 +30,21 @@ #include #include #include -#include +#include class Geom_BezierSurface; class Geom_BSplineSurface; -DEFINE_STANDARD_HANDLE(Adaptor3d_Surface, Standard_Transient) - //! Root class for surfaces on which geometric algorithms work. //! An adapted surface is an interface between the //! services provided by a surface and those required of //! the surface by algorithms which use it. //! A derived concrete class is provided: //! GeomAdaptor_Surface for a surface from the Geom package. -//! The Surface class describes the standard behaviour +//! The Surface class describes the standard behaviour //! of a surface for generic algorithms. //! -//! The Surface can be decomposed in intervals of any +//! The Surface can be decomposed in intervals of any //! continuity in U and V using the method NbIntervals. //! A current interval can be set. //! Most of the methods apply to the current interval. @@ -60,133 +59,159 @@ class Adaptor3d_Surface : public Standard_Transient DEFINE_STANDARD_RTTIEXT(Adaptor3d_Surface, Standard_Transient) public: //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const; + Standard_EXPORT virtual occ::handle ShallowCopy() const; - Standard_EXPORT virtual Standard_Real FirstUParameter() const; + Standard_EXPORT virtual double FirstUParameter() const; - Standard_EXPORT virtual Standard_Real LastUParameter() const; + Standard_EXPORT virtual double LastUParameter() const; - Standard_EXPORT virtual Standard_Real FirstVParameter() const; + Standard_EXPORT virtual double FirstVParameter() const; - Standard_EXPORT virtual Standard_Real LastVParameter() const; + Standard_EXPORT virtual double LastVParameter() const; Standard_EXPORT virtual GeomAbs_Shape UContinuity() const; Standard_EXPORT virtual GeomAbs_Shape VContinuity() const; - //! Returns the number of U intervals for continuity + //! Returns the number of U intervals for continuity //! . May be one if UContinuity(me) >= - Standard_EXPORT virtual Standard_Integer NbUIntervals(const GeomAbs_Shape S) const; + Standard_EXPORT virtual int NbUIntervals(const GeomAbs_Shape S) const; - //! Returns the number of V intervals for continuity + //! Returns the number of V intervals for continuity //! . May be one if VContinuity(me) >= - Standard_EXPORT virtual Standard_Integer NbVIntervals(const GeomAbs_Shape S) const; + Standard_EXPORT virtual int NbVIntervals(const GeomAbs_Shape S) const; - //! Returns the intervals with the requested continuity + //! Returns the intervals with the requested continuity //! in the U direction. - Standard_EXPORT virtual void UIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; + Standard_EXPORT virtual void UIntervals(NCollection_Array1& T, + const GeomAbs_Shape S) const; - //! Returns the intervals with the requested continuity + //! Returns the intervals with the requested continuity //! in the V direction. - Standard_EXPORT virtual void VIntervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; + Standard_EXPORT virtual void VIntervals(NCollection_Array1& T, + const GeomAbs_Shape S) const; - //! Returns a surface trimmed in the U direction - //! equivalent of between - //! parameters and . is used to + //! Returns a surface trimmed in the U direction + //! equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT virtual Handle(Adaptor3d_Surface) UTrim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const; + Standard_EXPORT virtual occ::handle UTrim(const double First, + const double Last, + const double Tol) const; - //! Returns a surface trimmed in the V direction between - //! parameters and . is used to + //! Returns a surface trimmed in the V direction between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT virtual Handle(Adaptor3d_Surface) VTrim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const; + Standard_EXPORT virtual occ::handle VTrim(const double First, + const double Last, + const double Tol) const; - Standard_EXPORT virtual Standard_Boolean IsUClosed() const; + Standard_EXPORT virtual bool IsUClosed() const; - Standard_EXPORT virtual Standard_Boolean IsVClosed() const; + Standard_EXPORT virtual bool IsVClosed() const; - Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const; + Standard_EXPORT virtual bool IsUPeriodic() const; - Standard_EXPORT virtual Standard_Real UPeriod() const; + Standard_EXPORT virtual double UPeriod() const; - Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const; + Standard_EXPORT virtual bool IsVPeriodic() const; - Standard_EXPORT virtual Standard_Real VPeriod() const; + Standard_EXPORT virtual double VPeriod() const; //! Computes the point of parameters U,V on the surface. //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. - Standard_EXPORT virtual gp_Pnt Value(const Standard_Real U, const Standard_Real V) const; + gp_Pnt Value(const double theU, const double theV) const { return EvalD0(theU, theV); } //! Computes the point of parameters U,V on the surface. - Standard_EXPORT virtual void D0(const Standard_Real U, const Standard_Real V, gp_Pnt& P) const; + void D0(const double theU, const double theV, gp_Pnt& theP) const { theP = EvalD0(theU, theV); } - //! Computes the point and the first derivatives on the surface. + //! Computes the point and the first derivatives on the surface. //! Raised if the continuity of the current intervals is not C1. //! //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. - Standard_EXPORT virtual void D1(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V) const; - - //! Computes the point, the first and second + void D1(const double theU, const double theV, gp_Pnt& theP, gp_Vec& theD1U, gp_Vec& theD1V) const + { + const Geom_Surface::ResD1 aRes = EvalD1(theU, theV); + theP = aRes.Point; + theD1U = aRes.D1U; + theD1V = aRes.D1V; + } + + //! Computes the point, the first and second //! derivatives on the surface. - //! Raised if the continuity of the current + //! Raised if the continuity of the current //! intervals is not C2. - Standard_EXPORT virtual void D2(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV) const; - - //! Computes the point, the first, second and third + void D2(const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV) const + { + const Geom_Surface::ResD2 aRes = EvalD2(theU, theV); + theP = aRes.Point; + theD1U = aRes.D1U; + theD1V = aRes.D1V; + theD2U = aRes.D2U; + theD2V = aRes.D2V; + theD2UV = aRes.D2UV; + } + + //! Computes the point, the first, second and third //! derivatives on the surface. - //! Raised if the continuity of the current + //! Raised if the continuity of the current //! intervals is not C3. - Standard_EXPORT virtual void D3(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV, - gp_Vec& D3U, - gp_Vec& D3V, - gp_Vec& D3UUV, - gp_Vec& D3UVV) const; + void D3(const double theU, + const double theV, + gp_Pnt& theP, + gp_Vec& theD1U, + gp_Vec& theD1V, + gp_Vec& theD2U, + gp_Vec& theD2V, + gp_Vec& theD2UV, + gp_Vec& theD3U, + gp_Vec& theD3V, + gp_Vec& theD3UUV, + gp_Vec& theD3UVV) const + { + const Geom_Surface::ResD3 aRes = EvalD3(theU, theV); + theP = aRes.Point; + theD1U = aRes.D1U; + theD1V = aRes.D1V; + theD2U = aRes.D2U; + theD2V = aRes.D2V; + theD2UV = aRes.D2UV; + theD3U = aRes.D3U; + theD3V = aRes.D3V; + theD3UUV = aRes.D3UUV; + theD3UVV = aRes.D3UVV; + } //! Computes the derivative of order Nu in the direction U and Nv //! in the direction V at the point P(U, V). - //! Raised if the current U interval is not not CNu + //! Raised if the current U interval is not not CNu //! and the current V interval is not CNv. //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. - Standard_EXPORT virtual gp_Vec DN(const Standard_Real U, - const Standard_Real V, - const Standard_Integer Nu, - const Standard_Integer Nv) const; + gp_Vec DN(const double theU, const double theV, const int theNu, const int theNv) const + { + return EvalDN(theU, theV, theNu, theNv); + } - //! Returns the parametric U resolution corresponding + //! Returns the parametric U resolution corresponding //! to the real space resolution . - Standard_EXPORT virtual Standard_Real UResolution(const Standard_Real R3d) const; + Standard_EXPORT virtual double UResolution(const double R3d) const; - //! Returns the parametric V resolution corresponding + //! Returns the parametric V resolution corresponding //! to the real space resolution . - Standard_EXPORT virtual Standard_Real VResolution(const Standard_Real R3d) const; + Standard_EXPORT virtual double VResolution(const double R3d) const; - //! Returns the type of the surface : Plane, Cylinder, - //! Cone, Sphere, Torus, BezierSurface, - //! BSplineSurface, SurfaceOfRevolution, + //! Returns the type of the surface: Plane, Cylinder, + //! Cone, Sphere, Torus, BezierSurface, + //! BSplineSurface, SurfaceOfRevolution, //! SurfaceOfExtrusion, OtherSurface Standard_EXPORT virtual GeomAbs_SurfaceType GetType() const; @@ -200,36 +225,63 @@ public: Standard_EXPORT virtual gp_Torus Torus() const; - Standard_EXPORT virtual Standard_Integer UDegree() const; + Standard_EXPORT virtual int UDegree() const; - Standard_EXPORT virtual Standard_Integer NbUPoles() const; + Standard_EXPORT virtual int NbUPoles() const; - Standard_EXPORT virtual Standard_Integer VDegree() const; + Standard_EXPORT virtual int VDegree() const; - Standard_EXPORT virtual Standard_Integer NbVPoles() const; + Standard_EXPORT virtual int NbVPoles() const; - Standard_EXPORT virtual Standard_Integer NbUKnots() const; + Standard_EXPORT virtual int NbUKnots() const; - Standard_EXPORT virtual Standard_Integer NbVKnots() const; + Standard_EXPORT virtual int NbVKnots() const; - Standard_EXPORT virtual Standard_Boolean IsURational() const; + Standard_EXPORT virtual bool IsURational() const; - Standard_EXPORT virtual Standard_Boolean IsVRational() const; + Standard_EXPORT virtual bool IsVRational() const; - Standard_EXPORT virtual Handle(Geom_BezierSurface) Bezier() const; + Standard_EXPORT virtual occ::handle Bezier() const; - Standard_EXPORT virtual Handle(Geom_BSplineSurface) BSpline() const; + Standard_EXPORT virtual occ::handle BSpline() const; Standard_EXPORT virtual gp_Ax1 AxeOfRevolution() const; Standard_EXPORT virtual gp_Dir Direction() const; - Standard_EXPORT virtual Handle(Adaptor3d_Curve) BasisCurve() const; + Standard_EXPORT virtual occ::handle BasisCurve() const; + + Standard_EXPORT virtual occ::handle BasisSurface() const; + + Standard_EXPORT virtual double OffsetValue() const; + + //! Computes the point of parameters (U, V) on the surface. + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Pnt EvalD0(const double theU, const double theV) const; + + //! Computes the point and first partial derivatives at (U, V). + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Surface::ResD1 EvalD1(const double theU, + const double theV) const; + + //! Computes the point and partial derivatives up to 2nd order at (U, V). + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Surface::ResD2 EvalD2(const double theU, + const double theV) const; + + //! Computes the point and partial derivatives up to 3rd order at (U, V). + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual Geom_Surface::ResD3 EvalD3(const double theU, + const double theV) const; - Standard_EXPORT virtual Handle(Adaptor3d_Surface) BasisSurface() const; + //! Computes the derivative of order Nu in U and Nv in V at (U, V). + //! Raises an exception on failure. + [[nodiscard]] Standard_EXPORT virtual gp_Vec EvalDN(const double theU, + const double theV, + const int theNu, + const int theNv) const; - Standard_EXPORT virtual Standard_Real OffsetValue() const; - Standard_EXPORT virtual ~Adaptor3d_Surface(); + Standard_EXPORT ~Adaptor3d_Surface() override; }; #endif // _Adaptor3d_Surface_HeaderFile diff --git a/opencascade/Adaptor3d_TopolTool.hxx b/opencascade/Adaptor3d_TopolTool.hxx index 6944cc499..576d8b775 100644 --- a/opencascade/Adaptor3d_TopolTool.hxx +++ b/opencascade/Adaptor3d_TopolTool.hxx @@ -20,15 +20,13 @@ #include #include #include -#include -#include +#include +#include #include #include class Adaptor3d_HVertex; -DEFINE_STANDARD_HANDLE(Adaptor3d_TopolTool, Standard_Transient) - //! This class provides a default topological tool, //! based on the Umin,Vmin,Umax,Vmax of an HSurface from Adaptor3d. //! All methods and fields may be redefined when inheriting from this class. @@ -39,98 +37,94 @@ class Adaptor3d_TopolTool : public Standard_Transient public: Standard_EXPORT Adaptor3d_TopolTool(); - Standard_EXPORT Adaptor3d_TopolTool(const Handle(Adaptor3d_Surface)& Surface); + Standard_EXPORT Adaptor3d_TopolTool(const occ::handle& Surface); Standard_EXPORT virtual void Initialize(); - Standard_EXPORT virtual void Initialize(const Handle(Adaptor3d_Surface)& S); + Standard_EXPORT virtual void Initialize(const occ::handle& S); - Standard_EXPORT virtual void Initialize(const Handle(Adaptor2d_Curve2d)& Curve); + Standard_EXPORT virtual void Initialize(const occ::handle& Curve); Standard_EXPORT virtual void Init(); - Standard_EXPORT virtual Standard_Boolean More(); + Standard_EXPORT virtual bool More(); - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) Value(); + Standard_EXPORT virtual occ::handle Value(); Standard_EXPORT virtual void Next(); Standard_EXPORT virtual void InitVertexIterator(); - Standard_EXPORT virtual Standard_Boolean MoreVertex(); + Standard_EXPORT virtual bool MoreVertex(); - Standard_EXPORT virtual Handle(Adaptor3d_HVertex) Vertex(); + Standard_EXPORT virtual occ::handle Vertex(); Standard_EXPORT virtual void NextVertex(); - Standard_EXPORT virtual TopAbs_State Classify( - const gp_Pnt2d& P, - const Standard_Real Tol, - const Standard_Boolean ReacdreOnPeriodic = Standard_True); + Standard_EXPORT virtual TopAbs_State Classify(const gp_Pnt2d& P, + const double Tol, + const bool ReacdreOnPeriodic = true); - Standard_EXPORT virtual Standard_Boolean IsThePointOn( - const gp_Pnt2d& P, - const Standard_Real Tol, - const Standard_Boolean ReacdreOnPeriodic = Standard_True); + Standard_EXPORT virtual bool IsThePointOn(const gp_Pnt2d& P, + const double Tol, + const bool ReacdreOnPeriodic = true); //! If the function returns the orientation of the arc. //! If the orientation is FORWARD or REVERSED, the arc is //! a "real" limit of the surface. //! If the orientation is INTERNAL or EXTERNAL, the arc is //! considered as an arc on the surface. - Standard_EXPORT virtual TopAbs_Orientation Orientation(const Handle(Adaptor2d_Curve2d)& C); + Standard_EXPORT virtual TopAbs_Orientation Orientation(const occ::handle& C); //! Returns the orientation of the vertex V. //! The vertex has been found with an exploration on //! a given arc. The orientation is the orientation //! of the vertex on this arc. - Standard_EXPORT virtual TopAbs_Orientation Orientation(const Handle(Adaptor3d_HVertex)& V); + Standard_EXPORT virtual TopAbs_Orientation Orientation(const occ::handle& V); //! Returns True if the vertices V1 and V2 are identical. //! This method does not take the orientation of the //! vertices in account. - Standard_EXPORT virtual Standard_Boolean Identical(const Handle(Adaptor3d_HVertex)& V1, - const Handle(Adaptor3d_HVertex)& V2); + Standard_EXPORT virtual bool Identical(const occ::handle& V1, + const occ::handle& V2); //! answers if arcs and vertices may have 3d representations, //! so that we could use Tol3d and Pnt methods. - Standard_EXPORT virtual Standard_Boolean Has3d() const; + Standard_EXPORT virtual bool Has3d() const; //! returns 3d tolerance of the arc C - Standard_EXPORT virtual Standard_Real Tol3d(const Handle(Adaptor2d_Curve2d)& C) const; + Standard_EXPORT virtual double Tol3d(const occ::handle& C) const; //! returns 3d tolerance of the vertex V - Standard_EXPORT virtual Standard_Real Tol3d(const Handle(Adaptor3d_HVertex)& V) const; + Standard_EXPORT virtual double Tol3d(const occ::handle& V) const; //! returns 3d point of the vertex V - Standard_EXPORT virtual gp_Pnt Pnt(const Handle(Adaptor3d_HVertex)& V) const; + Standard_EXPORT virtual gp_Pnt Pnt(const occ::handle& V) const; Standard_EXPORT virtual void ComputeSamplePoints(); //! compute the sample-points for the intersections algorithms - Standard_EXPORT virtual Standard_Integer NbSamplesU(); + Standard_EXPORT virtual int NbSamplesU(); //! compute the sample-points for the intersections algorithms - Standard_EXPORT virtual Standard_Integer NbSamplesV(); + Standard_EXPORT virtual int NbSamplesV(); //! compute the sample-points for the intersections algorithms - Standard_EXPORT virtual Standard_Integer NbSamples(); + Standard_EXPORT virtual int NbSamples(); //! return the set of U parameters on the surface //! obtained by the method SamplePnts - Standard_EXPORT void UParameters(TColStd_Array1OfReal& theArray) const; + Standard_EXPORT void UParameters(NCollection_Array1& theArray) const; //! return the set of V parameters on the surface //! obtained by the method SamplePnts - Standard_EXPORT void VParameters(TColStd_Array1OfReal& theArray) const; + Standard_EXPORT void VParameters(NCollection_Array1& theArray) const; - Standard_EXPORT virtual void SamplePoint(const Standard_Integer Index, - gp_Pnt2d& P2d, - gp_Pnt& P3d); + Standard_EXPORT virtual void SamplePoint(const int Index, gp_Pnt2d& P2d, gp_Pnt& P3d); - Standard_EXPORT virtual Standard_Boolean DomainIsInfinite(); + Standard_EXPORT virtual bool DomainIsInfinite(); - Standard_EXPORT virtual Standard_Address Edge() const; + Standard_EXPORT virtual void* Edge() const; //! Compute the sample-points for the intersections algorithms by adaptive algorithm for BSpline //! surfaces. For other surfaces algorithm is the same as in method ComputeSamplePoints(), but @@ -138,50 +132,48 @@ public: //! @param[in] theDefl a required deflection //! @param[in] theNUmin minimal nb points for U //! @param[in] theNVmin minimal nb points for V - Standard_EXPORT virtual void SamplePnts(const Standard_Real theDefl, - const Standard_Integer theNUmin, - const Standard_Integer theNVmin); + Standard_EXPORT virtual void SamplePnts(const double theDefl, + const int theNUmin, + const int theNVmin); //! Compute the sample-points for the intersections algorithms //! by adaptive algorithm for BSpline surfaces - is used in SamplePnts //! @param[in] theDefl required deflection //! @param[in] theNUmin minimal nb points for U //! @param[in] theNVmin minimal nb points for V - Standard_EXPORT virtual void BSplSamplePnts(const Standard_Real theDefl, - const Standard_Integer theNUmin, - const Standard_Integer theNVmin); + Standard_EXPORT virtual void BSplSamplePnts(const double theDefl, + const int theNUmin, + const int theNVmin); //! Returns true if provide uniform sampling of points. - Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const; + Standard_EXPORT virtual bool IsUniformSampling() const; //! Computes the cone's apex parameters. //! @param[in] theC conical surface //! @param[in] theU U parameter of cone's apex //! @param[in] theV V parameter of cone's apex - Standard_EXPORT static void GetConeApexParam(const gp_Cone& theC, - Standard_Real& theU, - Standard_Real& theV); + Standard_EXPORT static void GetConeApexParam(const gp_Cone& theC, double& theU, double& theV); DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool, Standard_Transient) protected: - Handle(Adaptor3d_Surface) myS; - Standard_Integer myNbSamplesU; - Standard_Integer myNbSamplesV; - Handle(TColStd_HArray1OfReal) myUPars; - Handle(TColStd_HArray1OfReal) myVPars; + occ::handle myS; + int myNbSamplesU; + int myNbSamplesV; + occ::handle> myUPars; + occ::handle> myVPars; private: - Standard_Integer nbRestr; - Standard_Integer idRestr; - Standard_Real Uinf; - Standard_Real Usup; - Standard_Real Vinf; - Standard_Real Vsup; - Handle(Adaptor2d_Line2d) myRestr[4]; - Standard_Integer nbVtx; - Standard_Integer idVtx; - Handle(Adaptor3d_HVertex) myVtx[2]; + int nbRestr; + int idRestr; + double Uinf; + double Usup; + double Vinf; + double Vsup; + occ::handle myRestr[4]; + int nbVtx; + int idVtx; + occ::handle myVtx[2]; }; #endif // _Adaptor3d_TopolTool_HeaderFile diff --git a/opencascade/AdvApp2Var_ApproxAFunc2Var.hxx b/opencascade/AdvApp2Var_ApproxAFunc2Var.hxx index 576e020ec..f8958104b 100644 --- a/opencascade/AdvApp2Var_ApproxAFunc2Var.hxx +++ b/opencascade/AdvApp2Var_ApproxAFunc2Var.hxx @@ -22,20 +22,21 @@ #include #include -#include +#include +#include #include #include #include #include #include -#include +#include #include #include class AdvApprox_Cutting; class AdvApp2Var_Criterion; class Geom_BSplineSurface; -//! Perform the approximation of F(U,V) +//! Perform the approximation of F(U,V) //! Arguments are : //! Num1DSS, Num2DSS, Num3DSS :The numbers of 1,2,3 dimensional subspaces //! OneDTol, TwoDTol, ThreeDTol: The tolerance of approximation in each @@ -55,9 +56,9 @@ class Geom_BSplineSurface; //! MaxDegInV : Maximum u-degree waiting in V //! Warning: //! MaxDegInU (resp. MaxDegInV) must be >= 2*iu (resp. iv) + 1, -//! where iu (resp. iv) = 0 if ContInU (resp. ContInV) = GeomAbs_C0, -//! = 1 if = GeomAbs_C1, -//! = 2 if = GeomAbs_C2. +//! where iu (resp. iv) = 0 if ContInU (resp. ContInV) = GeomAbs_C0, +//! = 1 if = GeomAbs_C1, +//! = 2 if = GeomAbs_C2. //! MaxPatch : Maximum number of Patch waiting //! number of Patch is number of u span * number of v span //! Func : The external method to evaluate F(U,V) @@ -86,121 +87,116 @@ class AdvApp2Var_ApproxAFunc2Var public: DEFINE_STANDARD_ALLOC - Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS, - const Standard_Integer Num2DSS, - const Standard_Integer Num3DSS, - const Handle(TColStd_HArray1OfReal)& OneDTol, - const Handle(TColStd_HArray1OfReal)& TwoDTol, - const Handle(TColStd_HArray1OfReal)& ThreeDTol, - const Handle(TColStd_HArray2OfReal)& OneDTolFr, - const Handle(TColStd_HArray2OfReal)& TwoDTolFr, - const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, - const Standard_Real FirstInU, - const Standard_Real LastInU, - const Standard_Real FirstInV, - const Standard_Real LastInV, - const GeomAbs_IsoType FavorIso, - const GeomAbs_Shape ContInU, - const GeomAbs_Shape ContInV, - const Standard_Integer PrecisCode, - const Standard_Integer MaxDegInU, - const Standard_Integer MaxDegInV, - const Standard_Integer MaxPatch, - const AdvApp2Var_EvaluatorFunc2Var& Func, - AdvApprox_Cutting& UChoice, - AdvApprox_Cutting& VChoice); - - Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS, - const Standard_Integer Num2DSS, - const Standard_Integer Num3DSS, - const Handle(TColStd_HArray1OfReal)& OneDTol, - const Handle(TColStd_HArray1OfReal)& TwoDTol, - const Handle(TColStd_HArray1OfReal)& ThreeDTol, - const Handle(TColStd_HArray2OfReal)& OneDTolFr, - const Handle(TColStd_HArray2OfReal)& TwoDTolFr, - const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, - const Standard_Real FirstInU, - const Standard_Real LastInU, - const Standard_Real FirstInV, - const Standard_Real LastInV, - const GeomAbs_IsoType FavorIso, - const GeomAbs_Shape ContInU, - const GeomAbs_Shape ContInV, - const Standard_Integer PrecisCode, - const Standard_Integer MaxDegInU, - const Standard_Integer MaxDegInV, - const Standard_Integer MaxPatch, - const AdvApp2Var_EvaluatorFunc2Var& Func, - const AdvApp2Var_Criterion& Crit, - AdvApprox_Cutting& UChoice, - AdvApprox_Cutting& VChoice); + Standard_EXPORT AdvApp2Var_ApproxAFunc2Var( + const int Num1DSS, + const int Num2DSS, + const int Num3DSS, + const occ::handle>& OneDTol, + const occ::handle>& TwoDTol, + const occ::handle>& ThreeDTol, + const occ::handle>& OneDTolFr, + const occ::handle>& TwoDTolFr, + const occ::handle>& ThreeDTolFr, + const double FirstInU, + const double LastInU, + const double FirstInV, + const double LastInV, + const GeomAbs_IsoType FavorIso, + const GeomAbs_Shape ContInU, + const GeomAbs_Shape ContInV, + const int PrecisCode, + const int MaxDegInU, + const int MaxDegInV, + const int MaxPatch, + const AdvApp2Var_EvaluatorFunc2Var& Func, + AdvApprox_Cutting& UChoice, + AdvApprox_Cutting& VChoice); + + Standard_EXPORT AdvApp2Var_ApproxAFunc2Var( + const int Num1DSS, + const int Num2DSS, + const int Num3DSS, + const occ::handle>& OneDTol, + const occ::handle>& TwoDTol, + const occ::handle>& ThreeDTol, + const occ::handle>& OneDTolFr, + const occ::handle>& TwoDTolFr, + const occ::handle>& ThreeDTolFr, + const double FirstInU, + const double LastInU, + const double FirstInV, + const double LastInV, + const GeomAbs_IsoType FavorIso, + const GeomAbs_Shape ContInU, + const GeomAbs_Shape ContInV, + const int PrecisCode, + const int MaxDegInU, + const int MaxDegInV, + const int MaxPatch, + const AdvApp2Var_EvaluatorFunc2Var& Func, + const AdvApp2Var_Criterion& Crit, + AdvApprox_Cutting& UChoice, + AdvApprox_Cutting& VChoice); //! True if the approximation succeeded within the imposed //! tolerances and the wished continuities - Standard_Boolean IsDone() const; + bool IsDone() const; //! True if the approximation did come out with a result that //! is not NECESSARELY within the required tolerance or a result //! that is not recognized with the wished continuities - Standard_Boolean HasResult() const; + bool HasResult() const; //! returns the BSplineSurface of range Index - Handle(Geom_BSplineSurface) Surface(const Standard_Integer Index) const; + occ::handle Surface(const int Index) const; - Standard_Integer UDegree() const; + int UDegree() const; - Standard_Integer VDegree() const; + int VDegree() const; - Standard_Integer NumSubSpaces(const Standard_Integer Dimension) const; + int NumSubSpaces(const int Dimension) const; //! returns the errors max - Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxError(const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> MaxError(const int Dimension) const; //! returns the average errors - Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageError( - const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> AverageError(const int Dimension) const; //! returns the errors max on UFrontiers //! Warning: //! Dimension must be equal to 3. - Standard_EXPORT Handle(TColStd_HArray1OfReal) UFrontError(const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> UFrontError(const int Dimension) const; //! returns the errors max on VFrontiers //! Warning: //! Dimension must be equal to 3. - Standard_EXPORT Handle(TColStd_HArray1OfReal) VFrontError(const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> VFrontError(const int Dimension) const; //! returns the error max of the BSplineSurface of range Index - Standard_EXPORT Standard_Real MaxError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double MaxError(const int Dimension, const int Index) const; //! returns the average error of the BSplineSurface of range Index - Standard_EXPORT Standard_Real AverageError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double AverageError(const int Dimension, const int Index) const; //! returns the error max of the BSplineSurface of range Index on a UFrontier - Standard_EXPORT Standard_Real UFrontError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double UFrontError(const int Dimension, const int Index) const; //! returns the error max of the BSplineSurface of range Index on a VFrontier - Standard_EXPORT Standard_Real VFrontError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double VFrontError(const int Dimension, const int Index) const; - Standard_EXPORT Standard_Real CritError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double CritError(const int Dimension, const int Index) const; //! Prints on the stream 'o' information on the current state //! of the object. Standard_EXPORT void Dump(Standard_OStream& o) const; -protected: private: //! Initialisation of the approximation ; used by Create Standard_EXPORT void Init(); //! Initialisation of the approximation with a grid of regular cuttings ; //! used by Init and Perform - Standard_EXPORT void InitGrid(const Standard_Integer NbInt); + Standard_EXPORT void InitGrid(const int NbInt); //! Computation of the approximation result ; used by Create Standard_EXPORT void Perform(const AdvApprox_Cutting& UChoice, @@ -245,45 +241,45 @@ private: //! Conversion of the approximation result in BSpline; used by Create Standard_EXPORT void ConvertBS(); - Standard_Integer myNumSubSpaces[3]; - Handle(TColStd_HArray1OfReal) my1DTolerances; - Handle(TColStd_HArray1OfReal) my2DTolerances; - Handle(TColStd_HArray1OfReal) my3DTolerances; - Handle(TColStd_HArray2OfReal) my1DTolOnFront; - Handle(TColStd_HArray2OfReal) my2DTolOnFront; - Handle(TColStd_HArray2OfReal) my3DTolOnFront; - Standard_Real myFirstParInU; - Standard_Real myLastParInU; - Standard_Real myFirstParInV; - Standard_Real myLastParInV; - GeomAbs_IsoType myFavoriteIso; - GeomAbs_Shape myContInU; - GeomAbs_Shape myContInV; - Standard_Integer myPrecisionCode; - Standard_Integer myMaxDegInU; - Standard_Integer myMaxDegInV; - Standard_Integer myMaxPatches; - AdvApp2Var_Context myConditions; - AdvApp2Var_Network myResult; - AdvApp2Var_Framework myConstraints; - Standard_Boolean myDone; - Standard_Boolean myHasResult; - Handle(TColGeom_HArray1OfSurface) mySurfaces; - Standard_Integer myDegreeInU; - Standard_Integer myDegreeInV; - Handle(TColStd_HArray1OfReal) my1DMaxError; - Handle(TColStd_HArray1OfReal) my1DAverageError; - Handle(TColStd_HArray1OfReal) my1DUFrontError; - Handle(TColStd_HArray1OfReal) my1DVFrontError; - Handle(TColStd_HArray1OfReal) my2DMaxError; - Handle(TColStd_HArray1OfReal) my2DAverageError; - Handle(TColStd_HArray1OfReal) my2DUFrontError; - Handle(TColStd_HArray1OfReal) my2DVFrontError; - Handle(TColStd_HArray1OfReal) my3DMaxError; - Handle(TColStd_HArray1OfReal) my3DAverageError; - Handle(TColStd_HArray1OfReal) my3DUFrontError; - Handle(TColStd_HArray1OfReal) my3DVFrontError; - Standard_Real myCriterionError; + int myNumSubSpaces[3]; + occ::handle> my1DTolerances; + occ::handle> my2DTolerances; + occ::handle> my3DTolerances; + occ::handle> my1DTolOnFront; + occ::handle> my2DTolOnFront; + occ::handle> my3DTolOnFront; + double myFirstParInU; + double myLastParInU; + double myFirstParInV; + double myLastParInV; + GeomAbs_IsoType myFavoriteIso; + GeomAbs_Shape myContInU; + GeomAbs_Shape myContInV; + int myPrecisionCode; + int myMaxDegInU; + int myMaxDegInV; + int myMaxPatches; + AdvApp2Var_Context myConditions; + AdvApp2Var_Network myResult; + AdvApp2Var_Framework myConstraints; + bool myDone; + bool myHasResult; + occ::handle>> mySurfaces; + int myDegreeInU; + int myDegreeInV; + occ::handle> my1DMaxError; + occ::handle> my1DAverageError; + occ::handle> my1DUFrontError; + occ::handle> my1DVFrontError; + occ::handle> my2DMaxError; + occ::handle> my2DAverageError; + occ::handle> my2DUFrontError; + occ::handle> my2DVFrontError; + occ::handle> my3DMaxError; + occ::handle> my3DAverageError; + occ::handle> my3DUFrontError; + occ::handle> my3DVFrontError; + double myCriterionError; }; #include diff --git a/opencascade/AdvApp2Var_ApproxAFunc2Var.lxx b/opencascade/AdvApp2Var_ApproxAFunc2Var.lxx index 622dcbf57..6e5f28734 100644 --- a/opencascade/AdvApp2Var_ApproxAFunc2Var.lxx +++ b/opencascade/AdvApp2Var_ApproxAFunc2Var.lxx @@ -12,37 +12,38 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include #include -inline Standard_Boolean AdvApp2Var_ApproxAFunc2Var::IsDone() const +inline bool AdvApp2Var_ApproxAFunc2Var::IsDone() const { return myDone; } -inline Standard_Boolean AdvApp2Var_ApproxAFunc2Var::HasResult() const +inline bool AdvApp2Var_ApproxAFunc2Var::HasResult() const { return myHasResult; } -inline Handle(Geom_BSplineSurface) AdvApp2Var_ApproxAFunc2Var::Surface( - const Standard_Integer SSPIndex) const +inline occ::handle AdvApp2Var_ApproxAFunc2Var::Surface( + const int SSPIndex) const { - return Handle(Geom_BSplineSurface)::DownCast(mySurfaces->Value(SSPIndex)); + return occ::down_cast(mySurfaces->Value(SSPIndex)); } -inline Standard_Integer AdvApp2Var_ApproxAFunc2Var::UDegree() const +inline int AdvApp2Var_ApproxAFunc2Var::UDegree() const { return myDegreeInU; } -inline Standard_Integer AdvApp2Var_ApproxAFunc2Var::VDegree() const +inline int AdvApp2Var_ApproxAFunc2Var::VDegree() const { return myDegreeInV; } -inline Standard_Integer AdvApp2Var_ApproxAFunc2Var::NumSubSpaces( - const Standard_Integer Dimension) const +inline int AdvApp2Var_ApproxAFunc2Var::NumSubSpaces(const int Dimension) const { return myNumSubSpaces[Dimension - 1]; } diff --git a/opencascade/AdvApp2Var_ApproxF2var.hxx b/opencascade/AdvApp2Var_ApproxF2var.hxx index 2f2859122..2e0d90567 100644 --- a/opencascade/AdvApp2Var_ApproxF2var.hxx +++ b/opencascade/AdvApp2Var_ApproxF2var.hxx @@ -21,188 +21,180 @@ #define AdvApp2Var_ApproxF2var_HeaderFile #include -#include #include // class AdvApp2Var_ApproxF2var { public: - Standard_EXPORT static int mma2fnc_(integer* ndimen, - integer* nbsesp, - integer* ndimse, - doublereal* uvfonc, + Standard_EXPORT static int mma2fnc_(int* ndimen, + int* nbsesp, + int* ndimse, + double* uvfonc, const AdvApp2Var_EvaluatorFunc2Var& foncnp, - doublereal* tconst, - integer* isofav, - integer* nbroot, - doublereal* rootlg, - integer* iordre, - integer* ideriv, - integer* ndgjac, - integer* nbcrmx, - integer* ncflim, - doublereal* epsapr, - integer* ncoeff, - doublereal* courbe, - integer* nbcrbe, - doublereal* somtab, - doublereal* diftab, - doublereal* contr1, - doublereal* contr2, - doublereal* tabdec, - doublereal* errmax, - doublereal* errmoy, - integer* iercod); - - Standard_EXPORT static int mma2roo_(integer* nbpntu, - integer* nbpntv, - doublereal* urootl, - doublereal* vrootl); - - Standard_EXPORT static int mma2jmx_(integer* ndgjac, integer* iordre, doublereal* xjacmx); - - Standard_EXPORT static int mmapptt_(const integer*, - const integer*, - const integer*, - doublereal*, - integer*); - - Standard_EXPORT static int mma2cdi_(integer* ndimen, - integer* nbpntu, - doublereal* urootl, - integer* nbpntv, - doublereal* vrootl, - integer* iordru, - integer* iordrv, - doublereal* contr1, - doublereal* contr2, - doublereal* contr3, - doublereal* contr4, - doublereal* sotbu1, - doublereal* sotbu2, - doublereal* ditbu1, - doublereal* ditbu2, - doublereal* sotbv1, - doublereal* sotbv2, - doublereal* ditbv1, - doublereal* ditbv2, - doublereal* sosotb, - doublereal* soditb, - doublereal* disotb, - doublereal* diditb, - integer* iercod); - - Standard_EXPORT static int mma2ds1_(integer* ndimen, - doublereal* uintfn, - doublereal* vintfn, + double* tconst, + int* isofav, + int* nbroot, + double* rootlg, + int* iordre, + int* ideriv, + int* ndgjac, + int* nbcrmx, + int* ncflim, + double* epsapr, + int* ncoeff, + double* courbe, + int* nbcrbe, + double* somtab, + double* diftab, + double* contr1, + double* contr2, + double* tabdec, + double* errmax, + double* errmoy, + int* iercod); + + Standard_EXPORT static int mma2roo_(int* nbpntu, int* nbpntv, double* urootl, double* vrootl); + + Standard_EXPORT static int mma2jmx_(int* ndgjac, int* iordre, double* xjacmx); + + Standard_EXPORT static int mmapptt_(const int*, const int*, const int*, double*, int*); + + Standard_EXPORT static int mma2cdi_(int* ndimen, + int* nbpntu, + double* urootl, + int* nbpntv, + double* vrootl, + int* iordru, + int* iordrv, + double* contr1, + double* contr2, + double* contr3, + double* contr4, + double* sotbu1, + double* sotbu2, + double* ditbu1, + double* ditbu2, + double* sotbv1, + double* sotbv2, + double* ditbv1, + double* ditbv2, + double* sosotb, + double* soditb, + double* disotb, + double* diditb, + int* iercod); + + Standard_EXPORT static int mma2ds1_(int* ndimen, + double* uintfn, + double* vintfn, const AdvApp2Var_EvaluatorFunc2Var& foncnp, - integer* nbpntu, - integer* nbpntv, - doublereal* urootb, - doublereal* vrootb, - integer* isofav, - doublereal* sosotb, - doublereal* disotb, - doublereal* soditb, - doublereal* diditb, - doublereal* fpntab, - doublereal* ttable, - integer* iercod); - - Standard_EXPORT static int mma2ce1_(integer* numdec, - integer* ndimen, - integer* nbsesp, - integer* ndimse, - integer* ndminu, - integer* ndminv, - integer* ndguli, - integer* ndgvli, - integer* ndjacu, - integer* ndjacv, - integer* iordru, - integer* iordrv, - integer* nbpntu, - integer* nbpntv, - doublereal* epsapr, - doublereal* sosotb, - doublereal* disotb, - doublereal* soditb, - doublereal* diditb, - doublereal* patjac, - doublereal* errmax, - doublereal* errmoy, - integer* ndegpu, - integer* ndegpv, - integer* itydec, - integer* iercod); - - Standard_EXPORT static int mma2can_(const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const doublereal*, - doublereal*, - doublereal*, - integer*); - - Standard_EXPORT static int mma1her_(const integer*, doublereal*, integer*); - - Standard_EXPORT static int mma2ac2_(const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const doublereal*, - const integer*, - const doublereal*, - const doublereal*, - doublereal*); - - Standard_EXPORT static int mma2ac3_(const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const doublereal*, - const integer*, - const doublereal*, - const doublereal*, - doublereal*); - - Standard_EXPORT static int mma2ac1_(const integer*, - const integer*, - const integer*, - const integer*, - const integer*, - const doublereal*, - const doublereal*, - const doublereal*, - const doublereal*, - const doublereal*, - const doublereal*, - doublereal*); - - Standard_EXPORT static int mma2fx6_(integer* ncfmxu, - integer* ncfmxv, - integer* ndimen, - integer* nbsesp, - integer* ndimse, - integer* nbupat, - integer* nbvpat, - integer* iordru, - integer* iordrv, - doublereal* epsapr, - doublereal* epsfro, - doublereal* patcan, - doublereal* errmax, - integer* ncoefu, - integer* ncoefv); + int* nbpntu, + int* nbpntv, + double* urootb, + double* vrootb, + int* isofav, + double* sosotb, + double* disotb, + double* soditb, + double* diditb, + double* fpntab, + double* ttable, + int* iercod); + + Standard_EXPORT static int mma2ce1_(int* numdec, + int* ndimen, + int* nbsesp, + int* ndimse, + int* ndminu, + int* ndminv, + int* ndguli, + int* ndgvli, + int* ndjacu, + int* ndjacv, + int* iordru, + int* iordrv, + int* nbpntu, + int* nbpntv, + double* epsapr, + double* sosotb, + double* disotb, + double* soditb, + double* diditb, + double* patjac, + double* errmax, + double* errmoy, + int* ndegpu, + int* ndegpv, + int* itydec, + int* iercod); + + Standard_EXPORT static int mma2can_(const int*, + const int*, + const int*, + const int*, + const int*, + const int*, + const int*, + const double*, + double*, + double*, + int*); + + Standard_EXPORT static int mma1her_(const int*, double*, int*); + + Standard_EXPORT static int mma2ac2_(const int*, + const int*, + const int*, + const int*, + const int*, + const int*, + const double*, + const int*, + const double*, + const double*, + double*); + + Standard_EXPORT static int mma2ac3_(const int*, + const int*, + const int*, + const int*, + const int*, + const int*, + const double*, + const int*, + const double*, + const double*, + double*); + + Standard_EXPORT static int mma2ac1_(const int*, + const int*, + const int*, + const int*, + const int*, + const double*, + const double*, + const double*, + const double*, + const double*, + const double*, + double*); + + Standard_EXPORT static int mma2fx6_(int* ncfmxu, + int* ncfmxv, + int* ndimen, + int* nbsesp, + int* ndimse, + int* nbupat, + int* nbvpat, + int* iordru, + int* iordrv, + double* epsapr, + double* epsfro, + double* patcan, + double* errmax, + int* ncoefu, + int* ncoefv); }; #endif diff --git a/opencascade/AdvApp2Var_Context.hxx b/opencascade/AdvApp2Var_Context.hxx index c37d16f51..40db691c0 100644 --- a/opencascade/AdvApp2Var_Context.hxx +++ b/opencascade/AdvApp2Var_Context.hxx @@ -22,11 +22,13 @@ #include #include -#include -#include +#include +#include +#include +#include -//! contains all the parameters for approximation -//! ( tolerancy, computing option, ...) +//! contains all the parameters for approximation +//! (tolerancy, computing option, ...) class AdvApp2Var_Context { public: @@ -34,81 +36,80 @@ public: Standard_EXPORT AdvApp2Var_Context(); - Standard_EXPORT AdvApp2Var_Context(const Standard_Integer ifav, - const Standard_Integer iu, - const Standard_Integer iv, - const Standard_Integer nlimu, - const Standard_Integer nlimv, - const Standard_Integer iprecis, - const Standard_Integer nb1Dss, - const Standard_Integer nb2Dss, - const Standard_Integer nb3Dss, - const Handle(TColStd_HArray1OfReal)& tol1D, - const Handle(TColStd_HArray1OfReal)& tol2D, - const Handle(TColStd_HArray1OfReal)& tol3D, - const Handle(TColStd_HArray2OfReal)& tof1D, - const Handle(TColStd_HArray2OfReal)& tof2D, - const Handle(TColStd_HArray2OfReal)& tof3D); + Standard_EXPORT AdvApp2Var_Context(const int ifav, + const int iu, + const int iv, + const int nlimu, + const int nlimv, + const int iprecis, + const int nb1Dss, + const int nb2Dss, + const int nb3Dss, + const occ::handle>& tol1D, + const occ::handle>& tol2D, + const occ::handle>& tol3D, + const occ::handle>& tof1D, + const occ::handle>& tof2D, + const occ::handle>& tof3D); - Standard_EXPORT Standard_Integer TotalDimension() const; + Standard_EXPORT int TotalDimension() const; - Standard_EXPORT Standard_Integer TotalNumberSSP() const; + Standard_EXPORT int TotalNumberSSP() const; - Standard_EXPORT Standard_Integer FavorIso() const; + Standard_EXPORT int FavorIso() const; - Standard_EXPORT Standard_Integer UOrder() const; + Standard_EXPORT int UOrder() const; - Standard_EXPORT Standard_Integer VOrder() const; + Standard_EXPORT int VOrder() const; - Standard_EXPORT Standard_Integer ULimit() const; + Standard_EXPORT int ULimit() const; - Standard_EXPORT Standard_Integer VLimit() const; + Standard_EXPORT int VLimit() const; - Standard_EXPORT Standard_Integer UJacDeg() const; + Standard_EXPORT int UJacDeg() const; - Standard_EXPORT Standard_Integer VJacDeg() const; + Standard_EXPORT int VJacDeg() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) UJacMax() const; + Standard_EXPORT occ::handle> UJacMax() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) VJacMax() const; + Standard_EXPORT occ::handle> VJacMax() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) URoots() const; + Standard_EXPORT occ::handle> URoots() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) VRoots() const; + Standard_EXPORT occ::handle> VRoots() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) UGauss() const; + Standard_EXPORT occ::handle> UGauss() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) VGauss() const; + Standard_EXPORT occ::handle> VGauss() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) IToler() const; + Standard_EXPORT occ::handle> IToler() const; - Standard_EXPORT Handle(TColStd_HArray2OfReal) FToler() const; + Standard_EXPORT occ::handle> FToler() const; - Standard_EXPORT Handle(TColStd_HArray2OfReal) CToler() const; + Standard_EXPORT occ::handle> CToler() const; -protected: private: - Standard_Integer myFav; - Standard_Integer myOrdU; - Standard_Integer myOrdV; - Standard_Integer myLimU; - Standard_Integer myLimV; - Standard_Integer myNb1DSS; - Standard_Integer myNb2DSS; - Standard_Integer myNb3DSS; - Standard_Integer myNbURoot; - Standard_Integer myNbVRoot; - Standard_Integer myJDegU; - Standard_Integer myJDegV; - Handle(TColStd_HArray1OfReal) myJMaxU; - Handle(TColStd_HArray1OfReal) myJMaxV; - Handle(TColStd_HArray1OfReal) myURoots; - Handle(TColStd_HArray1OfReal) myVRoots; - Handle(TColStd_HArray1OfReal) myUGauss; - Handle(TColStd_HArray1OfReal) myVGauss; - Handle(TColStd_HArray1OfReal) myInternalTol; - Handle(TColStd_HArray2OfReal) myFrontierTol; - Handle(TColStd_HArray2OfReal) myCuttingTol; + int myFav; + int myOrdU; + int myOrdV; + int myLimU; + int myLimV; + int myNb1DSS; + int myNb2DSS; + int myNb3DSS; + int myNbURoot; + int myNbVRoot; + int myJDegU; + int myJDegV; + occ::handle> myJMaxU; + occ::handle> myJMaxV; + occ::handle> myURoots; + occ::handle> myVRoots; + occ::handle> myUGauss; + occ::handle> myVGauss; + occ::handle> myInternalTol; + occ::handle> myFrontierTol; + occ::handle> myCuttingTol; }; #endif // _AdvApp2Var_Context_HeaderFile diff --git a/opencascade/AdvApp2Var_Criterion.hxx b/opencascade/AdvApp2Var_Criterion.hxx index f63c90626..28341fc93 100644 --- a/opencascade/AdvApp2Var_Criterion.hxx +++ b/opencascade/AdvApp2Var_Criterion.hxx @@ -38,20 +38,18 @@ public: Standard_EXPORT virtual void Value(AdvApp2Var_Patch& P, const AdvApp2Var_Context& C) const = 0; - Standard_EXPORT virtual Standard_Boolean IsSatisfied(const AdvApp2Var_Patch& P) const = 0; + Standard_EXPORT virtual bool IsSatisfied(const AdvApp2Var_Patch& P) const = 0; - Standard_EXPORT Standard_Real MaxValue() const; + Standard_EXPORT double MaxValue() const; Standard_EXPORT AdvApp2Var_CriterionType Type() const; Standard_EXPORT AdvApp2Var_CriterionRepartition Repartition() const; protected: - Standard_Real myMaxValue; + double myMaxValue; AdvApp2Var_CriterionType myType; AdvApp2Var_CriterionRepartition myRepartition; - -private: }; #endif // _AdvApp2Var_Criterion_HeaderFile diff --git a/opencascade/AdvApp2Var_Data.hxx b/opencascade/AdvApp2Var_Data.hxx deleted file mode 100644 index f2fc2ee1f..000000000 --- a/opencascade/AdvApp2Var_Data.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef AdvApp2Var_Data_HeaderFile -#define AdvApp2Var_Data_HeaderFile - -#include -#include - -// -struct mdnombr_1_ -{ - doublereal pi, deuxpi, pisur2, pis180, c180pi, zero, one, a180, a360, a90; -}; - -// -struct minombr_1_ -{ - integer nbr[1001]; -}; - -// -struct maovpar_1_ -{ - doublereal r8und, r8ovr, x4und, x4ovr; - real r4und, r4ovr; - integer r4nbe, r8nbm, r8nbe, i4ovr, i4ovn, r4exp, r8exp, r4exn, r8exn, r4ncs, r8ncs, r4nbm; - shortint i2ovr, i2ovn; -}; - -// -struct maovpch_1_ -{ - char cnmmac[16], frmr4[8], frmr8[8], cdcode[8]; -}; - -// -struct mlgdrtl_1_ -{ - doublereal rootab[930], // was [465][2] - hiltab[930], // was [465][2] - hi0tab[31]; -}; - -// -struct mmjcobi_1_ -{ - doublereal plgcan[3968]; // was [496][2][4] - doublereal canjac[3968]; // was [496][2][4] -}; - -// -struct mmcmcnp_1_ -{ - doublereal cnp[3721]; // was [61][61] ; -}; - -// -struct mmapgss_1_ -{ - doublereal gslxjs[5017], gsl0js[52]; -}; - -// -struct mmapgs0_1_ -{ - doublereal gslxj0[4761], gsl0j0[49]; -}; - -// -struct mmapgs1_1_ -{ - doublereal gslxj1[4505], gsl0j1[46]; -}; - -// -struct mmapgs2_1_ -{ - doublereal gslxj2[4249], gsl0j2[43]; -}; - -//// -class AdvApp2Var_Data -{ -public: - Standard_EXPORT static mdnombr_1_& Getmdnombr(); - Standard_EXPORT static minombr_1_& Getminombr(); - Standard_EXPORT static maovpar_1_& Getmaovpar(); - Standard_EXPORT static maovpch_1_& Getmaovpch(); - Standard_EXPORT static mlgdrtl_1_& Getmlgdrtl(); - Standard_EXPORT static mmjcobi_1_& Getmmjcobi(); - Standard_EXPORT static mmcmcnp_1_& Getmmcmcnp(); - Standard_EXPORT static mmapgss_1_& Getmmapgss(); - Standard_EXPORT static mmapgs0_1_& Getmmapgs0(); - Standard_EXPORT static mmapgs1_1_& Getmmapgs1(); - Standard_EXPORT static mmapgs2_1_& Getmmapgs2(); -}; - -// -#define mdnombr_ AdvApp2Var_Data::Getmdnombr() -#define minombr_ AdvApp2Var_Data::Getminombr() -#define maovpar_ AdvApp2Var_Data::Getmaovpar() -#define maovpch_ AdvApp2Var_Data::Getmaovpch() -#define mlgdrtl_ AdvApp2Var_Data::Getmlgdrtl() -#define mmjcobi_ AdvApp2Var_Data::Getmmjcobi() -#define mmcmcnp_ AdvApp2Var_Data::Getmmcmcnp() -#define mmapgss_ AdvApp2Var_Data::Getmmapgss() -#define mmapgs0_ AdvApp2Var_Data::Getmmapgs0() -#define mmapgs1_ AdvApp2Var_Data::Getmmapgs1() -#define mmapgs2_ AdvApp2Var_Data::Getmmapgs2() -// -#endif diff --git a/opencascade/AdvApp2Var_Data_f2c.hxx b/opencascade/AdvApp2Var_Data_f2c.hxx deleted file mode 100644 index 6aa1d5c43..000000000 --- a/opencascade/AdvApp2Var_Data_f2c.hxx +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -// AdvApp2Var_Data_f2c.hxx -#ifndef AdvApp2Var_Data_f2c_HeaderFile -#define AdvApp2Var_Data_f2c_HeaderFile - -#ifndef F2CTYPE_DEFINED -typedef int integer; -typedef double doublereal; - #define F2CTYPE_DEFINED -#endif - -typedef unsigned long uinteger; -typedef char* address; -typedef short int shortint; -typedef float real; - -typedef struct -{ - real r, i; -} complex; - -typedef struct -{ - doublereal r, i; -} doublecomplex; - -typedef long int logical; -typedef short int shortlogical; -typedef char logical1; -typedef char integer1; -#if 0 /* Adjust for integer*8. */ -typedef long long longint; /* system-dependent */ -typedef unsigned long long ulongint; /* system-dependent */ - #define qbit_clear(a, b) ((a) & ~((ulongint)1 << (b))) - #define qbit_set(a, b) ((a) | ((ulongint)1 << (b))) -#endif - -#define TRUE_ (1) -#define FALSE_ (0) - -/* Extern is for use with -E */ -#ifndef Extern - #define Extern extern -#endif - -/* I/O stuff */ - -#ifdef f2c_i2 -/* for -i2 */ -typedef short flag; -typedef short ftnlen; -typedef short ftnint; -#else -typedef long int flag; -typedef long int ftnlen; -typedef long int ftnint; -#endif - -/*external read, write*/ -typedef struct -{ - flag cierr; - ftnint ciunit; - flag ciend; - char* cifmt; - ftnint cirec; -} cilist; - -/*internal read, write*/ -typedef struct -{ - flag icierr; - char* iciunit; - flag iciend; - char* icifmt; - ftnint icirlen; - ftnint icirnum; -} icilist; - -/*open*/ -typedef struct -{ - flag oerr; - ftnint ounit; - char* ofnm; - ftnlen ofnmlen; - char* osta; - char* oacc; - char* ofm; - ftnint orl; - char* oblnk; -} olist; - -/*close*/ -typedef struct -{ - flag cerr; - ftnint cunit; - char* csta; -} cllist; - -/*rewind, backspace, endfile*/ -typedef struct -{ - flag aerr; - ftnint aunit; -} alist; - -/* inquire */ -typedef struct -{ - flag inerr; - ftnint inunit; - char* infile; - ftnlen infilen; - ftnint* inex; /*parameters in standard's order*/ - ftnint* inopen; - ftnint* innum; - ftnint* innamed; - char* inname; - ftnlen innamlen; - char* inacc; - ftnlen inacclen; - char* inseq; - ftnlen inseqlen; - char* indir; - ftnlen indirlen; - char* infmt; - ftnlen infmtlen; - char* inform; - ftnint informlen; - char* inunf; - ftnlen inunflen; - ftnint* inrecl; - ftnint* innrec; - char* inblank; - ftnlen inblanklen; -} inlist; - -#define VOID void - -union Multitype { /* for multiple entry points */ - integer1 g; - shortint h; - integer i; - /* longint j; */ - real r; - doublereal d; - complex c; - doublecomplex z; -}; - -typedef union Multitype Multitype; - -/*typedef long int Long;*/ /* No longer used; formerly in Namelist */ - -struct Vardesc -{ /* for Namelist */ - char* name; - char* addr; - ftnlen* dims; - int type; -}; -typedef struct Vardesc Vardesc; - -struct Namelist -{ - char* name; - Vardesc** vars; - int nvars; -}; -typedef struct Namelist Namelist; - -#define advapp_abs(x) ((x) >= 0 ? (x) : -(x)) -#define dabs(x) (doublereal) advapp_abs(x) -#define advapp_min(a, b) ((a) <= (b) ? (a) : (b)) -#define advapp_max(a, b) ((a) >= (b) ? (a) : (b)) -#define dmin(a, b) (doublereal) advapp_min(a, b) -#define dmax(a, b) (doublereal) advapp_max(a, b) -#define bit_test(a, b) ((a) >> (b) & 1) -#define bit_clear(a, b) ((a) & ~((uinteger)1 << (b))) -#define bit_set(a, b) ((a) | ((uinteger)1 << (b))) - -/* procedure parameter types for -A and -C++ */ - -#define F2C_proc_par_types 1 -#ifdef __cplusplus -typedef int /* Unknown procedure type */ (*U_fp)(...); -typedef shortint (*J_fp)(...); -typedef integer (*I_fp)(...); -typedef real (*R_fp)(...); -typedef doublereal (*D_fp)(...), (*E_fp)(...); -typedef /* Complex */ VOID (*C_fp)(...); -typedef /* Double Complex */ VOID (*Z_fp)(...); -typedef logical (*L_fp)(...); -typedef shortlogical (*K_fp)(...); -typedef /* Character */ VOID (*H_fp)(...); -typedef /* Subroutine */ int (*S_fp)(...); -#else -typedef int /* Unknown procedure type */ (*U_fp)(); -typedef shortint (*J_fp)(); -typedef integer (*I_fp)(); -typedef real (*R_fp)(); -typedef doublereal (*D_fp)(), (*E_fp)(); -typedef /* Complex */ VOID (*C_fp)(); -typedef /* Double Complex */ VOID (*Z_fp)(); -typedef logical (*L_fp)(); -typedef shortlogical (*K_fp)(); -typedef /* Character */ VOID (*H_fp)(); -typedef /* Subroutine */ int (*S_fp)(); -#endif -/* E_fp is for real functions when -R is not specified */ -typedef VOID C_f; /* complex function */ -typedef VOID H_f; /* character function */ -typedef VOID Z_f; /* double complex function */ -typedef doublereal E_f; /* real function with -R not specified */ - -/* undef any lower-case symbols that your C compiler predefines, e.g.: */ - -#ifndef Skip_f2c_Undefs - #undef cray - #undef gcos - #undef mc68010 - #undef mc68020 - #undef mips - #undef pdp11 - #undef sgi - #undef sparc - #undef sun - #undef sun2 - #undef sun3 - #undef sun4 - #undef u370 - #undef u3b - #undef u3b2 - #undef u3b5 - #undef unix - #undef vax -#endif -// #endif -#endif diff --git a/opencascade/AdvApp2Var_EvaluatorFunc2Var.hxx b/opencascade/AdvApp2Var_EvaluatorFunc2Var.hxx index ef90dbe69..93e1ac175 100644 --- a/opencascade/AdvApp2Var_EvaluatorFunc2Var.hxx +++ b/opencascade/AdvApp2Var_EvaluatorFunc2Var.hxx @@ -17,7 +17,23 @@ #ifndef AdvApp2Var_EvaluatorFunc2Var_HeaderFile #define AdvApp2Var_EvaluatorFunc2Var_HeaderFile -#include +#include + +#include + +#include + +#include + +#include + +#include + +#include + +#include + +#include // History - the C function pointer converted to a virtual class // in order to get rid of usage of static functions and static data @@ -25,36 +41,36 @@ class AdvApp2Var_EvaluatorFunc2Var { public: //! Empty constructor - AdvApp2Var_EvaluatorFunc2Var() {} + AdvApp2Var_EvaluatorFunc2Var() = default; //! Destructor should be declared as virtual - virtual ~AdvApp2Var_EvaluatorFunc2Var() {} + virtual ~AdvApp2Var_EvaluatorFunc2Var() = default; //! Function evaluation method to be defined by descendant - virtual void Evaluate(Standard_Integer* theDimension, - Standard_Real* theUStartEnd, //!< First and last parameters in U - Standard_Real* theVStartEnd, //!< First and last parameters in V - Standard_Integer* theFavorIso, //!< Choice of constante, 1 for U, 2 for V - Standard_Real* theConstParam, //!< Value of constant parameter - Standard_Integer* theNbParams, //!< Number of parameters N - Standard_Real* theParameters, //!< Values of parameters, - Standard_Integer* theUOrder, //!< Derivative Request in U - Standard_Integer* theVOrder, //!< Derivative Request in V - Standard_Real* theResult, //!< Result[Dimension,N] - Standard_Integer* theErrorCode) const = 0; + virtual void Evaluate(int* theDimension, + double* theUStartEnd, //!< First and last parameters in U + double* theVStartEnd, //!< First and last parameters in V + int* theFavorIso, //!< Choice of constante, 1 for U, 2 for V + double* theConstParam, //!< Value of constant parameter + int* theNbParams, //!< Number of parameters N + double* theParameters, //!< Values of parameters, + int* theUOrder, //!< Derivative Request in U + int* theVOrder, //!< Derivative Request in V + double* theResult, //!< Result[Dimension,N] + int* theErrorCode) const = 0; //! Shortcut for function-call style usage - void operator()(Standard_Integer* theDimension, - Standard_Real* theUStartEnd, - Standard_Real* theVStartEnd, - Standard_Integer* theFavorIso, - Standard_Real* theConstParam, - Standard_Integer* theNbParams, - Standard_Real* theParameters, - Standard_Integer* theUOrder, - Standard_Integer* theVOrder, - Standard_Real* theResult, - Standard_Integer* theErrorCode) const + void operator()(int* theDimension, + double* theUStartEnd, + double* theVStartEnd, + int* theFavorIso, + double* theConstParam, + int* theNbParams, + double* theParameters, + int* theUOrder, + int* theVOrder, + double* theResult, + int* theErrorCode) const { Evaluate(theDimension, theUStartEnd, @@ -70,11 +86,8 @@ public: } private: - //! Copy constructor is declared private to forbid copying - AdvApp2Var_EvaluatorFunc2Var(const AdvApp2Var_EvaluatorFunc2Var&) {} - - //! Assignment operator is declared private to forbid copying - void operator=(const AdvApp2Var_EvaluatorFunc2Var&) {} + AdvApp2Var_EvaluatorFunc2Var(const AdvApp2Var_EvaluatorFunc2Var&) = delete; + AdvApp2Var_EvaluatorFunc2Var& operator=(const AdvApp2Var_EvaluatorFunc2Var&) = delete; }; #endif diff --git a/opencascade/AdvApp2Var_Framework.hxx b/opencascade/AdvApp2Var_Framework.hxx index 987e5881b..38b81d83b 100644 --- a/opencascade/AdvApp2Var_Framework.hxx +++ b/opencascade/AdvApp2Var_Framework.hxx @@ -21,13 +21,15 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include +#include +#include class AdvApp2Var_Iso; class AdvApp2Var_Node; @@ -38,59 +40,58 @@ public: Standard_EXPORT AdvApp2Var_Framework(); - Standard_EXPORT AdvApp2Var_Framework(const AdvApp2Var_SequenceOfNode& Frame, - const AdvApp2Var_SequenceOfStrip& UFrontier, - const AdvApp2Var_SequenceOfStrip& VFrontier); + Standard_EXPORT AdvApp2Var_Framework( + const NCollection_Sequence>& Frame, + const NCollection_Sequence>>& UFrontier, + const NCollection_Sequence>>& VFrontier); //! search the Index of the first Iso not approximated, //! if all Isos are approximated NULL is returned. - Standard_EXPORT Handle(AdvApp2Var_Iso) FirstNotApprox(Standard_Integer& IndexIso, - Standard_Integer& IndexStrip) const; + Standard_EXPORT occ::handle FirstNotApprox(int& IndexIso, int& IndexStrip) const; - Standard_EXPORT Standard_Integer FirstNode(const GeomAbs_IsoType Type, - const Standard_Integer IndexIso, - const Standard_Integer IndexStrip) const; + Standard_EXPORT int FirstNode(const GeomAbs_IsoType Type, + const int IndexIso, + const int IndexStrip) const; - Standard_EXPORT Standard_Integer LastNode(const GeomAbs_IsoType Type, - const Standard_Integer IndexIso, - const Standard_Integer IndexStrip) const; + Standard_EXPORT int LastNode(const GeomAbs_IsoType Type, + const int IndexIso, + const int IndexStrip) const; - Standard_EXPORT void ChangeIso(const Standard_Integer IndexIso, - const Standard_Integer IndexStrip, - const Handle(AdvApp2Var_Iso)& anIso); + Standard_EXPORT void ChangeIso(const int IndexIso, + const int IndexStrip, + const occ::handle& anIso); - const Handle(AdvApp2Var_Node)& Node(const Standard_Integer IndexNode) const + const occ::handle& Node(const int IndexNode) const { return myNodeConstraints.Value(IndexNode); } - Standard_EXPORT const Handle(AdvApp2Var_Node)& Node(const Standard_Real U, - const Standard_Real V) const; + Standard_EXPORT const occ::handle& Node(const double U, const double V) const; - Standard_EXPORT const AdvApp2Var_Iso& IsoU(const Standard_Real U, - const Standard_Real V0, - const Standard_Real V1) const; + Standard_EXPORT const AdvApp2Var_Iso& IsoU(const double U, + const double V0, + const double V1) const; - Standard_EXPORT const AdvApp2Var_Iso& IsoV(const Standard_Real U0, - const Standard_Real U1, - const Standard_Real V) const; + Standard_EXPORT const AdvApp2Var_Iso& IsoV(const double U0, + const double U1, + const double V) const; - Standard_EXPORT void UpdateInU(const Standard_Real CuttingValue); + Standard_EXPORT void UpdateInU(const double CuttingValue); - Standard_EXPORT void UpdateInV(const Standard_Real CuttingValue); + Standard_EXPORT void UpdateInV(const double CuttingValue); - Standard_EXPORT const Handle(TColStd_HArray1OfReal)& UEquation( - const Standard_Integer IndexIso, - const Standard_Integer IndexStrip) const; + Standard_EXPORT const occ::handle>& UEquation( + const int IndexIso, + const int IndexStrip) const; - Standard_EXPORT const Handle(TColStd_HArray1OfReal)& VEquation( - const Standard_Integer IndexIso, - const Standard_Integer IndexStrip) const; + Standard_EXPORT const occ::handle>& VEquation( + const int IndexIso, + const int IndexStrip) const; private: - AdvApp2Var_SequenceOfNode myNodeConstraints; - AdvApp2Var_SequenceOfStrip myUConstraints; - AdvApp2Var_SequenceOfStrip myVConstraints; + NCollection_Sequence> myNodeConstraints; + NCollection_Sequence>> myUConstraints; + NCollection_Sequence>> myVConstraints; }; #endif // _AdvApp2Var_Framework_HeaderFile diff --git a/opencascade/AdvApp2Var_Iso.hxx b/opencascade/AdvApp2Var_Iso.hxx index 9d44d86fe..a56e7e91c 100644 --- a/opencascade/AdvApp2Var_Iso.hxx +++ b/opencascade/AdvApp2Var_Iso.hxx @@ -25,8 +25,10 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include class AdvApp2Var_Context; class AdvApp2Var_Node; @@ -38,43 +40,38 @@ class AdvApp2Var_Iso : public Standard_Transient public: Standard_EXPORT AdvApp2Var_Iso(); - Standard_EXPORT AdvApp2Var_Iso(const GeomAbs_IsoType type, - const Standard_Integer iu, - const Standard_Integer iv); + Standard_EXPORT AdvApp2Var_Iso(const GeomAbs_IsoType type, const int iu, const int iv); - Standard_EXPORT AdvApp2Var_Iso(const GeomAbs_IsoType type, - const Standard_Real cte, - const Standard_Real Ufirst, - const Standard_Real Ulast, - const Standard_Real Vfirst, - const Standard_Real Vlast, - const Standard_Integer pos, - const Standard_Integer iu, - const Standard_Integer iv); + Standard_EXPORT AdvApp2Var_Iso(const GeomAbs_IsoType type, + const double cte, + const double Ufirst, + const double Ulast, + const double Vfirst, + const double Vlast, + const int pos, + const int iu, + const int iv); - Standard_EXPORT Standard_Boolean IsApproximated() const; + Standard_EXPORT bool IsApproximated() const; - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; Standard_EXPORT void MakeApprox(const AdvApp2Var_Context& Conditions, - const Standard_Real a, - const Standard_Real b, - const Standard_Real c, - const Standard_Real d, + const double a, + const double b, + const double c, + const double d, const AdvApp2Var_EvaluatorFunc2Var& func, AdvApp2Var_Node& NodeBegin, AdvApp2Var_Node& NodeEnd); - Standard_EXPORT void ChangeDomain(const Standard_Real a, const Standard_Real b); + Standard_EXPORT void ChangeDomain(const double a, const double b); - Standard_EXPORT void ChangeDomain(const Standard_Real a, - const Standard_Real b, - const Standard_Real c, - const Standard_Real d); + Standard_EXPORT void ChangeDomain(const double a, const double b, const double c, const double d); - Standard_EXPORT void SetConstante(const Standard_Real newcte); + Standard_EXPORT void SetConstante(const double newcte); - Standard_EXPORT void SetPosition(const Standard_Integer newpos); + Standard_EXPORT void SetPosition(const int newpos); Standard_EXPORT void ResetApprox(); @@ -82,60 +79,60 @@ public: Standard_EXPORT GeomAbs_IsoType Type() const; - Standard_EXPORT Standard_Real Constante() const; + Standard_EXPORT double Constante() const; - Standard_EXPORT Standard_Real T0() const; + Standard_EXPORT double T0() const; - Standard_EXPORT Standard_Real T1() const; + Standard_EXPORT double T1() const; - Standard_EXPORT Standard_Real U0() const; + Standard_EXPORT double U0() const; - Standard_EXPORT Standard_Real U1() const; + Standard_EXPORT double U1() const; - Standard_EXPORT Standard_Real V0() const; + Standard_EXPORT double V0() const; - Standard_EXPORT Standard_Real V1() const; + Standard_EXPORT double V1() const; - Standard_EXPORT Standard_Integer UOrder() const; + Standard_EXPORT int UOrder() const; - Standard_EXPORT Standard_Integer VOrder() const; + Standard_EXPORT int VOrder() const; - Standard_EXPORT Standard_Integer Position() const; + Standard_EXPORT int Position() const; - Standard_EXPORT Standard_Integer NbCoeff() const; + Standard_EXPORT int NbCoeff() const; - Standard_EXPORT const Handle(TColStd_HArray1OfReal)& Polynom() const; + Standard_EXPORT const occ::handle>& Polynom() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) SomTab() const; + Standard_EXPORT occ::handle> SomTab() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) DifTab() const; + Standard_EXPORT occ::handle> DifTab() const; - Standard_EXPORT Handle(TColStd_HArray2OfReal) MaxErrors() const; + Standard_EXPORT occ::handle> MaxErrors() const; - Standard_EXPORT Handle(TColStd_HArray2OfReal) MoyErrors() const; + Standard_EXPORT occ::handle> MoyErrors() const; private: - AdvApp2Var_Iso(const AdvApp2Var_Iso& Other); - AdvApp2Var_Iso& operator=(const AdvApp2Var_Iso& theOther); + AdvApp2Var_Iso(const AdvApp2Var_Iso& theOther) = delete; + AdvApp2Var_Iso& operator=(const AdvApp2Var_Iso& theOther) = delete; private: - GeomAbs_IsoType myType; - Standard_Real myConstPar; - Standard_Real myU0; - Standard_Real myU1; - Standard_Real myV0; - Standard_Real myV1; - Standard_Integer myPosition; - Standard_Integer myExtremOrder; - Standard_Integer myDerivOrder; - Standard_Integer myNbCoeff; - Standard_Boolean myApprIsDone; - Standard_Boolean myHasResult; - Handle(TColStd_HArray1OfReal) myEquation; - Handle(TColStd_HArray2OfReal) myMaxErrors; - Handle(TColStd_HArray2OfReal) myMoyErrors; - Handle(TColStd_HArray1OfReal) mySomTab; - Handle(TColStd_HArray1OfReal) myDifTab; + GeomAbs_IsoType myType; + double myConstPar; + double myU0; + double myU1; + double myV0; + double myV1; + int myPosition; + int myExtremOrder; + int myDerivOrder; + int myNbCoeff; + bool myApprIsDone; + bool myHasResult; + occ::handle> myEquation; + occ::handle> myMaxErrors; + occ::handle> myMoyErrors; + occ::handle> mySomTab; + occ::handle> myDifTab; }; #endif // _AdvApp2Var_Iso_HeaderFile diff --git a/opencascade/AdvApp2Var_MathBase.hxx b/opencascade/AdvApp2Var_MathBase.hxx index b614b1f3f..bcf3add9a 100644 --- a/opencascade/AdvApp2Var_MathBase.hxx +++ b/opencascade/AdvApp2Var_MathBase.hxx @@ -16,289 +16,250 @@ #define AdvApp2Var_MathBase_HeaderFile #include -#include class AdvApp2Var_MathBase { public: /// - Standard_EXPORT static int mmapcmp_(integer*, integer*, integer*, double*, double*); - - Standard_EXPORT static int mmdrc11_(integer*, - integer*, - integer*, - doublereal*, - doublereal*, - doublereal*); - - Standard_EXPORT static int mmfmca9_(integer*, - integer*, - integer*, - integer*, - integer*, - integer*, - doublereal*, - doublereal*); - - Standard_EXPORT static int mmfmcb5_(integer*, - integer*, - integer*, - doublereal*, - integer*, - integer*, - integer*, - doublereal*, - integer*); - - Standard_EXPORT static void mmwprcs_(doublereal*, - doublereal*, - doublereal*, - doublereal*, - integer*, - integer*); + Standard_EXPORT static int mmapcmp_(int*, int*, int*, double*, double*); + + Standard_EXPORT static int mmdrc11_(int*, int*, int*, double*, double*, double*); + + Standard_EXPORT static int mmfmca9_(int*, int*, int*, int*, int*, int*, double*, double*); + + Standard_EXPORT static int mmfmcb5_(int*, int*, int*, double*, int*, int*, int*, double*, int*); + + Standard_EXPORT static void mmwprcs_(double*, double*, double*, double*, int*, int*); /// - Standard_EXPORT static int mmcglc1_(integer* ndimax, - integer* ndimen, - integer* ncoeff, - doublereal* courbe, - doublereal* tdebut, - doublereal* tfinal, - doublereal* epsiln, - doublereal* xlongc, - doublereal* erreur, - integer* iercod); - - Standard_EXPORT static int mmbulld_(integer* nbcoln, - integer* nblign, - doublereal* dtabtr, - integer* numcle); - - Standard_EXPORT static int mmcdriv_(integer* ndimen, - integer* ncoeff, - doublereal* courbe, - integer* ideriv, - integer* ncofdv, - doublereal* crvdrv); - - Standard_EXPORT static int mmcvctx_(integer* ndimen, - integer* ncofmx, - integer* nderiv, - doublereal* ctrtes, - doublereal* crvres, - doublereal* tabaux, - doublereal* xmatri, - integer* iercod); - - Standard_EXPORT static int mdsptpt_(integer* ndimen, - doublereal* point1, - doublereal* point2, - doublereal* distan); - - Standard_EXPORT static int mmaperx_(integer* ncofmx, - integer* ndimen, - integer* ncoeff, - integer* iordre, - doublereal* crvjac, - integer* ncfnew, - doublereal* ycvmax, - doublereal* errmax, - integer* iercod); - - Standard_EXPORT static int mmdrvck_(integer* ncoeff, - integer* ndimen, - doublereal* courbe, - integer* ideriv, - doublereal* tparam, - doublereal* pntcrb); - - Standard_EXPORT static int mmeps1_(doublereal* epsilo); - - Standard_EXPORT static int mmfmca8_(const integer* ndimen, - const integer* ncoefu, - const integer* ncoefv, - const integer* ndimax, - const integer* ncfumx, - const integer* ncfvmx, - doublereal* tabini, - doublereal* tabres); - - Standard_EXPORT static int mmfmcar_(integer* ndimen, - integer* ncofmx, - integer* ncoefu, - integer* ncoefv, - doublereal* patold, - doublereal* upara1, - doublereal* upara2, - doublereal* vpara1, - doublereal* vpara2, - doublereal* patnew, - integer* iercod); - - Standard_EXPORT static int mmfmtb1_(integer* maxsz1, - doublereal* table1, - integer* isize1, - integer* jsize1, - integer* maxsz2, - doublereal* table2, - integer* isize2, - integer* jsize2, - integer* iercod); - - Standard_EXPORT static int mmgaus1_( - integer* ndimf, - int (*bfunx)(integer* ninteg, - doublereal* parame, - doublereal* vfunj1, - integer* iercod), // mmfunj1_() from Smoothing.cxx - integer* k, - doublereal* xd, - doublereal* xf, - doublereal* saux1, - doublereal* saux2, - doublereal* somme, - integer* niter, - integer* iercod); - - Standard_EXPORT static int mmhjcan_(integer* ndimen, - integer* ncourb, - integer* ncftab, - integer* orcont, - integer* ncflim, - doublereal* tcbold, - doublereal* tdecop, - doublereal* tcbnew, - integer* iercod); - - Standard_EXPORT static int mminltt_(integer* ncolmx, - integer* nlgnmx, - doublereal* tabtri, - integer* nbrcol, - integer* nbrlgn, - doublereal* ajoute, - doublereal* epseg, - integer* iercod); - - Standard_EXPORT static int mmjaccv_(const integer* ncoef, - const integer* ndim, - const integer* ider, - const doublereal* crvlgd, - doublereal* polaux, - doublereal* crvcan); - - Standard_EXPORT static int mmpobas_(doublereal* tparam, - integer* iordre, - integer* ncoeff, - integer* nderiv, - doublereal* valbas, - integer* iercod); - - Standard_EXPORT static int mmmpocur_(integer* ncofmx, - integer* ndim, - integer* ndeg, - doublereal* courbe, - doublereal* tparam, - doublereal* tabval); - - Standard_EXPORT static int mmposui_(integer* dimmat, - integer* nistoc, - integer* aposit, - integer* posuiv, - integer* iercod); - - Standard_EXPORT static int mmresol_(integer* hdimen, - integer* gdimen, - integer* hnstoc, - integer* gnstoc, - integer* mnstoc, - doublereal* matsyh, - doublereal* matsyg, - doublereal* vecsyh, - doublereal* vecsyg, - integer* hposit, - integer* hposui, - integer* gposit, - integer* mmposui, - integer* mposit, - doublereal* vecsol, - integer* iercod); - - Standard_EXPORT static int mmrtptt_(integer* ndglgd, doublereal* rtlegd); - - Standard_EXPORT static int mmsrre2_(doublereal* tparam, - integer* nbrval, - doublereal* tablev, - doublereal* epsil, - integer* numint, - integer* itypen, - integer* iercod); - - Standard_EXPORT static int mmtrpjj_(integer* ncofmx, - integer* ndimen, - integer* ncoeff, - doublereal* epsi3d, - integer* iordre, - doublereal* crvlgd, - doublereal* ycvmax, - doublereal* errmax, - integer* ncfnew); - - Standard_EXPORT static int mmunivt_(integer* ndimen, - doublereal* vector, - doublereal* vecnrm, - doublereal* epsiln, - integer* iercod); - - Standard_EXPORT static int mmvncol_(integer* ndimen, - doublereal* vecin, - doublereal* vecout, - integer* iercod); - - Standard_EXPORT static doublereal msc_(integer* ndimen, doublereal* vecte1, doublereal* vecte2); - - Standard_EXPORT static int mvsheld_(integer* n, integer* is, doublereal* dtab, integer* icle); - - Standard_EXPORT static int mmarcin_(integer* ndimax, - integer* ndim, - integer* ncoeff, - doublereal* crvold, - doublereal* u0, - doublereal* u1, - doublereal* crvnew, - integer* iercod); - - Standard_EXPORT static int mmcvinv_(integer* ndimax, - integer* ncoef, - integer* ndim, - doublereal* curveo, - doublereal* curve); - - Standard_EXPORT static int mmjacan_(const integer* ideriv, - integer* ndeg, - doublereal* poljac, - doublereal* polcan); - - Standard_EXPORT static int mmpocrb_(integer* ndimax, - integer* ncoeff, - doublereal* courbe, - integer* ndim, - doublereal* tparam, - doublereal* pntcrb); - - Standard_EXPORT static int mmmrslwd_(integer* normax, - integer* nordre, - integer* ndim, - doublereal* amat, - doublereal* bmat, - doublereal* epspiv, - doublereal* aaux, - doublereal* xmat, - integer* iercod); - - Standard_EXPORT static int mmveps3_(doublereal* eps03); - - Standard_EXPORT static doublereal pow__di(doublereal* x, integer* n); - - Standard_EXPORT static doublereal mzsnorm_(integer* ndimen, doublereal* vecteu); + Standard_EXPORT static int mmcglc1_(int* ndimax, + int* ndimen, + int* ncoeff, + double* courbe, + double* tdebut, + double* tfinal, + double* epsiln, + double* xlongc, + double* erreur, + int* iercod); + + Standard_EXPORT static int mmbulld_(int* nbcoln, int* nblign, double* dtabtr, int* numcle); + + Standard_EXPORT static int mmcdriv_(int* ndimen, + int* ncoeff, + double* courbe, + int* ideriv, + int* ncofdv, + double* crvdrv); + + Standard_EXPORT static int mmcvctx_(int* ndimen, + int* ncofmx, + int* nderiv, + double* ctrtes, + double* crvres, + double* tabaux, + double* xmatri, + int* iercod); + + Standard_EXPORT static int mdsptpt_(int* ndimen, double* point1, double* point2, double* distan); + + Standard_EXPORT static int mmaperx_(int* ncofmx, + int* ndimen, + int* ncoeff, + int* iordre, + double* crvjac, + int* ncfnew, + double* ycvmax, + double* errmax, + int* iercod); + + Standard_EXPORT static int mmdrvck_(int* ncoeff, + int* ndimen, + double* courbe, + int* ideriv, + double* tparam, + double* pntcrb); + + Standard_EXPORT static int mmeps1_(double* epsilo); + + Standard_EXPORT static int mmfmca8_(const int* ndimen, + const int* ncoefu, + const int* ncoefv, + const int* ndimax, + const int* ncfumx, + const int* ncfvmx, + double* tabini, + double* tabres); + + Standard_EXPORT static int mmfmcar_(int* ndimen, + int* ncofmx, + int* ncoefu, + int* ncoefv, + double* patold, + double* upara1, + double* upara2, + double* vpara1, + double* vpara2, + double* patnew, + int* iercod); + + Standard_EXPORT static int mmfmtb1_(int* maxsz1, + double* table1, + int* isize1, + int* jsize1, + int* maxsz2, + double* table2, + int* isize2, + int* jsize2, + int* iercod); + + Standard_EXPORT static int mmgaus1_(int* ndimf, + int (*bfunx)(int* ninteg, + double* parame, + double* vfunj1, + int* iercod), // mmfunj1_() from Smoothing.cxx + int* k, + double* xd, + double* xf, + double* saux1, + double* saux2, + double* somme, + int* niter, + int* iercod); + + Standard_EXPORT static int mmhjcan_(int* ndimen, + int* ncourb, + int* ncftab, + int* orcont, + int* ncflim, + double* tcbold, + double* tdecop, + double* tcbnew, + int* iercod); + + Standard_EXPORT static int mminltt_(int* ncolmx, + int* nlgnmx, + double* tabtri, + int* nbrcol, + int* nbrlgn, + double* ajoute, + double* epseg, + int* iercod); + + Standard_EXPORT static int mmjaccv_(const int* ncoef, + const int* ndim, + const int* ider, + const double* crvlgd, + double* polaux, + double* crvcan); + + Standard_EXPORT static int mmpobas_(double* tparam, + int* iordre, + int* ncoeff, + int* nderiv, + double* valbas, + int* iercod); + + Standard_EXPORT static int mmmpocur_(int* ncofmx, + int* ndim, + int* ndeg, + double* courbe, + double* tparam, + double* tabval); + + Standard_EXPORT static int mmposui_(int* dimmat, + int* nistoc, + int* aposit, + int* posuiv, + int* iercod); + + Standard_EXPORT static int mmresol_(int* hdimen, + int* gdimen, + int* hnstoc, + int* gnstoc, + int* mnstoc, + double* matsyh, + double* matsyg, + double* vecsyh, + double* vecsyg, + int* hposit, + int* hposui, + int* gposit, + int* mmposui, + int* mposit, + double* vecsol, + int* iercod); + + Standard_EXPORT static int mmrtptt_(int* ndglgd, double* rtlegd); + + Standard_EXPORT static int mmsrre2_(double* tparam, + int* nbrval, + double* tablev, + double* epsil, + int* numint, + int* itypen, + int* iercod); + + Standard_EXPORT static int mmtrpjj_(int* ncofmx, + int* ndimen, + int* ncoeff, + double* epsi3d, + int* iordre, + double* crvlgd, + double* ycvmax, + double* errmax, + int* ncfnew); + + Standard_EXPORT static int mmunivt_(int* ndimen, + double* vector, + double* vecnrm, + double* epsiln, + int* iercod); + + Standard_EXPORT static int mmvncol_(int* ndimen, double* vecin, double* vecout, int* iercod); + + Standard_EXPORT static double msc_(int* ndimen, double* vecte1, double* vecte2); + + Standard_EXPORT static int mvsheld_(int* n, int* is, double* dtab, int* icle); + + Standard_EXPORT static int mmarcin_(int* ndimax, + int* ndim, + int* ncoeff, + double* crvold, + double* u0, + double* u1, + double* crvnew, + int* iercod); + + Standard_EXPORT static int mmcvinv_(int* ndimax, + int* ncoef, + int* ndim, + double* curveo, + double* curve); + + Standard_EXPORT static int mmjacan_(const int* ideriv, int* ndeg, double* poljac, double* polcan); + + Standard_EXPORT static int mmpocrb_(int* ndimax, + int* ncoeff, + double* courbe, + int* ndim, + double* tparam, + double* pntcrb); + + Standard_EXPORT static int mmmrslwd_(int* normax, + int* nordre, + int* ndim, + double* amat, + double* bmat, + double* epspiv, + double* aaux, + double* xmat, + int* iercod); + + Standard_EXPORT static int mmveps3_(double* eps03); + + Standard_EXPORT static double pow__di(double* x, int* n); + + Standard_EXPORT static double mzsnorm_(int* ndimen, double* vecteu); }; #endif diff --git a/opencascade/AdvApp2Var_Network.hxx b/opencascade/AdvApp2Var_Network.hxx index ad127ddff..7f275a916 100644 --- a/opencascade/AdvApp2Var_Network.hxx +++ b/opencascade/AdvApp2Var_Network.hxx @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include class AdvApp2Var_Patch; @@ -33,52 +33,48 @@ public: Standard_EXPORT AdvApp2Var_Network(); - Standard_EXPORT AdvApp2Var_Network(const AdvApp2Var_SequenceOfPatch& Net, - const TColStd_SequenceOfReal& TheU, - const TColStd_SequenceOfReal& TheV); + Standard_EXPORT AdvApp2Var_Network(const NCollection_Sequence>& Net, + const NCollection_Sequence& TheU, + const NCollection_Sequence& TheV); //! search the Index of the first Patch not approximated, - //! if all Patches are approximated Standard_False is returned - Standard_EXPORT Standard_Boolean FirstNotApprox(Standard_Integer& Index) const; + //! if all Patches are approximated false is returned + Standard_EXPORT bool FirstNotApprox(int& Index) const; - AdvApp2Var_Patch& ChangePatch(const Standard_Integer Index) { return *myNet.Value(Index); } + AdvApp2Var_Patch& ChangePatch(const int Index) { return *myNet.Value(Index); } - AdvApp2Var_Patch& operator()(const Standard_Integer Index) { return ChangePatch(Index); } + AdvApp2Var_Patch& operator()(const int Index) { return ChangePatch(Index); } - Standard_EXPORT void UpdateInU(const Standard_Real CuttingValue); + Standard_EXPORT void UpdateInU(const double CuttingValue); - Standard_EXPORT void UpdateInV(const Standard_Real CuttingValue); + Standard_EXPORT void UpdateInV(const double CuttingValue); - Standard_EXPORT void SameDegree(const Standard_Integer iu, - const Standard_Integer iv, - Standard_Integer& ncfu, - Standard_Integer& ncfv); + Standard_EXPORT void SameDegree(const int iu, const int iv, int& ncfu, int& ncfv); - Standard_EXPORT Standard_Integer NbPatch() const; + Standard_EXPORT int NbPatch() const; - Standard_EXPORT Standard_Integer NbPatchInU() const; + Standard_EXPORT int NbPatchInU() const; - Standard_EXPORT Standard_Integer NbPatchInV() const; + Standard_EXPORT int NbPatchInV() const; - Standard_EXPORT Standard_Real UParameter(const Standard_Integer Index) const; + Standard_EXPORT double UParameter(const int Index) const; - Standard_EXPORT Standard_Real VParameter(const Standard_Integer Index) const; + Standard_EXPORT double VParameter(const int Index) const; - const AdvApp2Var_Patch& Patch(const Standard_Integer UIndex, const Standard_Integer VIndex) const + const AdvApp2Var_Patch& Patch(const int UIndex, const int VIndex) const { return *myNet.Value((VIndex - 1) * (myUParameters.Length() - 1) + UIndex); } - const AdvApp2Var_Patch& operator()(const Standard_Integer UIndex, - const Standard_Integer VIndex) const + const AdvApp2Var_Patch& operator()(const int UIndex, const int VIndex) const { return Patch(UIndex, VIndex); } private: - AdvApp2Var_SequenceOfPatch myNet; - TColStd_SequenceOfReal myUParameters; - TColStd_SequenceOfReal myVParameters; + NCollection_Sequence> myNet; + NCollection_Sequence myUParameters; + NCollection_Sequence myVParameters; }; #endif // _AdvApp2Var_Network_HeaderFile diff --git a/opencascade/AdvApp2Var_Node.hxx b/opencascade/AdvApp2Var_Node.hxx index fb4e0f675..d9192c073 100644 --- a/opencascade/AdvApp2Var_Node.hxx +++ b/opencascade/AdvApp2Var_Node.hxx @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include //! used to store constraints on a (Ui,Vj) point class AdvApp2Var_Node : public Standard_Transient @@ -30,51 +30,40 @@ class AdvApp2Var_Node : public Standard_Transient public: Standard_EXPORT AdvApp2Var_Node(); - Standard_EXPORT AdvApp2Var_Node(const Standard_Integer iu, const Standard_Integer iv); + Standard_EXPORT AdvApp2Var_Node(const int iu, const int iv); - Standard_EXPORT AdvApp2Var_Node(const gp_XY& UV, - const Standard_Integer iu, - const Standard_Integer iv); + Standard_EXPORT AdvApp2Var_Node(const gp_XY& UV, const int iu, const int iv); //! Returns the coordinates (U,V) of the node const gp_XY& Coord() const { return myCoord; } //! changes the coordinates (U,V) to (x1,x2) - void SetCoord(const Standard_Real x1, const Standard_Real x2) + void SetCoord(const double x1, const double x2) { myCoord.SetX(x1); myCoord.SetY(x2); } //! returns the continuity order in U of the node - Standard_Integer UOrder() const { return myOrdInU; } + int UOrder() const { return myOrdInU; } //! returns the continuity order in V of the node - Standard_Integer VOrder() const { return myOrdInV; } + int VOrder() const { return myOrdInV; } //! affects the value F(U,V) or its derivates on the node (U,V) - void SetPoint(const Standard_Integer iu, const Standard_Integer iv, const gp_Pnt& Pt) - { - myTruePoints.SetValue(iu, iv, Pt); - } + void SetPoint(const int iu, const int iv, const gp_Pnt& Pt) { myTruePoints.SetValue(iu, iv, Pt); } //! returns the value F(U,V) or its derivates on the node (U,V) - const gp_Pnt& Point(const Standard_Integer iu, const Standard_Integer iv) const - { - return myTruePoints.Value(iu, iv); - } + const gp_Pnt& Point(const int iu, const int iv) const { return myTruePoints.Value(iu, iv); } //! affects the error between F(U,V) and its approximation - void SetError(const Standard_Integer iu, const Standard_Integer iv, const Standard_Real error) + void SetError(const int iu, const int iv, const double error) { myErrors.SetValue(iu, iv, error); } //! returns the error between F(U,V) and its approximation - Standard_Real Error(const Standard_Integer iu, const Standard_Integer iv) const - { - return myErrors.Value(iu, iv); - } + double Error(const int iu, const int iv) const { return myErrors.Value(iu, iv); } //! Assign operator. AdvApp2Var_Node& operator=(const AdvApp2Var_Node& theOther) @@ -88,14 +77,14 @@ public: } private: - AdvApp2Var_Node(const AdvApp2Var_Node& theOther); + AdvApp2Var_Node(const AdvApp2Var_Node& theOther) = delete; private: - TColgp_Array2OfPnt myTruePoints; - TColStd_Array2OfReal myErrors; - gp_XY myCoord; - Standard_Integer myOrdInU; - Standard_Integer myOrdInV; + NCollection_Array2 myTruePoints; + NCollection_Array2 myErrors; + gp_XY myCoord; + int myOrdInU; + int myOrdInV; }; #endif // _AdvApp2Var_Node_HeaderFile diff --git a/opencascade/AdvApp2Var_Patch.hxx b/opencascade/AdvApp2Var_Patch.hxx index b64e6287b..0e6c6152e 100644 --- a/opencascade/AdvApp2Var_Patch.hxx +++ b/opencascade/AdvApp2Var_Patch.hxx @@ -23,10 +23,12 @@ #include #include -#include -#include +#include +#include +#include +#include #include -#include +#include class AdvApp2Var_Context; class AdvApp2Var_Framework; class AdvApp2Var_Criterion; @@ -38,108 +40,104 @@ class AdvApp2Var_Patch : public Standard_Transient public: Standard_EXPORT AdvApp2Var_Patch(); - Standard_EXPORT AdvApp2Var_Patch(const Standard_Real U0, - const Standard_Real U1, - const Standard_Real V0, - const Standard_Real V1, - const Standard_Integer iu, - const Standard_Integer iv); + Standard_EXPORT AdvApp2Var_Patch(const double U0, + const double U1, + const double V0, + const double V1, + const int iu, + const int iv); - Standard_EXPORT Standard_Boolean IsDiscretised() const; + Standard_EXPORT bool IsDiscretised() const; Standard_EXPORT void Discretise(const AdvApp2Var_Context& Conditions, const AdvApp2Var_Framework& Constraints, const AdvApp2Var_EvaluatorFunc2Var& func); - Standard_EXPORT Standard_Boolean IsApproximated() const; + Standard_EXPORT bool IsApproximated() const; - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; Standard_EXPORT void MakeApprox(const AdvApp2Var_Context& Conditions, const AdvApp2Var_Framework& Constraints, - const Standard_Integer NumDec); + const int NumDec); Standard_EXPORT void AddConstraints(const AdvApp2Var_Context& Conditions, const AdvApp2Var_Framework& Constraints); Standard_EXPORT void AddErrors(const AdvApp2Var_Framework& Constraints); - Standard_EXPORT void ChangeDomain(const Standard_Real a, - const Standard_Real b, - const Standard_Real c, - const Standard_Real d); + Standard_EXPORT void ChangeDomain(const double a, const double b, const double c, const double d); Standard_EXPORT void ResetApprox(); Standard_EXPORT void OverwriteApprox(); - Standard_EXPORT Standard_Real U0() const; + Standard_EXPORT double U0() const; - Standard_EXPORT Standard_Real U1() const; + Standard_EXPORT double U1() const; - Standard_EXPORT Standard_Real V0() const; + Standard_EXPORT double V0() const; - Standard_EXPORT Standard_Real V1() const; + Standard_EXPORT double V1() const; - Standard_EXPORT Standard_Integer UOrder() const; + Standard_EXPORT int UOrder() const; - Standard_EXPORT Standard_Integer VOrder() const; + Standard_EXPORT int VOrder() const; - Standard_EXPORT Standard_Integer CutSense() const; + Standard_EXPORT int CutSense() const; - Standard_EXPORT Standard_Integer CutSense(const AdvApp2Var_Criterion& Crit, - const Standard_Integer NumDec) const; + Standard_EXPORT int CutSense(const AdvApp2Var_Criterion& Crit, const int NumDec) const; - Standard_EXPORT Standard_Integer NbCoeffInU() const; + Standard_EXPORT int NbCoeffInU() const; - Standard_EXPORT Standard_Integer NbCoeffInV() const; + Standard_EXPORT int NbCoeffInV() const; - Standard_EXPORT void ChangeNbCoeff(const Standard_Integer NbCoeffU, - const Standard_Integer NbCoeffV); + Standard_EXPORT void ChangeNbCoeff(const int NbCoeffU, const int NbCoeffV); - Standard_EXPORT Handle(TColgp_HArray2OfPnt) Poles(const Standard_Integer SSPIndex, - const AdvApp2Var_Context& Conditions) const; + Standard_EXPORT occ::handle> Poles( + const int SSPIndex, + const AdvApp2Var_Context& Conditions) const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) Coefficients( - const Standard_Integer SSPIndex, + Standard_EXPORT occ::handle> Coefficients( + const int SSPIndex, const AdvApp2Var_Context& Conditions) const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxErrors() const; + Standard_EXPORT occ::handle> MaxErrors() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageErrors() const; + Standard_EXPORT occ::handle> AverageErrors() const; - Standard_EXPORT Handle(TColStd_HArray2OfReal) IsoErrors() const; + Standard_EXPORT occ::handle> IsoErrors() const; - Standard_EXPORT Standard_Real CritValue() const; + Standard_EXPORT double CritValue() const; - Standard_EXPORT void SetCritValue(const Standard_Real dist); + Standard_EXPORT void SetCritValue(const double dist); private: - AdvApp2Var_Patch(const AdvApp2Var_Patch& P); - AdvApp2Var_Patch& operator=(const AdvApp2Var_Patch& theOther); + AdvApp2Var_Patch(const AdvApp2Var_Patch& P) = delete; + AdvApp2Var_Patch& operator=(const AdvApp2Var_Patch& theOther) = delete; private: - Standard_Real myU0; - Standard_Real myU1; - Standard_Real myV0; - Standard_Real myV1; - Standard_Integer myOrdInU; - Standard_Integer myOrdInV; - Standard_Integer myNbCoeffInU; - Standard_Integer myNbCoeffInV; - Standard_Boolean myApprIsDone; - Standard_Boolean myHasResult; - Handle(TColStd_HArray1OfReal) myEquation; - Handle(TColStd_HArray1OfReal) myMaxErrors; - Handle(TColStd_HArray1OfReal) myMoyErrors; - Handle(TColStd_HArray2OfReal) myIsoErrors; - Standard_Integer myCutSense; - Standard_Boolean myDiscIsDone; - Handle(TColStd_HArray1OfReal) mySosoTab; - Handle(TColStd_HArray1OfReal) myDisoTab; - Handle(TColStd_HArray1OfReal) mySodiTab; - Handle(TColStd_HArray1OfReal) myDidiTab; - Standard_Real myCritValue; + double myU0; + double myU1; + double myV0; + double myV1; + int myOrdInU; + int myOrdInV; + int myNbCoeffInU; + int myNbCoeffInV; + bool myApprIsDone; + bool myHasResult; + occ::handle> myEquation; + occ::handle> myMaxErrors; + occ::handle> myMoyErrors; + occ::handle> myIsoErrors; + int myCutSense; + bool myDiscIsDone; + occ::handle> mySosoTab; + occ::handle> myDisoTab; + occ::handle> mySodiTab; + occ::handle> myDidiTab; + double myCritValue; }; #endif // _AdvApp2Var_Patch_HeaderFile diff --git a/opencascade/AdvApp2Var_SequenceOfNode.hxx b/opencascade/AdvApp2Var_SequenceOfNode.hxx index a0c17f455..b68346b66 100644 --- a/opencascade/AdvApp2Var_SequenceOfNode.hxx +++ b/opencascade/AdvApp2Var_SequenceOfNode.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-03-05 -// Created by: Joelle CHAUVET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AdvApp2Var_SequenceOfNode_HeaderFile -#define AdvApp2Var_SequenceOfNode_HeaderFile +//! @file AdvApp2Var_SequenceOfNode.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence> directly instead. +#ifndef _AdvApp2Var_SequenceOfNode_hxx +#define _AdvApp2Var_SequenceOfNode_hxx + +#include #include #include -typedef NCollection_Sequence AdvApp2Var_SequenceOfNode; +Standard_HEADER_DEPRECATED("AdvApp2Var_SequenceOfNode.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence> directly.") + + Standard_DEPRECATED("AdvApp2Var_SequenceOfNode is deprecated, use " + "NCollection_Sequence> directly") +typedef NCollection_Sequence> AdvApp2Var_SequenceOfNode; -#endif +#endif // _AdvApp2Var_SequenceOfNode_hxx diff --git a/opencascade/AdvApp2Var_SequenceOfPatch.hxx b/opencascade/AdvApp2Var_SequenceOfPatch.hxx index 23a34c051..d3034a407 100644 --- a/opencascade/AdvApp2Var_SequenceOfPatch.hxx +++ b/opencascade/AdvApp2Var_SequenceOfPatch.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-03-05 -// Created by: Joelle CHAUVET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AdvApp2Var_SequenceOfPatch_HeaderFile -#define AdvApp2Var_SequenceOfPatch_HeaderFile +//! @file AdvApp2Var_SequenceOfPatch.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence> directly instead. +#ifndef _AdvApp2Var_SequenceOfPatch_hxx +#define _AdvApp2Var_SequenceOfPatch_hxx + +#include #include #include -typedef NCollection_Sequence AdvApp2Var_SequenceOfPatch; +Standard_HEADER_DEPRECATED("AdvApp2Var_SequenceOfPatch.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence> directly.") + + Standard_DEPRECATED("AdvApp2Var_SequenceOfPatch is deprecated, use " + "NCollection_Sequence> directly") +typedef NCollection_Sequence> AdvApp2Var_SequenceOfPatch; -#endif +#endif // _AdvApp2Var_SequenceOfPatch_hxx diff --git a/opencascade/AdvApp2Var_SequenceOfStrip.hxx b/opencascade/AdvApp2Var_SequenceOfStrip.hxx index 5ee651128..be7eaf388 100644 --- a/opencascade/AdvApp2Var_SequenceOfStrip.hxx +++ b/opencascade/AdvApp2Var_SequenceOfStrip.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-03-05 -// Created by: Joelle CHAUVET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AdvApp2Var_SequenceOfStrip_HeaderFile -#define AdvApp2Var_SequenceOfStrip_HeaderFile +//! @file AdvApp2Var_SequenceOfStrip.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _AdvApp2Var_SequenceOfStrip_hxx +#define _AdvApp2Var_SequenceOfStrip_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AdvApp2Var_SequenceOfStrip.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence directly.") + + Standard_DEPRECATED( + "AdvApp2Var_SequenceOfStrip is deprecated, use NCollection_Sequence directly") typedef NCollection_Sequence AdvApp2Var_SequenceOfStrip; -#endif +#endif // _AdvApp2Var_SequenceOfStrip_hxx diff --git a/opencascade/AdvApp2Var_Strip.hxx b/opencascade/AdvApp2Var_Strip.hxx index 9ff45bf07..1b266d8e7 100644 --- a/opencascade/AdvApp2Var_Strip.hxx +++ b/opencascade/AdvApp2Var_Strip.hxx @@ -1,7 +1,4 @@ -// Created on: 1996-03-05 -// Created by: Joelle CHAUVET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,14 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AdvApp2Var_Strip_HeaderFile -#define AdvApp2Var_Strip_HeaderFile +//! @file AdvApp2Var_Strip.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence> directly instead. +#ifndef _AdvApp2Var_Strip_hxx +#define _AdvApp2Var_Strip_hxx + +#include #include #include -//! Set of constraints along a same type of Iso on the same level +Standard_HEADER_DEPRECATED("AdvApp2Var_Strip.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence> directly.") -typedef NCollection_Sequence AdvApp2Var_Strip; + Standard_DEPRECATED("AdvApp2Var_Strip is deprecated, use " + "NCollection_Sequence> directly") +typedef NCollection_Sequence> AdvApp2Var_Strip; -#endif +#endif // _AdvApp2Var_Strip_hxx diff --git a/opencascade/AdvApp2Var_SysBase.hxx b/opencascade/AdvApp2Var_SysBase.hxx index 31ed6931f..598ef8082 100644 --- a/opencascade/AdvApp2Var_SysBase.hxx +++ b/opencascade/AdvApp2Var_SysBase.hxx @@ -16,7 +16,6 @@ #define AdvApp2Var_SysBase_HeaderFile #include -#include class AdvApp2Var_SysBase { @@ -29,59 +28,48 @@ public: Standard_EXPORT static int macinit_(int*, int*); // - Standard_EXPORT int mcrdelt_(integer* iunit, - integer* isize, - void* t, - intptr_t* iofset, - integer* iercod); - - Standard_EXPORT static int mcrfill_(integer* size, void* tin, void* tout); - - Standard_EXPORT int mcrrqst_(integer* iunit, - integer* isize, - void* t, - intptr_t* iofset, - integer* iercod); - Standard_EXPORT static integer mnfndeb_(); - - Standard_EXPORT static int do__fio(); - Standard_EXPORT static int do__lio(); - Standard_EXPORT int macrai4_(integer* nbelem, - integer* maxelm, - integer* itablo, + Standard_EXPORT int mcrdelt_(int* iunit, int* isize, void* t, intptr_t* iofset, int* iercod); + + Standard_EXPORT static int mcrfill_(int* size, void* tin, void* tout); + + Standard_EXPORT int mcrrqst_(int* iunit, int* isize, void* t, intptr_t* iofset, int* iercod); + Standard_EXPORT static int mnfndeb_(); + Standard_EXPORT int macrai4_(int* nbelem, + int* maxelm, + int* itablo, + intptr_t* iofset, + int* iercod); + Standard_EXPORT int macrar8_(int* nbelem, + int* maxelm, + double* xtablo, intptr_t* iofset, - integer* iercod); - Standard_EXPORT int macrar8_(integer* nbelem, - integer* maxelm, - doublereal* xtablo, - intptr_t* iofset, - integer* iercod); - Standard_EXPORT int macrdi4_(integer* nbelem, - integer* maxelm, - integer* itablo, + int* iercod); + Standard_EXPORT int macrdi4_(int* nbelem, + int* maxelm, + int* itablo, + intptr_t* iofset, + int* iercod); + + Standard_EXPORT int macrdr8_(int* nbelem, + int* maxelm, + double* xtablo, intptr_t* iofset, - integer* iercod); - - Standard_EXPORT int macrdr8_(integer* nbelem, - integer* maxelm, - doublereal* xtablo, - intptr_t* iofset, - integer* iercod); - Standard_EXPORT static int maermsg_(const char* cnompg, integer* icoder, ftnlen cnompg_len); - Standard_EXPORT static int maitbr8_(integer* itaill, doublereal* xtab, doublereal* xval); - Standard_EXPORT static int maovsr8_(integer* ivalcs); - Standard_EXPORT static int mgenmsg_(const char* nomprg, ftnlen nomprg_len); - - Standard_EXPORT static int mgsomsg_(const char* nomprg, ftnlen nomprg_len); - Standard_EXPORT static void miraz_(integer* taille, void* adt); - Standard_EXPORT static int msifill_(integer* nbintg, integer* ivecin, integer* ivecou); - Standard_EXPORT static int msrfill_(integer* nbreel, doublereal* vecent, doublereal* vecsor); - Standard_EXPORT static int mswrdbg_(const char* ctexte, ftnlen ctexte_len); - Standard_EXPORT static void mvriraz_(integer* taille, void* adt); + int* iercod); + Standard_EXPORT static int maermsg_(const char* cnompg, int* icoder, long cnompg_len); + Standard_EXPORT static int maitbr8_(int* itaill, double* xtab, double* xval); + Standard_EXPORT static int maovsr8_(int* ivalcs); + Standard_EXPORT static int mgenmsg_(const char* nomprg, long nomprg_len); + + Standard_EXPORT static int mgsomsg_(const char* nomprg, long nomprg_len); + Standard_EXPORT static void miraz_(int* taille, void* adt); + Standard_EXPORT static int msifill_(int* nbintg, int* ivecin, int* ivecou); + Standard_EXPORT static int msrfill_(int* nbreel, double* vecent, double* vecsor); + Standard_EXPORT static int mswrdbg_(const char* ctexte, long ctexte_len); + Standard_EXPORT static void mvriraz_(int* taille, void* adt); private: int macrchk_(); - int mcrlist_(integer* ier) const; + int mcrlist_(int* ier) const; /* Maximum number of allowed allocation requests. Currently the maximum known number of requests is 7 - see @@ -111,22 +99,22 @@ private: { unsigned char prot; unsigned char unit; // unit of allocation: 1, 2, 4 or 8 - integer reqsize; + int reqsize; intptr_t loc; intptr_t offset; unsigned char alloctype; // static_allocation or heap_allocation - integer size; + int size; intptr_t addr; - integer userzone; // not used + int userzone; // not used intptr_t startaddr; intptr_t endaddr; - integer rank; + int rank; }; struct { mitem icore[MAX_ALLOC_NB]; - integer ncore; + int ncore; unsigned char lprot; } mcrgene_; @@ -139,7 +127,7 @@ private: */ struct { - integer nrqst[2], ndelt[2], nbyte[2], mbyte[2]; + int nrqst[2], ndelt[2], nbyte[2], mbyte[2]; } mcrstac_; }; diff --git a/opencascade/AdvApprox_ApproxAFunction.hxx b/opencascade/AdvApprox_ApproxAFunction.hxx index aeb5c427d..16af24007 100644 --- a/opencascade/AdvApprox_ApproxAFunction.hxx +++ b/opencascade/AdvApprox_ApproxAFunction.hxx @@ -22,19 +22,16 @@ #include #include -#include +#include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include #include class AdvApprox_Cutting; @@ -58,141 +55,139 @@ public: //! the order in which each Subspace appears should be consistent //! with the tolerances given in the create function and the //! results will be given in that order as well that is : - //! Curve2d(n) will correspond to the nth entry + //! Curve2d(n) will correspond to the nth entry //! described by Num2DSS, Curve(n) will correspond to //! the nth entry described by Num3DSS //! The same type of schema applies to the Poles1d, Poles2d and //! Poles. - Standard_EXPORT AdvApprox_ApproxAFunction(const Standard_Integer Num1DSS, - const Standard_Integer Num2DSS, - const Standard_Integer Num3DSS, - const Handle(TColStd_HArray1OfReal)& OneDTol, - const Handle(TColStd_HArray1OfReal)& TwoDTol, - const Handle(TColStd_HArray1OfReal)& ThreeDTol, - const Standard_Real First, - const Standard_Real Last, - const GeomAbs_Shape Continuity, - const Standard_Integer MaxDeg, - const Standard_Integer MaxSeg, - const AdvApprox_EvaluatorFunction& Func); - - //! Approximation with user methode of cutting - Standard_EXPORT AdvApprox_ApproxAFunction(const Standard_Integer Num1DSS, - const Standard_Integer Num2DSS, - const Standard_Integer Num3DSS, - const Handle(TColStd_HArray1OfReal)& OneDTol, - const Handle(TColStd_HArray1OfReal)& TwoDTol, - const Handle(TColStd_HArray1OfReal)& ThreeDTol, - const Standard_Real First, - const Standard_Real Last, - const GeomAbs_Shape Continuity, - const Standard_Integer MaxDeg, - const Standard_Integer MaxSeg, - const AdvApprox_EvaluatorFunction& Func, - const AdvApprox_Cutting& CutTool); - - Standard_EXPORT static void Approximation(const Standard_Integer TotalDimension, - const Standard_Integer TotalNumSS, - const TColStd_Array1OfInteger& LocalDimension, - const Standard_Real First, - const Standard_Real Last, - AdvApprox_EvaluatorFunction& Evaluator, - const AdvApprox_Cutting& CutTool, - const Standard_Integer ContinuityOrder, - const Standard_Integer NumMaxCoeffs, - const Standard_Integer MaxSegments, - const TColStd_Array1OfReal& TolerancesArray, - const Standard_Integer code_precis, - Standard_Integer& NumCurves, - TColStd_Array1OfInteger& NumCoeffPerCurveArray, - TColStd_Array1OfReal& LocalCoefficientArray, - TColStd_Array1OfReal& IntervalsArray, - TColStd_Array1OfReal& ErrorMaxArray, - TColStd_Array1OfReal& AverageErrorArray, - Standard_Integer& ErrorCode); - - Standard_Boolean IsDone() const; - - Standard_Boolean HasResult() const; + Standard_EXPORT AdvApprox_ApproxAFunction( + const int Num1DSS, + const int Num2DSS, + const int Num3DSS, + const occ::handle>& OneDTol, + const occ::handle>& TwoDTol, + const occ::handle>& ThreeDTol, + const double First, + const double Last, + const GeomAbs_Shape Continuity, + const int MaxDeg, + const int MaxSeg, + const AdvApprox_EvaluatorFunction& Func); + + //! Approximation with user method of cutting + Standard_EXPORT AdvApprox_ApproxAFunction( + const int Num1DSS, + const int Num2DSS, + const int Num3DSS, + const occ::handle>& OneDTol, + const occ::handle>& TwoDTol, + const occ::handle>& ThreeDTol, + const double First, + const double Last, + const GeomAbs_Shape Continuity, + const int MaxDeg, + const int MaxSeg, + const AdvApprox_EvaluatorFunction& Func, + const AdvApprox_Cutting& CutTool); + + Standard_EXPORT static void Approximation(const int TotalDimension, + const int TotalNumSS, + const NCollection_Array1& LocalDimension, + const double First, + const double Last, + AdvApprox_EvaluatorFunction& Evaluator, + const AdvApprox_Cutting& CutTool, + const int ContinuityOrder, + const int NumMaxCoeffs, + const int MaxSegments, + const NCollection_Array1& TolerancesArray, + const int code_precis, + int& NumCurves, + NCollection_Array1& NumCoeffPerCurveArray, + NCollection_Array1& LocalCoefficientArray, + NCollection_Array1& IntervalsArray, + NCollection_Array1& ErrorMaxArray, + NCollection_Array1& AverageErrorArray, + int& ErrorCode); + + bool IsDone() const; + + bool HasResult() const; //! returns the poles from the algorithms as is - Handle(TColStd_HArray2OfReal) Poles1d() const; + occ::handle> Poles1d() const; //! returns the poles from the algorithms as is - Handle(TColgp_HArray2OfPnt2d) Poles2d() const; + occ::handle> Poles2d() const; //! -- returns the poles from the algorithms as is - Handle(TColgp_HArray2OfPnt) Poles() const; + occ::handle> Poles() const; //! as the name says - Standard_EXPORT Standard_Integer NbPoles() const; + Standard_EXPORT int NbPoles() const; //! returns the poles at Index from the 1d subspace - Standard_EXPORT void Poles1d(const Standard_Integer Index, TColStd_Array1OfReal& P) const; + Standard_EXPORT void Poles1d(const int Index, NCollection_Array1& P) const; //! returns the poles at Index from the 2d subspace - Standard_EXPORT void Poles2d(const Standard_Integer Index, TColgp_Array1OfPnt2d& P) const; + Standard_EXPORT void Poles2d(const int Index, NCollection_Array1& P) const; //! returns the poles at Index from the 3d subspace - Standard_EXPORT void Poles(const Standard_Integer Index, TColgp_Array1OfPnt& P) const; + Standard_EXPORT void Poles(const int Index, NCollection_Array1& P) const; - Standard_Integer Degree() const; + int Degree() const; - Standard_Integer NbKnots() const; + int NbKnots() const; - Standard_Integer NumSubSpaces(const Standard_Integer Dimension) const; + int NumSubSpaces(const int Dimension) const; - Handle(TColStd_HArray1OfReal) Knots() const; + occ::handle> Knots() const; - Handle(TColStd_HArray1OfInteger) Multiplicities() const; + occ::handle> Multiplicities() const; //! returns the error as is in the algorithms - Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxError(const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> MaxError(const int Dimension) const; //! returns the error as is in the algorithms - Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageError( - const Standard_Integer Dimension) const; + Standard_EXPORT occ::handle> AverageError(const int Dimension) const; - Standard_EXPORT Standard_Real MaxError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double MaxError(const int Dimension, const int Index) const; - Standard_EXPORT Standard_Real AverageError(const Standard_Integer Dimension, - const Standard_Integer Index) const; + Standard_EXPORT double AverageError(const int Dimension, const int Index) const; //! display information on approximation. Standard_EXPORT void Dump(Standard_OStream& o) const; -protected: private: - Standard_EXPORT void Perform(const Standard_Integer Num1DSS, - const Standard_Integer Num2DSS, - const Standard_Integer Num3DSS, + Standard_EXPORT void Perform(const int Num1DSS, + const int Num2DSS, + const int Num3DSS, const AdvApprox_Cutting& CutTool); - Standard_Integer myNumSubSpaces[3]; - Handle(TColStd_HArray1OfReal) my1DTolerances; - Handle(TColStd_HArray1OfReal) my2DTolerances; - Handle(TColStd_HArray1OfReal) my3DTolerances; - Standard_Real myFirst; - Standard_Real myLast; - GeomAbs_Shape myContinuity; - Standard_Integer myMaxDegree; - Standard_Integer myMaxSegments; - Standard_Boolean myDone; - Standard_Boolean myHasResult; - Handle(TColStd_HArray2OfReal) my1DPoles; - Handle(TColgp_HArray2OfPnt2d) my2DPoles; - Handle(TColgp_HArray2OfPnt) my3DPoles; - Handle(TColStd_HArray1OfReal) myKnots; - Handle(TColStd_HArray1OfInteger) myMults; - Standard_Integer myDegree; - Standard_Address myEvaluator; - Handle(TColStd_HArray1OfReal) my1DMaxError; - Handle(TColStd_HArray1OfReal) my1DAverageError; - Handle(TColStd_HArray1OfReal) my2DMaxError; - Handle(TColStd_HArray1OfReal) my2DAverageError; - Handle(TColStd_HArray1OfReal) my3DMaxError; - Handle(TColStd_HArray1OfReal) my3DAverageError; + int myNumSubSpaces[3]; + occ::handle> my1DTolerances; + occ::handle> my2DTolerances; + occ::handle> my3DTolerances; + double myFirst; + double myLast; + GeomAbs_Shape myContinuity; + int myMaxDegree; + int myMaxSegments; + bool myDone; + bool myHasResult; + occ::handle> my1DPoles; + occ::handle> my2DPoles; + occ::handle> my3DPoles; + occ::handle> myKnots; + occ::handle> myMults; + int myDegree; + void* myEvaluator; + occ::handle> my1DMaxError; + occ::handle> my1DAverageError; + occ::handle> my2DMaxError; + occ::handle> my2DAverageError; + occ::handle> my3DMaxError; + occ::handle> my3DAverageError; }; #include diff --git a/opencascade/AdvApprox_ApproxAFunction.lxx b/opencascade/AdvApprox_ApproxAFunction.lxx index cc6223345..13ef8ad39 100644 --- a/opencascade/AdvApprox_ApproxAFunction.lxx +++ b/opencascade/AdvApprox_ApproxAFunction.lxx @@ -15,105 +15,78 @@ // commercial license or contractual agreement. #include -#include -#include +#include +#include +#include -//======================================================================= -// function : IsDone -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean AdvApprox_ApproxAFunction::HasResult() const +inline bool AdvApprox_ApproxAFunction::HasResult() const { return myHasResult; } -//======================================================================= -// function : IsDone -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean AdvApprox_ApproxAFunction::IsDone() const +inline bool AdvApprox_ApproxAFunction::IsDone() const { return myDone; } -//======================================================================= -// function : Poles1d -// purpose : -//======================================================================= -inline Handle(TColStd_HArray2OfReal) AdvApprox_ApproxAFunction::Poles1d() const +//================================================================================================= + +inline occ::handle> AdvApprox_ApproxAFunction::Poles1d() const { return my1DPoles; } -//======================================================================= -// function : Poles2d -// purpose : -//======================================================================= -inline Handle(TColgp_HArray2OfPnt2d) AdvApprox_ApproxAFunction::Poles2d() const +//================================================================================================= + +inline occ::handle> AdvApprox_ApproxAFunction::Poles2d() const { return my2DPoles; } -//======================================================================= -// function : Poles -// purpose : -//======================================================================= -inline Handle(TColgp_HArray2OfPnt) AdvApprox_ApproxAFunction::Poles() const +//================================================================================================= + +inline occ::handle> AdvApprox_ApproxAFunction::Poles() const { return my3DPoles; } -//======================================================================= -// function : Degree -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Integer AdvApprox_ApproxAFunction::Degree() const +inline int AdvApprox_ApproxAFunction::Degree() const { return myDegree; } -//======================================================================= -// function : NbKnots -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Integer AdvApprox_ApproxAFunction::NbKnots() const +inline int AdvApprox_ApproxAFunction::NbKnots() const { return myKnots->Length(); } -//======================================================================= -// function : Knots -// purpose : -//======================================================================= +//================================================================================================= -inline Handle(TColStd_HArray1OfReal) AdvApprox_ApproxAFunction::Knots() const +inline occ::handle> AdvApprox_ApproxAFunction::Knots() const { return myKnots; } -//======================================================================= -// function : Multiplicities -// purpose : -//======================================================================= +//================================================================================================= -inline Handle(TColStd_HArray1OfInteger) AdvApprox_ApproxAFunction::Multiplicities() const +inline occ::handle> AdvApprox_ApproxAFunction::Multiplicities() const { return myMults; } -//======================================================================= -// function : NumSubSpaces -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Integer AdvApprox_ApproxAFunction::NumSubSpaces( - const Standard_Integer Dimension) const +inline int AdvApprox_ApproxAFunction::NumSubSpaces(const int Dimension) const { if (Dimension < 1 || Dimension > 3) throw Standard_ConstructionError(); diff --git a/opencascade/AdvApprox_Cutting.hxx b/opencascade/AdvApprox_Cutting.hxx index 2ff9dbefc..c97365b15 100644 --- a/opencascade/AdvApprox_Cutting.hxx +++ b/opencascade/AdvApprox_Cutting.hxx @@ -32,9 +32,9 @@ public: Standard_EXPORT virtual ~AdvApprox_Cutting(); - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real a, - const Standard_Real b, - Standard_Real& cuttingvalue) const = 0; + Standard_EXPORT virtual bool Value(const double a, + const double b, + double& cuttingvalue) const = 0; }; #endif // _AdvApprox_Cutting_HeaderFile diff --git a/opencascade/AdvApprox_DichoCutting.hxx b/opencascade/AdvApprox_DichoCutting.hxx index 74d733fed..0871f5502 100644 --- a/opencascade/AdvApprox_DichoCutting.hxx +++ b/opencascade/AdvApprox_DichoCutting.hxx @@ -33,13 +33,7 @@ public: Standard_EXPORT AdvApprox_DichoCutting(); - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real a, - const Standard_Real b, - Standard_Real& cuttingvalue) const - Standard_OVERRIDE; - -protected: -private: + Standard_EXPORT bool Value(const double a, const double b, double& cuttingvalue) const override; }; #endif // _AdvApprox_DichoCutting_HeaderFile diff --git a/opencascade/AdvApprox_EvaluatorFunction.hxx b/opencascade/AdvApprox_EvaluatorFunction.hxx index d35a52dca..13e1bac03 100644 --- a/opencascade/AdvApprox_EvaluatorFunction.hxx +++ b/opencascade/AdvApprox_EvaluatorFunction.hxx @@ -17,7 +17,23 @@ #ifndef _AdvApprox_EvaluatorFunction_HeaderFile #define _AdvApprox_EvaluatorFunction_HeaderFile -#include +#include + +#include + +#include + +#include + +#include + +#include + +#include + +#include + +#include // abv 01.04.2009: the C function pointer converted to a virtual class // in order to get rid of usage of static functions and static data @@ -28,33 +44,33 @@ class AdvApprox_EvaluatorFunction { public: //! Empty constructor - AdvApprox_EvaluatorFunction() {} + AdvApprox_EvaluatorFunction() = default; //! Destructor should be declared as virtual - virtual ~AdvApprox_EvaluatorFunction() {} + virtual ~AdvApprox_EvaluatorFunction() = default; //! Function evaluation method to be defined by descendant - virtual void Evaluate(Standard_Integer* Dimension, - Standard_Real StartEnd[2], - Standard_Real* Parameter, - Standard_Integer* DerivativeRequest, - Standard_Real* Result, // [Dimension] - Standard_Integer* ErrorCode) = 0; + virtual void Evaluate(int* Dimension, + double StartEnd[2], + double* Parameter, + int* DerivativeRequest, + double* Result, // [Dimension] + int* ErrorCode) = 0; //! Shortcut for function-call style usage - void operator()(Standard_Integer* Dimension, - Standard_Real StartEnd[2], - Standard_Real* Parameter, - Standard_Integer* DerivativeRequest, - Standard_Real* Result, // [Dimension] - Standard_Integer* ErrorCode) + void operator()(int* Dimension, + double StartEnd[2], + double* Parameter, + int* DerivativeRequest, + double* Result, // [Dimension] + int* ErrorCode) { Evaluate(Dimension, StartEnd, Parameter, DerivativeRequest, Result, ErrorCode); } private: //! Copy constructor is declared private to forbid copying - AdvApprox_EvaluatorFunction(const AdvApprox_EvaluatorFunction&) {} + AdvApprox_EvaluatorFunction(const AdvApprox_EvaluatorFunction&) = default; //! Assignment operator is declared private to forbid copying void operator=(const AdvApprox_EvaluatorFunction&) {} diff --git a/opencascade/AdvApprox_PrefAndRec.hxx b/opencascade/AdvApprox_PrefAndRec.hxx index 95978f76e..005ca0438 100644 --- a/opencascade/AdvApprox_PrefAndRec.hxx +++ b/opencascade/AdvApprox_PrefAndRec.hxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -33,9 +33,9 @@ class AdvApprox_PrefAndRec : public AdvApprox_Cutting public: DEFINE_STANDARD_ALLOC - Standard_EXPORT AdvApprox_PrefAndRec(const TColStd_Array1OfReal& RecomendedCut, - const TColStd_Array1OfReal& PrefferedCut, - const Standard_Real Weight = 5); + Standard_EXPORT AdvApprox_PrefAndRec(const NCollection_Array1& RecomendedCut, + const NCollection_Array1& PrefferedCut, + const double Weight = 5); //! cuting value is //! - the recommended point nerest of (a+b)/2 @@ -43,16 +43,12 @@ public: //! - the preferential point nearest of (a+b) / 2 //! if pi is in ](r*a+b)/(r+1) , (a+r*b)/(r+1)[ where r = Weight //! - or (a+b)/2 else. - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real a, - const Standard_Real b, - Standard_Real& cuttingvalue) const - Standard_OVERRIDE; + Standard_EXPORT bool Value(const double a, const double b, double& cuttingvalue) const override; -protected: private: - TColStd_Array1OfReal myRecCutting; - TColStd_Array1OfReal myPrefCutting; - Standard_Real myWeight; + NCollection_Array1 myRecCutting; + NCollection_Array1 myPrefCutting; + double myWeight; }; #endif // _AdvApprox_PrefAndRec_HeaderFile diff --git a/opencascade/AdvApprox_PrefCutting.hxx b/opencascade/AdvApprox_PrefCutting.hxx index 9fbcf2818..ef4aed281 100644 --- a/opencascade/AdvApprox_PrefCutting.hxx +++ b/opencascade/AdvApprox_PrefCutting.hxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -32,16 +32,12 @@ class AdvApprox_PrefCutting : public AdvApprox_Cutting public: DEFINE_STANDARD_ALLOC - Standard_EXPORT AdvApprox_PrefCutting(const TColStd_Array1OfReal& CutPnts); + Standard_EXPORT AdvApprox_PrefCutting(const NCollection_Array1& CutPnts); - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real a, - const Standard_Real b, - Standard_Real& cuttingvalue) const - Standard_OVERRIDE; + Standard_EXPORT bool Value(const double a, const double b, double& cuttingvalue) const override; -protected: private: - TColStd_Array1OfReal myPntOfCutting; + NCollection_Array1 myPntOfCutting; }; #endif // _AdvApprox_PrefCutting_HeaderFile diff --git a/opencascade/AdvApprox_SimpleApprox.hxx b/opencascade/AdvApprox_SimpleApprox.hxx index 8cfaa4173..2acb3b9de 100644 --- a/opencascade/AdvApprox_SimpleApprox.hxx +++ b/opencascade/AdvApprox_SimpleApprox.hxx @@ -22,32 +22,32 @@ #include #include -#include -#include +#include +#include +#include +#include #include #include -#include -#include #include -class PLib_JacobiPolynomial; +#include -//! Approximate a function on an interval [First,Last] -//! The result is a simple polynomial whose degree is as low as -//! possible to satisfy the required tolerance and the -//! maximum degree. The maximum error and the averrage error -//! resulting from approximating the function by the polynomial are computed +//! Approximate a function on an interval [First,Last] +//! The result is a simple polynomial whose degree is as low as +//! possible to satisfy the required tolerance and the +//! maximum degree. The maximum error and the average error +//! resulting from approximating the function by the polynomial are computed class AdvApprox_SimpleApprox { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT AdvApprox_SimpleApprox(const Standard_Integer TotalDimension, - const Standard_Integer TotalNumSS, - const GeomAbs_Shape Continuity, - const Standard_Integer WorkDegree, - const Standard_Integer NbGaussPoints, - const Handle(PLib_JacobiPolynomial)& JacobiBase, - const AdvApprox_EvaluatorFunction& Func); + Standard_EXPORT AdvApprox_SimpleApprox(const int TotalDimension, + const int TotalNumSS, + const GeomAbs_Shape Continuity, + const int WorkDegree, + const int NbGaussPoints, + const PLib_JacobiPolynomial& JacobiBase, + const AdvApprox_EvaluatorFunction& Func); //! Constructs approximator tool. //! @@ -55,56 +55,55 @@ public: //! the Func should be valid reference to object of type //! inherited from class EvaluatorFunction from Approx //! with life time longer than that of the approximator tool; - Standard_EXPORT void Perform(const TColStd_Array1OfInteger& LocalDimension, - const TColStd_Array1OfReal& LocalTolerancesArray, - const Standard_Real First, - const Standard_Real Last, - const Standard_Integer MaxDegree); + Standard_EXPORT void Perform(const NCollection_Array1& LocalDimension, + const NCollection_Array1& LocalTolerancesArray, + const double First, + const double Last, + const int MaxDegree); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Integer Degree() const; + Standard_EXPORT int Degree() const; //! returns the coefficients in the Jacobi Base - Standard_EXPORT Handle(TColStd_HArray1OfReal) Coefficients() const; + Standard_EXPORT occ::handle> Coefficients() const; //! returns the constraints at First - Standard_EXPORT Handle(TColStd_HArray2OfReal) FirstConstr() const; + Standard_EXPORT occ::handle> FirstConstr() const; //! returns the constraints at Last - Standard_EXPORT Handle(TColStd_HArray2OfReal) LastConstr() const; + Standard_EXPORT occ::handle> LastConstr() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) SomTab() const; + Standard_EXPORT occ::handle> SomTab() const; - Standard_EXPORT Handle(TColStd_HArray1OfReal) DifTab() const; + Standard_EXPORT occ::handle> DifTab() const; - Standard_EXPORT Standard_Real MaxError(const Standard_Integer Index) const; + Standard_EXPORT double MaxError(const int Index) const; - Standard_EXPORT Standard_Real AverageError(const Standard_Integer Index) const; + Standard_EXPORT double AverageError(const int Index) const; //! display information on approximation Standard_EXPORT void Dump(Standard_OStream& o) const; -protected: private: - Standard_Integer myTotalNumSS; - Standard_Integer myTotalDimension; - Standard_Integer myNbGaussPoints; - Standard_Integer myWorkDegree; - Standard_Integer myNivConstr; - Handle(PLib_JacobiPolynomial) myJacPol; - Handle(TColStd_HArray1OfReal) myTabPoints; - Handle(TColStd_HArray2OfReal) myTabWeights; - Standard_Address myEvaluator; - Standard_Integer myDegree; - Handle(TColStd_HArray1OfReal) myCoeff; - Handle(TColStd_HArray2OfReal) myFirstConstr; - Handle(TColStd_HArray2OfReal) myLastConstr; - Handle(TColStd_HArray1OfReal) mySomTab; - Handle(TColStd_HArray1OfReal) myDifTab; - Handle(TColStd_HArray1OfReal) myMaxError; - Handle(TColStd_HArray1OfReal) myAverageError; - Standard_Boolean done; + int myTotalNumSS; + int myTotalDimension; + int myNbGaussPoints; + int myWorkDegree; + int myNivConstr; + PLib_JacobiPolynomial myJacPol; + occ::handle> myTabPoints; + occ::handle> myTabWeights; + void* myEvaluator; + int myDegree; + occ::handle> myCoeff; + occ::handle> myFirstConstr; + occ::handle> myLastConstr; + occ::handle> mySomTab; + occ::handle> myDifTab; + occ::handle> myMaxError; + occ::handle> myAverageError; + bool done; }; #endif // _AdvApprox_SimpleApprox_HeaderFile diff --git a/opencascade/AppBlend_AppSurf.lxx b/opencascade/AppBlend_AppSurf.lxx index ce031bccb..3b4a0fc62 100644 --- a/opencascade/AppBlend_AppSurf.lxx +++ b/opencascade/AppBlend_AppSurf.lxx @@ -13,18 +13,20 @@ // commercial license or contractual agreement. #include -#include -#include -#include -#include -#include - -inline Standard_Boolean AppBlend_AppSurf::IsDone() const +#include +#include +#include +#include +#include +#include +#include + +inline bool AppBlend_AppSurf::IsDone() const { return done; } -inline Standard_Integer AppBlend_AppSurf::UDegree() const +inline int AppBlend_AppSurf::UDegree() const { if (!done) { @@ -33,7 +35,7 @@ inline Standard_Integer AppBlend_AppSurf::UDegree() const return udeg; } -inline Standard_Integer AppBlend_AppSurf::VDegree() const +inline int AppBlend_AppSurf::VDegree() const { if (!done) { @@ -42,7 +44,7 @@ inline Standard_Integer AppBlend_AppSurf::VDegree() const return vdeg; } -inline const TColgp_Array2OfPnt& AppBlend_AppSurf::SurfPoles() const +inline const NCollection_Array2& AppBlend_AppSurf::SurfPoles() const { if (!done) { @@ -51,7 +53,7 @@ inline const TColgp_Array2OfPnt& AppBlend_AppSurf::SurfPoles() const return tabPoles->Array2(); } -inline const TColStd_Array2OfReal& AppBlend_AppSurf::SurfWeights() const +inline const NCollection_Array2& AppBlend_AppSurf::SurfWeights() const { if (!done) { @@ -60,7 +62,7 @@ inline const TColStd_Array2OfReal& AppBlend_AppSurf::SurfWeights() const return tabWeights->Array2(); } -inline const TColStd_Array1OfReal& AppBlend_AppSurf::SurfUKnots() const +inline const NCollection_Array1& AppBlend_AppSurf::SurfUKnots() const { if (!done) { @@ -69,7 +71,7 @@ inline const TColStd_Array1OfReal& AppBlend_AppSurf::SurfUKnots() const return tabUKnots->Array1(); } -inline const TColStd_Array1OfReal& AppBlend_AppSurf::SurfVKnots() const +inline const NCollection_Array1& AppBlend_AppSurf::SurfVKnots() const { if (!done) { @@ -78,7 +80,7 @@ inline const TColStd_Array1OfReal& AppBlend_AppSurf::SurfVKnots() const return tabVKnots->Array1(); } -inline const TColStd_Array1OfInteger& AppBlend_AppSurf::SurfUMults() const +inline const NCollection_Array1& AppBlend_AppSurf::SurfUMults() const { if (!done) { @@ -87,7 +89,7 @@ inline const TColStd_Array1OfInteger& AppBlend_AppSurf::SurfUMults() const return tabUMults->Array1(); } -inline const TColStd_Array1OfInteger& AppBlend_AppSurf::SurfVMults() const +inline const NCollection_Array1& AppBlend_AppSurf::SurfVMults() const { if (!done) { @@ -96,7 +98,7 @@ inline const TColStd_Array1OfInteger& AppBlend_AppSurf::SurfVMults() const return tabVMults->Array1(); } -inline Standard_Integer AppBlend_AppSurf::NbCurves2d() const +inline int AppBlend_AppSurf::NbCurves2d() const { if (!done) { @@ -105,7 +107,7 @@ inline Standard_Integer AppBlend_AppSurf::NbCurves2d() const return seqPoles2d.Length(); } -inline Standard_Integer AppBlend_AppSurf::Curves2dDegree() const +inline int AppBlend_AppSurf::Curves2dDegree() const { if (!done) { @@ -118,8 +120,7 @@ inline Standard_Integer AppBlend_AppSurf::Curves2dDegree() const return vdeg; } -inline const TColgp_Array1OfPnt2d& AppBlend_AppSurf::Curve2dPoles( - const Standard_Integer Index) const +inline const NCollection_Array1& AppBlend_AppSurf::Curve2dPoles(const int Index) const { if (!done) { @@ -132,7 +133,7 @@ inline const TColgp_Array1OfPnt2d& AppBlend_AppSurf::Curve2dPoles( return seqPoles2d(Index)->Array1(); } -inline const TColStd_Array1OfReal& AppBlend_AppSurf::Curves2dKnots() const +inline const NCollection_Array1& AppBlend_AppSurf::Curves2dKnots() const { if (!done) { @@ -145,7 +146,7 @@ inline const TColStd_Array1OfReal& AppBlend_AppSurf::Curves2dKnots() const return tabVKnots->Array1(); } -inline const TColStd_Array1OfInteger& AppBlend_AppSurf::Curves2dMults() const +inline const NCollection_Array1& AppBlend_AppSurf::Curves2dMults() const { if (!done) { @@ -158,7 +159,7 @@ inline const TColStd_Array1OfInteger& AppBlend_AppSurf::Curves2dMults() const return tabVMults->Array1(); } -inline void AppBlend_AppSurf::TolReached(Standard_Real& Tol3d, Standard_Real& Tol2d) const +inline void AppBlend_AppSurf::TolReached(double& Tol3d, double& Tol2d) const { if (!done) { diff --git a/opencascade/AppBlend_Approx.hxx b/opencascade/AppBlend_Approx.hxx index 23a7651f1..92bac9681 100644 --- a/opencascade/AppBlend_Approx.hxx +++ b/opencascade/AppBlend_Approx.hxx @@ -22,11 +22,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //! Bspline approximation of a surface. class AppBlend_Approx @@ -34,65 +34,60 @@ class AppBlend_Approx public: DEFINE_STANDARD_ALLOC - Standard_EXPORT virtual Standard_Boolean IsDone() const = 0; + Standard_EXPORT virtual bool IsDone() const = 0; - Standard_EXPORT virtual void SurfShape(Standard_Integer& UDegree, - Standard_Integer& VDegree, - Standard_Integer& NbUPoles, - Standard_Integer& NbVPoles, - Standard_Integer& NbUKnots, - Standard_Integer& NbVKnots) const = 0; + Standard_EXPORT virtual void SurfShape(int& UDegree, + int& VDegree, + int& NbUPoles, + int& NbVPoles, + int& NbUKnots, + int& NbVKnots) const = 0; - Standard_EXPORT virtual void Surface(TColgp_Array2OfPnt& TPoles, - TColStd_Array2OfReal& TWeights, - TColStd_Array1OfReal& TUKnots, - TColStd_Array1OfReal& TVKnots, - TColStd_Array1OfInteger& TUMults, - TColStd_Array1OfInteger& TVMults) const = 0; + Standard_EXPORT virtual void Surface(NCollection_Array2& TPoles, + NCollection_Array2& TWeights, + NCollection_Array1& TUKnots, + NCollection_Array1& TVKnots, + NCollection_Array1& TUMults, + NCollection_Array1& TVMults) const = 0; - Standard_EXPORT virtual Standard_Integer UDegree() const = 0; + Standard_EXPORT virtual int UDegree() const = 0; - Standard_EXPORT virtual Standard_Integer VDegree() const = 0; + Standard_EXPORT virtual int VDegree() const = 0; - Standard_EXPORT virtual const TColgp_Array2OfPnt& SurfPoles() const = 0; + Standard_EXPORT virtual const NCollection_Array2& SurfPoles() const = 0; - Standard_EXPORT virtual const TColStd_Array2OfReal& SurfWeights() const = 0; + Standard_EXPORT virtual const NCollection_Array2& SurfWeights() const = 0; - Standard_EXPORT virtual const TColStd_Array1OfReal& SurfUKnots() const = 0; + Standard_EXPORT virtual const NCollection_Array1& SurfUKnots() const = 0; - Standard_EXPORT virtual const TColStd_Array1OfReal& SurfVKnots() const = 0; + Standard_EXPORT virtual const NCollection_Array1& SurfVKnots() const = 0; - Standard_EXPORT virtual const TColStd_Array1OfInteger& SurfUMults() const = 0; + Standard_EXPORT virtual const NCollection_Array1& SurfUMults() const = 0; - Standard_EXPORT virtual const TColStd_Array1OfInteger& SurfVMults() const = 0; + Standard_EXPORT virtual const NCollection_Array1& SurfVMults() const = 0; - Standard_EXPORT virtual Standard_Integer NbCurves2d() const = 0; + Standard_EXPORT virtual int NbCurves2d() const = 0; - Standard_EXPORT virtual void Curves2dShape(Standard_Integer& Degree, - Standard_Integer& NbPoles, - Standard_Integer& NbKnots) const = 0; + Standard_EXPORT virtual void Curves2dShape(int& Degree, int& NbPoles, int& NbKnots) const = 0; - Standard_EXPORT virtual void Curve2d(const Standard_Integer Index, - TColgp_Array1OfPnt2d& TPoles, - TColStd_Array1OfReal& TKnots, - TColStd_Array1OfInteger& TMults) const = 0; + Standard_EXPORT virtual void Curve2d(const int Index, + NCollection_Array1& TPoles, + NCollection_Array1& TKnots, + NCollection_Array1& TMults) const = 0; - Standard_EXPORT virtual Standard_Integer Curves2dDegree() const = 0; + Standard_EXPORT virtual int Curves2dDegree() const = 0; - Standard_EXPORT virtual const TColgp_Array1OfPnt2d& Curve2dPoles( - const Standard_Integer Index) const = 0; + Standard_EXPORT virtual const NCollection_Array1& Curve2dPoles( + const int Index) const = 0; - Standard_EXPORT virtual const TColStd_Array1OfReal& Curves2dKnots() const = 0; + Standard_EXPORT virtual const NCollection_Array1& Curves2dKnots() const = 0; - Standard_EXPORT virtual const TColStd_Array1OfInteger& Curves2dMults() const = 0; + Standard_EXPORT virtual const NCollection_Array1& Curves2dMults() const = 0; - Standard_EXPORT virtual void TolReached(Standard_Real& Tol3d, Standard_Real& Tol2d) const = 0; + Standard_EXPORT virtual void TolReached(double& Tol3d, double& Tol2d) const = 0; - Standard_EXPORT virtual Standard_Real TolCurveOnSurf(const Standard_Integer Index) const = 0; + Standard_EXPORT virtual double TolCurveOnSurf(const int Index) const = 0; Standard_EXPORT virtual ~AppBlend_Approx(); - -protected: -private: }; #endif // _AppBlend_Approx_HeaderFile diff --git a/opencascade/AppCont_ContMatrices.hxx b/opencascade/AppCont_ContMatrices.hxx deleted file mode 100644 index 6b963e49b..000000000 --- a/opencascade/AppCont_ContMatrices.hxx +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef AppCont_ContMatrices_HeaderFile -#define AppCont_ContMatrices_HeaderFile -#include - -// Stockage des matrices de resolution d approxiamtion continue. -// La classe est limitee a 26 pour MMatrix et InvMMatrix, (pas de contraintes) -// pour IBPMatrix (contraintes de passage aux extremites) -// et IBTMatrix (contraintes de tangence aux extremites). - -void InvMMatrix(const Standard_Integer classe, math_Matrix& M); - -void MMatrix(const Standard_Integer classe, math_Matrix& M); - -void IBPMatrix(const Standard_Integer classe, math_Matrix& M); - -void IBTMatrix(const Standard_Integer classe, math_Matrix& M); - -void VBernstein(const Standard_Integer classe, const Standard_Integer nbpoints, math_Matrix& M); - -#endif diff --git a/opencascade/AppCont_Function.hxx b/opencascade/AppCont_Function.hxx index 2c3cdeeb0..37998c80d 100644 --- a/opencascade/AppCont_Function.hxx +++ b/opencascade/AppCont_Function.hxx @@ -34,51 +34,49 @@ public: } //! Get number of 3d and 2d points returned by "Value" and "D1" functions. - void GetNumberOfPoints(Standard_Integer& theNbPnt, Standard_Integer& theNbPnt2d) const + void GetNumberOfPoints(int& theNbPnt, int& theNbPnt2d) const { theNbPnt = myNbPnt; theNbPnt2d = myNbPnt2d; } //! Get number of 3d points returned by "Value" and "D1" functions. - Standard_Integer GetNbOf3dPoints() const { return myNbPnt; } + int GetNbOf3dPoints() const { return myNbPnt; } //! Get number of 2d points returned by "Value" and "D1" functions. - Standard_Integer GetNbOf2dPoints() const { return myNbPnt2d; } + int GetNbOf2dPoints() const { return myNbPnt2d; } //! Destructor - virtual ~AppCont_Function() {} + virtual ~AppCont_Function() = default; //! Returns the first parameter of the function. - virtual Standard_Real FirstParameter() const = 0; + virtual double FirstParameter() const = 0; //! Returns the last parameter of the function. - virtual Standard_Real LastParameter() const = 0; + virtual double LastParameter() const = 0; //! Returns the point at parameter . - virtual Standard_Boolean Value(const Standard_Real theU, - NCollection_Array1& thePnt2d, - NCollection_Array1& thePnt) const = 0; + virtual bool Value(const double theU, + NCollection_Array1& thePnt2d, + NCollection_Array1& thePnt) const = 0; //! Returns the derivative at parameter . - virtual Standard_Boolean D1(const Standard_Real theU, - NCollection_Array1& theVec2d, - NCollection_Array1& theVec) const = 0; + virtual bool D1(const double theU, + NCollection_Array1& theVec2d, + NCollection_Array1& theVec) const = 0; //! Return information about peridicity in output paramateters space. //! @param theDimIdx Defines index in output parameters space. 1 <= theDimIdx <= 3 * myNbPnt + 2 * //! myNbPnt2d. - virtual void PeriodInformation(const Standard_Integer /*theDimIdx*/, - Standard_Boolean& IsPeriodic, - Standard_Real& thePeriod) const + virtual void PeriodInformation(const int /*theDimIdx*/, bool& IsPeriodic, double& thePeriod) const { - IsPeriodic = Standard_False; + IsPeriodic = false; thePeriod = 0.0; }; protected: - Standard_Integer myNbPnt; - Standard_Integer myNbPnt2d; + int myNbPnt; + int myNbPnt2d; }; #endif diff --git a/opencascade/AppCont_LeastSquare.hxx b/opencascade/AppCont_LeastSquare.hxx index 6dfa29e56..db9d53c60 100644 --- a/opencascade/AppCont_LeastSquare.hxx +++ b/opencascade/AppCont_LeastSquare.hxx @@ -26,33 +26,33 @@ struct PeriodicityInfo { - Standard_Boolean isPeriodic; - Standard_Real myPeriod; + bool isPeriodic; + double myPeriod; }; class AppCont_LeastSquare { public: Standard_EXPORT AppCont_LeastSquare(const AppCont_Function& SSP, - const Standard_Real U0, - const Standard_Real U1, + const double U0, + const double U1, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer Deg, - const Standard_Integer NbPoints); + const int Deg, + const int NbPoints); Standard_EXPORT const AppParCurves_MultiCurve& Value(); - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d) const; + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d) const; - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; private: //! Fix border point evaluation. void FixSingleBorderPoint(const AppCont_Function& theSSP, - const Standard_Real theU, - const Standard_Real theU0, - const Standard_Real theU1, + const double theU, + const double theU0, + const double theU1, NCollection_Array1& theFix2d, NCollection_Array1& theFix); @@ -62,9 +62,9 @@ private: math_Vector myParam; math_Matrix myVB; NCollection_Array1 myPerInfo; - Standard_Boolean myDone; - Standard_Integer myDegre; - Standard_Integer myNbdiscret, myNbP, myNbP2d; + bool myDone; + int myDegre; + int myNbdiscret, myNbP, myNbP2d; }; #endif diff --git a/opencascade/AppDef_Array1OfMultiPointConstraint.hxx b/opencascade/AppDef_Array1OfMultiPointConstraint.hxx index 1bdb4332e..c81ba21f8 100644 --- a/opencascade/AppDef_Array1OfMultiPointConstraint.hxx +++ b/opencascade/AppDef_Array1OfMultiPointConstraint.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-12-02 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppDef_Array1OfMultiPointConstraint_HeaderFile -#define AppDef_Array1OfMultiPointConstraint_HeaderFile +//! @file AppDef_Array1OfMultiPointConstraint.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _AppDef_Array1OfMultiPointConstraint_hxx +#define _AppDef_Array1OfMultiPointConstraint_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppDef_Array1OfMultiPointConstraint.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_Array1 directly.") + + Standard_DEPRECATED("AppDef_Array1OfMultiPointConstraint is deprecated, use " + "NCollection_Array1 directly") typedef NCollection_Array1 AppDef_Array1OfMultiPointConstraint; -#endif +#endif // _AppDef_Array1OfMultiPointConstraint_hxx diff --git a/opencascade/AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute.hxx b/opencascade/AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute.hxx index 8f4d90ff3..4a0b869f1 100644 --- a/opencascade/AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute.hxx +++ b/opencascade/AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute.hxx @@ -38,18 +38,16 @@ public: Standard_EXPORT AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute( math_MultipleVarFunctionWithGradient& F, const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute.hxx b/opencascade/AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute.hxx index 0e1172fff..f4b050098 100644 --- a/opencascade/AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute.hxx +++ b/opencascade/AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute.hxx @@ -25,11 +25,10 @@ #include #include #include -#include -#include +#include +#include +#include #include -#include -#include #include #include class AppDef_MultiLine; @@ -47,32 +46,32 @@ public: //! initializes the fields of the function. The approximating //! curve has control points. Standard_EXPORT AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int NbPol); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -83,16 +82,15 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex); + Standard_EXPORT double Error(const int IPoint, const int CurveIndex); //! returns the maximum distance between the points //! and the MultiBSpCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiBSpCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the function matrix used to approximate the //! multiline. @@ -108,17 +106,17 @@ public: //! to Index(ieme point) + degree +1. Standard_EXPORT const math_IntegerVector& Index() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; - Standard_EXPORT void SetFirstLambda(const Standard_Real l1); + Standard_EXPORT void SetFirstLambda(const double l1); - Standard_EXPORT void SetLastLambda(const Standard_Real l2); + Standard_EXPORT void SetLastLambda(const double l2); protected: //! this method is used each time Value or Gradient is @@ -126,33 +124,33 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; - AppDef_MultiLine MyMultiLine; - AppParCurves_MultiBSpCurve MyMultiBSpCurve; - Standard_Integer nbpoles; - math_Vector myParameters; - Standard_Real FVal; - math_Vector ValGrad_F; - math_Matrix MyF; - math_Matrix PTLX; - math_Matrix PTLY; - math_Matrix PTLZ; - math_Matrix A; - math_Matrix DA; - AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Real mylambda1; - Standard_Real mylambda2; + bool Done; + AppDef_MultiLine MyMultiLine; + AppParCurves_MultiBSpCurve MyMultiBSpCurve; + int nbpoles; + math_Vector myParameters; + double FVal; + math_Vector ValGrad_F; + math_Matrix MyF; + math_Matrix PTLX; + math_Matrix PTLY; + math_Matrix PTLZ; + math_Matrix A; + math_Matrix DA; + AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute MyLeastSquare; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; + double mylambda1; + double mylambda2; }; #endif // _AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute.hxx b/opencascade/AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute.hxx index caa36666c..8b8ade6d5 100644 --- a/opencascade/AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute.hxx +++ b/opencascade/AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute.hxx @@ -23,14 +23,12 @@ #include #include -#include -#include +#include +#include +#include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -64,21 +62,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -96,60 +94,58 @@ public: //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). Standard_EXPORT AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const math_Vector& Parameters, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -173,10 +169,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -185,15 +178,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -209,25 +202,23 @@ public: protected: //! is used by the constructors above. - Standard_EXPORT void Init(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, const int FirstPoint, const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + Standard_EXPORT int NbBColumns(const AppDef_MultiLine& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -246,41 +237,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_BSplineCompute.hxx b/opencascade/AppDef_BSplineCompute.hxx index 32b8d888b..2e505beba 100644 --- a/opencascade/AppDef_BSplineCompute.hxx +++ b/opencascade/AppDef_BSplineCompute.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include -#include +#include +#include #include +#include #include #include #include -#include -#include class AppDef_MultiLine; class AppDef_MyLineTool; class AppDef_MyBSplGradientOfBSplineCompute; @@ -62,14 +60,14 @@ public: //! default. Standard_EXPORT AppDef_BSplineCompute( const AppDef_MultiLine& Line, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-3, - const Standard_Real Tolerance2d = 1.0e-6, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-3, + const double Tolerance2d = 1.0e-6, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! The MultiLine will be approximated until tolerances //! will be reached. @@ -79,98 +77,96 @@ public: //! no iteration at all. Standard_EXPORT AppDef_BSplineCompute(const AppDef_MultiLine& Line, const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT AppDef_BSplineCompute(const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + Standard_EXPORT AppDef_BSplineCompute(const math_Vector& Parameters, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. Standard_EXPORT AppDef_BSplineCompute( - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! Constructs an interpolation of the MultiLine //! The result will be a C2 curve of degree 3. Standard_EXPORT void Interpol(const AppDef_MultiLine& Line); //! Initializes the fields of the algorithm. - Standard_EXPORT void Init(const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + Standard_EXPORT void Init(const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! runs the algorithm after having initialized the fields. Standard_EXPORT void Perform(const AppDef_MultiLine& Line); //! The approximation will begin with the - //! set of parameters . + //! set of parameters . Standard_EXPORT void SetParameters(const math_Vector& ThePar); //! The approximation will be done with the //! set of knots . The multiplicities will be set //! with the degree and the desired continuity. - Standard_EXPORT void SetKnots(const TColStd_Array1OfReal& Knots); + Standard_EXPORT void SetKnots(const NCollection_Array1& Knots); //! The approximation will be done with the //! set of knots and the multiplicities . - Standard_EXPORT void SetKnotsAndMultiplicities(const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults); + Standard_EXPORT void SetKnotsAndMultiplicities(const NCollection_Array1& Knots, + const NCollection_Array1& Mults); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! sets the continuity of the spline. //! if C = 2, the spline will be C2. - Standard_EXPORT void SetContinuity(const Standard_Integer C); + Standard_EXPORT void SetContinuity(const int C); //! changes the first and the last constraint points. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC); //! Sets periodic flag. - //! If thePeriodic = Standard_True, algorithm tries to build periodic + //! If thePeriodic = true, algorithm tries to build periodic //! multicurve using corresponding C1 boundary condition for first and last multipoints. //! Multiline must be closed. - Standard_EXPORT void SetPeriodic(const Standard_Boolean thePeriodic); + Standard_EXPORT void SetPeriodic(const bool thePeriodic); //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiBSpCurve. - Standard_EXPORT void Error(Standard_Real& tol3d, Standard_Real& tol2d) const; + Standard_EXPORT void Error(double& tol3d, double& tol2d) const; //! returns the result of the approximation. Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const; @@ -180,84 +176,83 @@ public: //! returns the new parameters of the approximation //! corresponding to the points of the MultiBSpCurve. - Standard_EXPORT const TColStd_Array1OfReal& Parameters() const; + Standard_EXPORT const NCollection_Array1& Parameters() const; -protected: private: //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean Compute(const AppDef_MultiLine& Line, - const Standard_Integer fpt, - const Standard_Integer lpt, - math_Vector& Para, - const TColStd_Array1OfReal& Knots, - TColStd_Array1OfInteger& Mults); + Standard_EXPORT bool Compute(const AppDef_MultiLine& Line, + const int fpt, + const int lpt, + math_Vector& Para, + const NCollection_Array1& Knots, + NCollection_Array1& Mults); //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean ComputeCurve(const AppDef_MultiLine& Line, - const Standard_Integer firspt, - const Standard_Integer lastpt); + Standard_EXPORT bool ComputeCurve(const AppDef_MultiLine& Line, + const int firspt, + const int lastpt); //! computes new parameters between firstP and lastP. Standard_EXPORT void Parameters(const AppDef_MultiLine& Line, - const Standard_Integer firstP, - const Standard_Integer LastP, + const int firstP, + const int LastP, math_Vector& TheParameters) const; - Standard_EXPORT Standard_Real SearchFirstLambda(const AppDef_MultiLine& Line, - const math_Vector& Para, - const TColStd_Array1OfReal& Knots, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchFirstLambda(const AppDef_MultiLine& Line, + const math_Vector& Para, + const NCollection_Array1& Knots, + const math_Vector& V, + const int index) const; - Standard_EXPORT Standard_Real SearchLastLambda(const AppDef_MultiLine& Line, - const math_Vector& Para, - const TColStd_Array1OfReal& Knots, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchLastLambda(const AppDef_MultiLine& Line, + const math_Vector& Para, + const NCollection_Array1& Knots, + const math_Vector& V, + const int index) const; Standard_EXPORT void TangencyVector(const AppDef_MultiLine& Line, const AppParCurves_MultiCurve& C, - const Standard_Real U, + const double U, math_Vector& V) const; Standard_EXPORT void FirstTangencyVector(const AppDef_MultiLine& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void LastTangencyVector(const AppDef_MultiLine& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void FindRealConstraints(const AppDef_MultiLine& Line); - AppParCurves_MultiBSpCurve TheMultiBSpCurve; - Standard_Boolean alldone; - Standard_Boolean tolreached; - Approx_ParametrizationType Par; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myfirstParam; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - Standard_Boolean myhasknots; - Standard_Boolean myhasmults; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - Standard_Boolean mysquares; - Standard_Integer myitermax; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - AppParCurves_Constraint realfirstC; - AppParCurves_Constraint reallastC; - Standard_Integer mycont; - Standard_Real mylambda1; - Standard_Real mylambda2; - Standard_Boolean myPeriodic; + AppParCurves_MultiBSpCurve TheMultiBSpCurve; + bool alldone; + bool tolreached; + Approx_ParametrizationType Par; + occ::handle> myParameters; + occ::handle> myfirstParam; + occ::handle> myknots; + occ::handle> mymults; + bool myhasknots; + bool myhasmults; + occ::handle> myConstraints; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + bool mysquares; + int myitermax; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + AppParCurves_Constraint realfirstC; + AppParCurves_Constraint reallastC; + int mycont; + double mylambda1; + double mylambda2; + bool myPeriodic; }; #endif // _AppDef_BSplineCompute_HeaderFile diff --git a/opencascade/AppDef_Compute.hxx b/opencascade/AppDef_Compute.hxx index b472c5609..37001df10 100644 --- a/opencascade/AppDef_Compute.hxx +++ b/opencascade/AppDef_Compute.hxx @@ -21,18 +21,16 @@ #include #include -#include #include +#include #include #include -#include -#include -#include -#include +#include +#include +#include #include #include #include -#include class AppDef_MultiLine; class AppDef_MyLineTool; class AppDef_MyGradientOfCompute; @@ -56,14 +54,14 @@ public: //! no iteration at all. Standard_EXPORT AppDef_Compute( const AppDef_MultiLine& Line, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-3, - const Standard_Real Tolerance2d = 1.0e-6, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-3, + const double Tolerance2d = 1.0e-6, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! The MultiLine will be approximated until tolerances //! will be reached. @@ -73,55 +71,53 @@ public: //! no iteration at all. Standard_EXPORT AppDef_Compute(const AppDef_MultiLine& Line, const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT AppDef_Compute(const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + Standard_EXPORT AppDef_Compute(const math_Vector& Parameters, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. Standard_EXPORT AppDef_Compute( - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT void Init(const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + Standard_EXPORT void Init(const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! runs the algorithm after having initialized the fields. Standard_EXPORT void Perform(const AppDef_MultiLine& Line); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! changes the first and the last constraint points. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint firstC, @@ -130,101 +126,98 @@ public: //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiCurve. - Standard_EXPORT void Error(const Standard_Integer Index, - Standard_Real& tol3d, - Standard_Real& tol2d) const; + Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const; //! Returns the number of MultiCurve doing the approximation //! of the MultiLine. - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; //! returns the result of the approximation. - Standard_EXPORT const AppParCurves_MultiCurve& Value(const Standard_Integer Index = 1) const; + Standard_EXPORT const AppParCurves_MultiCurve& Value(const int Index = 1) const; //! returns the result of the approximation. - Standard_EXPORT AppParCurves_MultiCurve& ChangeValue(const Standard_Integer Index = 1); + Standard_EXPORT AppParCurves_MultiCurve& ChangeValue(const int Index = 1); //! returns the result of the approximation. Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue(); - //! returns the type of parametrization + //! returns the type of parametrization Standard_EXPORT Approx_ParametrizationType Parametrization() const; //! returns the new parameters of the approximation //! corresponding to the points of the multicurve . - Standard_EXPORT const TColStd_Array1OfReal& Parameters(const Standard_Integer Index = 1) const; + Standard_EXPORT const NCollection_Array1& Parameters(const int Index = 1) const; -protected: private: //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean Compute(const AppDef_MultiLine& Line, - const Standard_Integer fpt, - const Standard_Integer lpt, - math_Vector& Para, - Standard_Real& TheTol3d, - Standard_Real& TheTol2d, - Standard_Integer& indbad); + Standard_EXPORT bool Compute(const AppDef_MultiLine& Line, + const int fpt, + const int lpt, + math_Vector& Para, + double& TheTol3d, + double& TheTol2d, + int& indbad); //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean ComputeCurve(const AppDef_MultiLine& Line, - const Standard_Integer firspt, - const Standard_Integer lastpt); + Standard_EXPORT bool ComputeCurve(const AppDef_MultiLine& Line, + const int firspt, + const int lastpt); //! computes new parameters between firstP and lastP. Standard_EXPORT void Parameters(const AppDef_MultiLine& Line, - const Standard_Integer firstP, - const Standard_Integer LastP, + const int firstP, + const int LastP, math_Vector& TheParameters) const; - Standard_EXPORT Standard_Real SearchFirstLambda(const AppDef_MultiLine& Line, - const math_Vector& Para, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchFirstLambda(const AppDef_MultiLine& Line, + const math_Vector& Para, + const math_Vector& V, + const int index) const; - Standard_EXPORT Standard_Real SearchLastLambda(const AppDef_MultiLine& Line, - const math_Vector& Para, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchLastLambda(const AppDef_MultiLine& Line, + const math_Vector& Para, + const math_Vector& V, + const int index) const; Standard_EXPORT void FirstTangencyVector(const AppDef_MultiLine& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void LastTangencyVector(const AppDef_MultiLine& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; - AppParCurves_SequenceOfMultiCurve myMultiCurves; - AppParCurves_MultiCurve TheMultiCurve; - AppParCurves_MultiBSpCurve myspline; - Standard_Boolean alldone; - Standard_Boolean tolreached; - Approx_ParametrizationType Par; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myfirstParam; - Approx_SequenceOfHArray1OfReal myPar; - TColStd_SequenceOfReal Tolers3d; - TColStd_SequenceOfReal Tolers2d; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - Standard_Boolean mysquares; - Standard_Integer myitermax; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - Standard_Integer myMultiLineNb; - Standard_Boolean myIsClear; + NCollection_Sequence myMultiCurves; + AppParCurves_MultiCurve TheMultiCurve; + AppParCurves_MultiBSpCurve myspline; + bool alldone; + bool tolreached; + Approx_ParametrizationType Par; + occ::handle> myParameters; + occ::handle> myfirstParam; + NCollection_Sequence>> myPar; + NCollection_Sequence Tolers3d; + NCollection_Sequence Tolers2d; + occ::handle> myConstraints; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + bool mysquares; + int myitermax; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + int myMultiLineNb; + bool myIsClear; }; #endif // _AppDef_Compute_HeaderFile diff --git a/opencascade/AppDef_Gradient_BFGSOfMyGradientOfCompute.hxx b/opencascade/AppDef_Gradient_BFGSOfMyGradientOfCompute.hxx index 2643db270..e2203082b 100644 --- a/opencascade/AppDef_Gradient_BFGSOfMyGradientOfCompute.hxx +++ b/opencascade/AppDef_Gradient_BFGSOfMyGradientOfCompute.hxx @@ -36,21 +36,18 @@ class AppDef_Gradient_BFGSOfMyGradientOfCompute : public math_BFGS public: DEFINE_STANDARD_ALLOC - Standard_EXPORT AppDef_Gradient_BFGSOfMyGradientOfCompute( - math_MultipleVarFunctionWithGradient& F, - const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); - - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; - -protected: + Standard_EXPORT AppDef_Gradient_BFGSOfMyGradientOfCompute(math_MultipleVarFunctionWithGradient& F, + const math_Vector& StartingPoint, + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); + + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; + private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _AppDef_Gradient_BFGSOfMyGradientOfCompute_HeaderFile diff --git a/opencascade/AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute.hxx b/opencascade/AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute.hxx index 8ac68c822..f3a8def99 100644 --- a/opencascade/AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute.hxx +++ b/opencascade/AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute.hxx @@ -39,18 +39,16 @@ public: Standard_EXPORT AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute( math_MultipleVarFunctionWithGradient& F, const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _AppDef_Gradient_BFGSOfMyGradientbisOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_Gradient_BFGSOfTheGradient.hxx b/opencascade/AppDef_Gradient_BFGSOfTheGradient.hxx index 12e3af9ac..802fba65f 100644 --- a/opencascade/AppDef_Gradient_BFGSOfTheGradient.hxx +++ b/opencascade/AppDef_Gradient_BFGSOfTheGradient.hxx @@ -37,19 +37,17 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT AppDef_Gradient_BFGSOfTheGradient(math_MultipleVarFunctionWithGradient& F, - const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const math_Vector& StartingPoint, + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _AppDef_Gradient_BFGSOfTheGradient_HeaderFile diff --git a/opencascade/AppDef_HArray1OfMultiPointConstraint.hxx b/opencascade/AppDef_HArray1OfMultiPointConstraint.hxx index e8582620f..88fda7444 100644 --- a/opencascade/AppDef_HArray1OfMultiPointConstraint.hxx +++ b/opencascade/AppDef_HArray1OfMultiPointConstraint.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-12-02 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppDef_HArray1OfMultiPointConstraint_HeaderFile -#define AppDef_HArray1OfMultiPointConstraint_HeaderFile +//! @file AppDef_HArray1OfMultiPointConstraint.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _AppDef_HArray1OfMultiPointConstraint_hxx +#define _AppDef_HArray1OfMultiPointConstraint_hxx + +#include #include #include -#include +#include + +Standard_HEADER_DEPRECATED("AppDef_HArray1OfMultiPointConstraint.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_HArray1 directly.") -DEFINE_HARRAY1(AppDef_HArray1OfMultiPointConstraint, AppDef_Array1OfMultiPointConstraint) + Standard_DEPRECATED("AppDef_HArray1OfMultiPointConstraint is deprecated, use " + "NCollection_HArray1 directly") +typedef NCollection_HArray1 AppDef_HArray1OfMultiPointConstraint; -#endif +#endif // _AppDef_HArray1OfMultiPointConstraint_hxx diff --git a/opencascade/AppDef_LinearCriteria.hxx b/opencascade/AppDef_LinearCriteria.hxx index 5cdbea5ee..9ad821e8d 100644 --- a/opencascade/AppDef_LinearCriteria.hxx +++ b/opencascade/AppDef_LinearCriteria.hxx @@ -23,16 +23,15 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include class FEmTool_ElementaryCriterion; class FEmTool_Curve; class math_Matrix; -class AppDef_LinearCriteria; -DEFINE_STANDARD_HANDLE(AppDef_LinearCriteria, AppDef_SmoothCriterion) - //! defined an Linear Criteria to used in variational //! Smoothing of points. class AppDef_LinearCriteria : public AppDef_SmoothCriterion @@ -40,86 +39,80 @@ class AppDef_LinearCriteria : public AppDef_SmoothCriterion public: Standard_EXPORT AppDef_LinearCriteria(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + const int FirstPoint, + const int LastPoint); - Standard_EXPORT void SetParameters(const Handle(TColStd_HArray1OfReal)& Parameters) - Standard_OVERRIDE; + Standard_EXPORT void SetParameters( + const occ::handle>& Parameters) override; - Standard_EXPORT void SetCurve(const Handle(FEmTool_Curve)& C) Standard_OVERRIDE; + Standard_EXPORT void SetCurve(const occ::handle& C) override; - Standard_EXPORT void GetCurve(Handle(FEmTool_Curve)& C) const Standard_OVERRIDE; + Standard_EXPORT void GetCurve(occ::handle& C) const override; - Standard_EXPORT void SetEstimation(const Standard_Real E1, - const Standard_Real E2, - const Standard_Real E3) Standard_OVERRIDE; + Standard_EXPORT void SetEstimation(const double E1, const double E2, const double E3) override; - Standard_EXPORT Standard_Real& EstLength() Standard_OVERRIDE; + Standard_EXPORT double& EstLength() override; - Standard_EXPORT void GetEstimation(Standard_Real& E1, - Standard_Real& E2, - Standard_Real& E3) const Standard_OVERRIDE; + Standard_EXPORT void GetEstimation(double& E1, double& E2, double& E3) const override; - Standard_EXPORT Handle(FEmTool_HAssemblyTable) AssemblyTable() const Standard_OVERRIDE; + Standard_EXPORT occ::handle>>> + AssemblyTable() const override; - Standard_EXPORT Handle(TColStd_HArray2OfInteger) DependenceTable() const Standard_OVERRIDE; + Standard_EXPORT occ::handle> DependenceTable() const override; - Standard_EXPORT Standard_Integer QualityValues(const Standard_Real J1min, - const Standard_Real J2min, - const Standard_Real J3min, - Standard_Real& J1, - Standard_Real& J2, - Standard_Real& J3) Standard_OVERRIDE; + Standard_EXPORT int QualityValues(const double J1min, + const double J2min, + const double J3min, + double& J1, + double& J2, + double& J3) override; - Standard_EXPORT void ErrorValues(Standard_Real& MaxError, - Standard_Real& QuadraticError, - Standard_Real& AverageError) Standard_OVERRIDE; + Standard_EXPORT void ErrorValues(double& MaxError, + double& QuadraticError, + double& AverageError) override; - Standard_EXPORT void Hessian(const Standard_Integer Element, - const Standard_Integer Dimension1, - const Standard_Integer Dimension2, - math_Matrix& H) Standard_OVERRIDE; + Standard_EXPORT void Hessian(const int Element, + const int Dimension1, + const int Dimension2, + math_Matrix& H) override; - Standard_EXPORT void Gradient(const Standard_Integer Element, - const Standard_Integer Dimension, - math_Vector& G) Standard_OVERRIDE; + Standard_EXPORT void Gradient(const int Element, const int Dimension, math_Vector& G) override; //! Convert the assembly Vector in an Curve; - Standard_EXPORT void InputVector(const math_Vector& X, - const Handle(FEmTool_HAssemblyTable)& AssTable) - Standard_OVERRIDE; + Standard_EXPORT void InputVector( + const math_Vector& X, + const occ::handle>>>& AssTable) + override; - Standard_EXPORT void SetWeight(const Standard_Real QuadraticWeight, - const Standard_Real QualityWeight, - const Standard_Real percentJ1, - const Standard_Real percentJ2, - const Standard_Real percentJ3) Standard_OVERRIDE; + Standard_EXPORT void SetWeight(const double QuadraticWeight, + const double QualityWeight, + const double percentJ1, + const double percentJ2, + const double percentJ3) override; - Standard_EXPORT void GetWeight(Standard_Real& QuadraticWeight, - Standard_Real& QualityWeight) const Standard_OVERRIDE; + Standard_EXPORT void GetWeight(double& QuadraticWeight, double& QualityWeight) const override; - Standard_EXPORT void SetWeight(const TColStd_Array1OfReal& Weight) Standard_OVERRIDE; + Standard_EXPORT void SetWeight(const NCollection_Array1& Weight) override; DEFINE_STANDARD_RTTIEXT(AppDef_LinearCriteria, AppDef_SmoothCriterion) -protected: private: - Standard_EXPORT void BuildCache(const Standard_Integer E); - - AppDef_MultiLine mySSP; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myCache; - Handle(FEmTool_ElementaryCriterion) myCriteria[3]; - Standard_Real myEstimation[3]; - Standard_Real myQuadraticWeight; - Standard_Real myQualityWeight; - Standard_Real myPercent[3]; - TColStd_Array1OfReal myPntWeight; - Handle(FEmTool_Curve) myCurve; - Standard_Real myLength; - Standard_Integer myE; - Standard_Integer IF; - Standard_Integer IL; + Standard_EXPORT void BuildCache(const int E); + + AppDef_MultiLine mySSP; + occ::handle> myParameters; + occ::handle> myCache; + occ::handle myCriteria[3]; + double myEstimation[3]; + double myQuadraticWeight; + double myQualityWeight; + double myPercent[3]; + NCollection_Array1 myPntWeight; + occ::handle myCurve; + double myLength; + int myE; + int IF; + int IL; }; #endif // _AppDef_LinearCriteria_HeaderFile diff --git a/opencascade/AppDef_MultiLine.hxx b/opencascade/AppDef_MultiLine.hxx index 5183ba890..89fdcb56f 100644 --- a/opencascade/AppDef_MultiLine.hxx +++ b/opencascade/AppDef_MultiLine.hxx @@ -21,11 +21,12 @@ #include #include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include #include class AppDef_MultiPointConstraint; @@ -59,30 +60,31 @@ public: Standard_EXPORT AppDef_MultiLine(); //! given the number NbMult of MultiPointConstraints of this - //! MultiLine , it initializes all the fields.SetValue must be + //! MultiLine, it initializes all the fields.SetValue must be //! called in order for the values of the multipoint //! constraint to be taken into account. //! An exception is raised if NbMult < 0. - Standard_EXPORT AppDef_MultiLine(const Standard_Integer NbMult); + Standard_EXPORT AppDef_MultiLine(const int NbMult); //! Constructs a MultiLine with an array of MultiPointConstraints. - Standard_EXPORT AppDef_MultiLine(const AppDef_Array1OfMultiPointConstraint& tabMultiP); + Standard_EXPORT AppDef_MultiLine( + const NCollection_Array1& tabMultiP); //! The MultiLine constructed will have one line of //! 3d points without their tangencies. - Standard_EXPORT AppDef_MultiLine(const TColgp_Array1OfPnt& tabP3d); + Standard_EXPORT AppDef_MultiLine(const NCollection_Array1& tabP3d); //! The MultiLine constructed will have one line of //! 2d points without their tangencies. - Standard_EXPORT AppDef_MultiLine(const TColgp_Array1OfPnt2d& tabP2d); + Standard_EXPORT AppDef_MultiLine(const NCollection_Array1& tabP2d); //! returns the number of MultiPointConstraints of the //! MultiLine. - Standard_EXPORT Standard_Integer NbMultiPoints() const; + Standard_EXPORT int NbMultiPoints() const; //! returns the number of Points from MultiPoints composing //! the MultiLine. - Standard_EXPORT Standard_Integer NbPoints() const; + Standard_EXPORT int NbPoints() const; //! Sets the value of the parameter for the //! MultiPointConstraint at position Index. @@ -90,19 +92,18 @@ public: //! - Standard_OutOfRange if Index is less //! than 0 or Index is greater than the number //! of Multipoint constraints in the MultiLine. - Standard_EXPORT void SetParameter(const Standard_Integer Index, const Standard_Real U); + Standard_EXPORT void SetParameter(const int Index, const double U); //! It sets the MultiPointConstraint of range Index to the //! value MPoint. //! An exception is raised if Index < 0 or Index> MPoint. //! An exception is raised if the dimensions of the //! MultiPoints are different. - Standard_EXPORT void SetValue(const Standard_Integer Index, - const AppDef_MultiPointConstraint& MPoint); + Standard_EXPORT void SetValue(const int Index, const AppDef_MultiPointConstraint& MPoint); //! returns the MultiPointConstraint of range Index //! An exception is raised if Index<0 or Index>MPoint. - Standard_EXPORT AppDef_MultiPointConstraint Value(const Standard_Integer Index) const; + Standard_EXPORT AppDef_MultiPointConstraint Value(const int Index) const; //! Prints on the stream o information on the current //! state of the object. @@ -110,9 +111,7 @@ public: Standard_EXPORT void Dump(Standard_OStream& o) const; protected: - Handle(AppDef_HArray1OfMultiPointConstraint) tabMult; - -private: + occ::handle> tabMult; }; #endif // _AppDef_MultiLine_HeaderFile diff --git a/opencascade/AppDef_MultiPointConstraint.hxx b/opencascade/AppDef_MultiPointConstraint.hxx index 52a0b51f7..950ae4b67 100644 --- a/opencascade/AppDef_MultiPointConstraint.hxx +++ b/opencascade/AppDef_MultiPointConstraint.hxx @@ -22,10 +22,12 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include class gp_Vec; class gp_Vec2d; @@ -55,20 +57,19 @@ public: //! constructs a set of Points used to approximate a Multiline. //! These Points can be of 2 or 3 dimensions. //! Points will be initialized with SetPoint and SetPoint2d. - Standard_EXPORT AppDef_MultiPointConstraint(const Standard_Integer NbPoints, - const Standard_Integer NbPoints2d); + Standard_EXPORT AppDef_MultiPointConstraint(const int NbPoints, const int NbPoints2d); //! creates a MultiPoint only composed of 3D points. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP); //! creates a MultiPoint only composed of 2D points. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP); //! constructs a set of Points used to approximate a Multiline. //! These Points can be of 2 or 3 dimensions. //! Points will be initialized with SetPoint and SetPoint2d. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfPnt2d& tabP2d); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP, + const NCollection_Array1& tabP2d); //! creates a MultiPointConstraint with a constraint of //! Curvature. @@ -76,52 +77,52 @@ public: //! (length of + length of ) is different //! from (length of + length of ) or //! from (length of + length of ) - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfPnt2d& tabP2d, - const TColgp_Array1OfVec& tabVec, - const TColgp_Array1OfVec2d& tabVec2d, - const TColgp_Array1OfVec& tabCur, - const TColgp_Array1OfVec2d& tabCur2d); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP, + const NCollection_Array1& tabP2d, + const NCollection_Array1& tabVec, + const NCollection_Array1& tabVec2d, + const NCollection_Array1& tabCur, + const NCollection_Array1& tabCur2d); //! creates a MultiPointConstraint with a constraint of //! Tangency. //! An exception is raised if //! (length of + length of ) is different //! from (length of + length of ) - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfPnt2d& tabP2d, - const TColgp_Array1OfVec& tabVec, - const TColgp_Array1OfVec2d& tabVec2d); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP, + const NCollection_Array1& tabP2d, + const NCollection_Array1& tabVec, + const NCollection_Array1& tabVec2d); //! creates a MultiPointConstraint only composed of 3d points //! with constraints of curvature. //! An exception is raised if the length of tabP is different //! from the length of tabVec or from tabCur. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfVec& tabVec, - const TColgp_Array1OfVec& tabCur); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP, + const NCollection_Array1& tabVec, + const NCollection_Array1& tabCur); //! creates a MultiPointConstraint only composed of 3d points //! with constraints of tangency. //! An exception is raised if the length of tabP is different //! from the length of tabVec. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfVec& tabVec); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP, + const NCollection_Array1& tabVec); //! creates a MultiPointConstraint only composed of 2d points //! with constraints of tangency. //! An exception is raised if the length of tabP is different //! from the length of tabVec2d. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, - const TColgp_Array1OfVec2d& tabVec2d); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP2d, + const NCollection_Array1& tabVec2d); //! creates a MultiPointConstraint only composed of 2d points //! with constraints of curvature. //! An exception is raised if the length of tabP is different //! from the length of tabVec2d or from tabCur2d. - Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, - const TColgp_Array1OfVec2d& tabVec2d, - const TColgp_Array1OfVec2d& tabCur2d); + Standard_EXPORT AppDef_MultiPointConstraint(const NCollection_Array1& tabP2d, + const NCollection_Array1& tabVec2d, + const NCollection_Array1& tabCur2d); //! sets the value of the tangency of the point of range //! Index. @@ -129,12 +130,12 @@ public: //! of 3d points. //! An exception is raised if Tang has an incorrect number of //! dimensions. - Standard_EXPORT void SetTang(const Standard_Integer Index, const gp_Vec& Tang); + Standard_EXPORT void SetTang(const int Index, const gp_Vec& Tang); //! returns the tangency value of the point of range Index. //! An exception is raised if Index < 0 or if Index > number //! of 3d points. - Standard_EXPORT gp_Vec Tang(const Standard_Integer Index) const; + Standard_EXPORT gp_Vec Tang(const int Index) const; //! sets the value of the tangency of the point of range //! Index. @@ -142,12 +143,12 @@ public: //! Index > total number of Points //! An exception is raised if Tang has an incorrect number of //! dimensions. - Standard_EXPORT void SetTang2d(const Standard_Integer Index, const gp_Vec2d& Tang2d); + Standard_EXPORT void SetTang2d(const int Index, const gp_Vec2d& Tang2d); //! returns the tangency value of the point of range Index. - //! An exception is raised if Index < number of 3d points or + //! An exception is raised if Index < number of 3d points or //! if Index > total number of points. - Standard_EXPORT gp_Vec2d Tang2d(const Standard_Integer Index) const; + Standard_EXPORT gp_Vec2d Tang2d(const int Index) const; //! Vec sets the value of the normal vector at the //! point of index Index. The norm of the normal @@ -156,12 +157,12 @@ public: //! of 3d points. //! An exception is raised if Curv has an incorrect number of //! dimensions. - Standard_EXPORT void SetCurv(const Standard_Integer Index, const gp_Vec& Curv); + Standard_EXPORT void SetCurv(const int Index, const gp_Vec& Curv); //! returns the normal vector at the point of range Index. //! An exception is raised if Index < 0 or if Index > number //! of 3d points. - Standard_EXPORT gp_Vec Curv(const Standard_Integer Index) const; + Standard_EXPORT gp_Vec Curv(const int Index) const; //! Vec sets the value of the normal vector at the //! point of index Index. The norm of the normal @@ -170,29 +171,29 @@ public: //! of 3d points. //! An exception is raised if Curv has an incorrect number of //! dimensions. - Standard_EXPORT void SetCurv2d(const Standard_Integer Index, const gp_Vec2d& Curv2d); + Standard_EXPORT void SetCurv2d(const int Index, const gp_Vec2d& Curv2d); //! returns the normal vector at the point of range Index. //! An exception is raised if Index < 0 or if Index > number //! of 3d points. - Standard_EXPORT gp_Vec2d Curv2d(const Standard_Integer Index) const; + Standard_EXPORT gp_Vec2d Curv2d(const int Index) const; //! returns True if the MultiPoint has a tangency value. - Standard_EXPORT Standard_Boolean IsTangencyPoint() const; + Standard_EXPORT bool IsTangencyPoint() const; //! returns True if the MultiPoint has a curvature value. - Standard_EXPORT Standard_Boolean IsCurvaturePoint() const; + Standard_EXPORT bool IsCurvaturePoint() const; //! Prints on the stream o information on the current //! state of the object. //! Is used to redefine the operator <<. - Standard_EXPORT virtual void Dump(Standard_OStream& o) const Standard_OVERRIDE; + Standard_EXPORT void Dump(Standard_OStream& o) const override; private: - Handle(TColgp_HArray1OfVec) tabTang; - Handle(TColgp_HArray1OfVec) tabCurv; - Handle(TColgp_HArray1OfVec2d) tabTang2d; - Handle(TColgp_HArray1OfVec2d) tabCurv2d; + occ::handle> tabTang; + occ::handle> tabCurv; + occ::handle> tabTang2d; + occ::handle> tabCurv2d; }; #endif // _AppDef_MultiPointConstraint_HeaderFile diff --git a/opencascade/AppDef_MyBSplGradientOfBSplineCompute.hxx b/opencascade/AppDef_MyBSplGradientOfBSplineCompute.hxx index e841c6d30..2b839a405 100644 --- a/opencascade/AppDef_MyBSplGradientOfBSplineCompute.hxx +++ b/opencascade/AppDef_MyBSplGradientOfBSplineCompute.hxx @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class AppDef_MultiLine; @@ -49,17 +49,17 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT AppDef_MyBSplGradientOfBSplineCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 1); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 1); //! Tries to minimize the sum (square(||Qui - Bi*Pi||)) //! where Pui describe the approximating BSpline curves'Poles @@ -68,22 +68,22 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT AppDef_MyBSplGradientOfBSplineCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations, - const Standard_Real lambda1, - const Standard_Real lambda2); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations, + const double lambda1, + const double lambda2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the BSpline curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -93,43 +93,44 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; protected: - Standard_EXPORT void Perform(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + Standard_EXPORT void Perform( + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); private: AppParCurves_MultiBSpCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Real mylambda1; - Standard_Real mylambda2; - Standard_Boolean myIsLambdaDefined; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + double mylambda1; + double mylambda2; + bool myIsLambdaDefined; + bool Done; }; #endif // _AppDef_MyBSplGradientOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_MyGradientOfCompute.hxx b/opencascade/AppDef_MyGradientOfCompute.hxx index 6514840cb..544b8a9da 100644 --- a/opencascade/AppDef_MyGradientOfCompute.hxx +++ b/opencascade/AppDef_MyGradientOfCompute.hxx @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class AppDef_MultiLine; @@ -48,18 +50,18 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT AppDef_MyGradientOfCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the Bezier curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -69,28 +71,27 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; -protected: private: AppParCurves_MultiCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + bool Done; }; #endif // _AppDef_MyGradientOfCompute_HeaderFile diff --git a/opencascade/AppDef_MyGradientbisOfBSplineCompute.hxx b/opencascade/AppDef_MyGradientbisOfBSplineCompute.hxx index 2fda15930..11cf94374 100644 --- a/opencascade/AppDef_MyGradientbisOfBSplineCompute.hxx +++ b/opencascade/AppDef_MyGradientbisOfBSplineCompute.hxx @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class AppDef_MultiLine; @@ -48,18 +50,18 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT AppDef_MyGradientbisOfBSplineCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the Bezier curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -69,28 +71,27 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; -protected: private: AppParCurves_MultiCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + bool Done; }; #endif // _AppDef_MyGradientbisOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_MyLineTool.hxx b/opencascade/AppDef_MyLineTool.hxx index c31ebb343..c7672dc27 100644 --- a/opencascade/AppDef_MyLineTool.hxx +++ b/opencascade/AppDef_MyLineTool.hxx @@ -21,10 +21,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include class AppDef_MultiLine; @@ -36,93 +37,93 @@ public: DEFINE_STANDARD_ALLOC //! Returns the first index of multipoints of the MultiLine. - Standard_EXPORT static Standard_Integer FirstPoint(const AppDef_MultiLine& ML); + Standard_EXPORT static int FirstPoint(const AppDef_MultiLine& ML); //! Returns the last index of multipoints of the MultiLine. - Standard_EXPORT static Standard_Integer LastPoint(const AppDef_MultiLine& ML); + Standard_EXPORT static int LastPoint(const AppDef_MultiLine& ML); //! Returns the number of 2d points of a MultiLine. - Standard_EXPORT static Standard_Integer NbP2d(const AppDef_MultiLine& ML); + Standard_EXPORT static int NbP2d(const AppDef_MultiLine& ML); //! Returns the number of 3d points of a MultiLine. - Standard_EXPORT static Standard_Integer NbP3d(const AppDef_MultiLine& ML); + Standard_EXPORT static int NbP3d(const AppDef_MultiLine& ML); //! returns the 3d points of the multipoint //! when only 3d points exist. - Standard_EXPORT static void Value(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt& tabPt); + Standard_EXPORT static void Value(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabPt); //! returns the 2d points of the multipoint //! when only 2d points exist. - Standard_EXPORT static void Value(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt2d& tabPt2d); + Standard_EXPORT static void Value(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabPt2d); //! returns the 3d and 2d points of the multipoint //! . - Standard_EXPORT static void Value(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt& tabPt, - TColgp_Array1OfPnt2d& tabPt2d); + Standard_EXPORT static void Value(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabPt, + NCollection_Array1& tabPt2d); //! returns the 3d points of the multipoint //! when only 3d points exist. - Standard_EXPORT static Standard_Boolean Tangency(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV); + Standard_EXPORT static bool Tangency(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV); //! returns the 2d tangency points of the multipoint //! only when 2d points exist. - Standard_EXPORT static Standard_Boolean Tangency(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec2d& tabV2d); + Standard_EXPORT static bool Tangency(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV2d); //! returns the 3d and 2d points of the multipoint //! . - Standard_EXPORT static Standard_Boolean Tangency(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV, - TColgp_Array1OfVec2d& tabV2d); + Standard_EXPORT static bool Tangency(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV, + NCollection_Array1& tabV2d); //! returns the 3d curvatures of the multipoint //! when only 3d points exist. - Standard_EXPORT static Standard_Boolean Curvature(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV); + Standard_EXPORT static bool Curvature(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV); //! returns the 2d curvatures of the multipoint //! only when 2d points exist. - Standard_EXPORT static Standard_Boolean Curvature(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec2d& tabV2d); + Standard_EXPORT static bool Curvature(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV2d); //! returns the 3d and 2d curvatures of the multipoint //! . - Standard_EXPORT static Standard_Boolean Curvature(const AppDef_MultiLine& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV, - TColgp_Array1OfVec2d& tabV2d); + Standard_EXPORT static bool Curvature(const AppDef_MultiLine& ML, + const int MPointIndex, + NCollection_Array1& tabV, + NCollection_Array1& tabV2d); //! returns NoPointsAdded Standard_EXPORT static Approx_Status WhatStatus(const AppDef_MultiLine& ML, - const Standard_Integer I1, - const Standard_Integer I2); + const int I1, + const int I2); //! Is never called in the algorithms. //! Nothing is done. Standard_EXPORT static AppDef_MultiLine MakeMLBetween(const AppDef_MultiLine& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer NbPMin); + const int I1, + const int I2, + const int NbPMin); //! Is never called in the algorithms. //! Nothing is done. - Standard_EXPORT static Standard_Boolean MakeMLOneMorePoint(const AppDef_MultiLine& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer indbad, - AppDef_MultiLine& OtherLine); + Standard_EXPORT static bool MakeMLOneMorePoint(const AppDef_MultiLine& ML, + const int I1, + const int I2, + const int indbad, + AppDef_MultiLine& OtherLine); }; #endif // _AppDef_MyLineTool_HeaderFile diff --git a/opencascade/AppDef_ParFunctionOfMyGradientOfCompute.hxx b/opencascade/AppDef_ParFunctionOfMyGradientOfCompute.hxx index b688bb737..d06ea9ae9 100644 --- a/opencascade/AppDef_ParFunctionOfMyGradientOfCompute.hxx +++ b/opencascade/AppDef_ParFunctionOfMyGradientOfCompute.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class AppDef_MultiLine; @@ -43,30 +44,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT AppDef_ParFunctionOfMyGradientOfCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -77,24 +78,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -102,31 +102,31 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; - AppDef_MultiLine MyMultiLine; - AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; - math_Vector myParameters; - Standard_Real FVal; - math_Vector ValGrad_F; - math_Matrix MyF; - math_Matrix PTLX; - math_Matrix PTLY; - math_Matrix PTLZ; - math_Matrix A; - math_Matrix DA; - AppDef_ParLeastSquareOfMyGradientOfCompute MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Done; + AppDef_MultiLine MyMultiLine; + AppParCurves_MultiCurve MyMultiCurve; + int Degre; + math_Vector myParameters; + double FVal; + math_Vector ValGrad_F; + math_Matrix MyF; + math_Matrix PTLX; + math_Matrix PTLY; + math_Matrix PTLZ; + math_Matrix A; + math_Matrix DA; + AppDef_ParLeastSquareOfMyGradientOfCompute MyLeastSquare; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _AppDef_ParFunctionOfMyGradientOfCompute_HeaderFile diff --git a/opencascade/AppDef_ParFunctionOfMyGradientbisOfBSplineCompute.hxx b/opencascade/AppDef_ParFunctionOfMyGradientbisOfBSplineCompute.hxx index 346a030dd..5dcf8b36b 100644 --- a/opencascade/AppDef_ParFunctionOfMyGradientbisOfBSplineCompute.hxx +++ b/opencascade/AppDef_ParFunctionOfMyGradientbisOfBSplineCompute.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class AppDef_MultiLine; @@ -44,30 +45,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT AppDef_ParFunctionOfMyGradientbisOfBSplineCompute( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -78,24 +79,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -103,31 +103,31 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; - AppDef_MultiLine MyMultiLine; - AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; - math_Vector myParameters; - Standard_Real FVal; - math_Vector ValGrad_F; - math_Matrix MyF; - math_Matrix PTLX; - math_Matrix PTLY; - math_Matrix PTLZ; - math_Matrix A; - math_Matrix DA; - AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Done; + AppDef_MultiLine MyMultiLine; + AppParCurves_MultiCurve MyMultiCurve; + int Degre; + math_Vector myParameters; + double FVal; + math_Vector ValGrad_F; + math_Matrix MyF; + math_Matrix PTLX; + math_Matrix PTLY; + math_Matrix PTLZ; + math_Matrix A; + math_Matrix DA; + AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute MyLeastSquare; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _AppDef_ParFunctionOfMyGradientbisOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_ParFunctionOfTheGradient.hxx b/opencascade/AppDef_ParFunctionOfTheGradient.hxx index 2a6f0b0e5..4e22c5a4e 100644 --- a/opencascade/AppDef_ParFunctionOfTheGradient.hxx +++ b/opencascade/AppDef_ParFunctionOfTheGradient.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class AppDef_MultiLine; @@ -43,30 +44,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT AppDef_ParFunctionOfTheGradient( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -77,24 +78,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -102,31 +102,31 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; - AppDef_MultiLine MyMultiLine; - AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; - math_Vector myParameters; - Standard_Real FVal; - math_Vector ValGrad_F; - math_Matrix MyF; - math_Matrix PTLX; - math_Matrix PTLY; - math_Matrix PTLZ; - math_Matrix A; - math_Matrix DA; - AppDef_ParLeastSquareOfTheGradient MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Done; + AppDef_MultiLine MyMultiLine; + AppParCurves_MultiCurve MyMultiCurve; + int Degre; + math_Vector myParameters; + double FVal; + math_Vector ValGrad_F; + math_Matrix MyF; + math_Matrix PTLX; + math_Matrix PTLY; + math_Matrix PTLZ; + math_Matrix A; + math_Matrix DA; + AppDef_ParLeastSquareOfTheGradient MyLeastSquare; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _AppDef_ParFunctionOfTheGradient_HeaderFile diff --git a/opencascade/AppDef_ParLeastSquareOfMyGradientOfCompute.hxx b/opencascade/AppDef_ParLeastSquareOfMyGradientOfCompute.hxx index 147321fdf..f3ffc0dfb 100644 --- a/opencascade/AppDef_ParLeastSquareOfMyGradientOfCompute.hxx +++ b/opencascade/AppDef_ParLeastSquareOfMyGradientOfCompute.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -65,21 +63,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT AppDef_ParLeastSquareOfMyGradientOfCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_ParLeastSquareOfMyGradientOfCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -97,60 +95,58 @@ public: //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). Standard_EXPORT AppDef_ParLeastSquareOfMyGradientOfCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const math_Vector& Parameters, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_ParLeastSquareOfMyGradientOfCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -174,10 +170,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -186,15 +179,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -210,25 +203,23 @@ public: protected: //! is used by the constructors above. - Standard_EXPORT void Init(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, const int FirstPoint, const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + Standard_EXPORT int NbBColumns(const AppDef_MultiLine& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -247,41 +238,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _AppDef_ParLeastSquareOfMyGradientOfCompute_HeaderFile diff --git a/opencascade/AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute.hxx b/opencascade/AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute.hxx index 4257a6f0e..3ddb3f554 100644 --- a/opencascade/AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute.hxx +++ b/opencascade/AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -65,21 +63,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute( const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -97,60 +95,58 @@ public: //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). Standard_EXPORT AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const math_Vector& Parameters, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute( - const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -174,10 +170,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -186,15 +179,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -210,25 +203,23 @@ public: protected: //! is used by the constructors above. - Standard_EXPORT void Init(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, const int FirstPoint, const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + Standard_EXPORT int NbBColumns(const AppDef_MultiLine& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -247,41 +238,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _AppDef_ParLeastSquareOfMyGradientbisOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx b/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx index 9d9303260..95c160166 100644 --- a/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx +++ b/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -64,20 +62,20 @@ public: //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -94,59 +92,57 @@ public: //! and is also the same for each MultiLine point because //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). - Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const math_Vector& Parameters, - const Standard_Integer NbPol); + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const int NbPol); //! Initializes the fields of the object. - Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -170,10 +166,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -182,15 +175,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -206,25 +199,23 @@ public: protected: //! is used by the constructors above. - Standard_EXPORT void Init(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, const int FirstPoint, const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + Standard_EXPORT int NbBColumns(const AppDef_MultiLine& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -243,41 +234,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _AppDef_ParLeastSquareOfTheGradient_HeaderFile diff --git a/opencascade/AppDef_ResConstraintOfMyGradientOfCompute.hxx b/opencascade/AppDef_ResConstraintOfMyGradientOfCompute.hxx index 64ce79626..de76c5ba2 100644 --- a/opencascade/AppDef_ResConstraintOfMyGradientOfCompute.hxx +++ b/opencascade/AppDef_ResConstraintOfMyGradientOfCompute.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class AppDef_MultiLine; class AppDef_MyLineTool; @@ -49,21 +50,21 @@ public: //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. Standard_EXPORT AppDef_ResConstraintOfMyGradientOfCompute( - const AppDef_MultiLine& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + const AppDef_MultiLine& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -73,7 +74,7 @@ public: //! Returns the derivative of the constraint matrix. Standard_EXPORT const math_Matrix& ConstraintDerivative(const AppDef_MultiLine& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -82,30 +83,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const AppDef_MultiLine& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const AppDef_MultiLine& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _AppDef_ResConstraintOfMyGradientOfCompute_HeaderFile diff --git a/opencascade/AppDef_ResConstraintOfMyGradientbisOfBSplineCompute.hxx b/opencascade/AppDef_ResConstraintOfMyGradientbisOfBSplineCompute.hxx index 57e026b18..afa4f3623 100644 --- a/opencascade/AppDef_ResConstraintOfMyGradientbisOfBSplineCompute.hxx +++ b/opencascade/AppDef_ResConstraintOfMyGradientbisOfBSplineCompute.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class AppDef_MultiLine; class AppDef_MyLineTool; @@ -49,21 +50,21 @@ public: //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. Standard_EXPORT AppDef_ResConstraintOfMyGradientbisOfBSplineCompute( - const AppDef_MultiLine& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + const AppDef_MultiLine& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -73,7 +74,7 @@ public: //! Returns the derivative of the constraint matrix. Standard_EXPORT const math_Matrix& ConstraintDerivative(const AppDef_MultiLine& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -82,30 +83,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const AppDef_MultiLine& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const AppDef_MultiLine& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _AppDef_ResConstraintOfMyGradientbisOfBSplineCompute_HeaderFile diff --git a/opencascade/AppDef_ResConstraintOfTheGradient.hxx b/opencascade/AppDef_ResConstraintOfTheGradient.hxx index 85eff2c58..548dd3c74 100644 --- a/opencascade/AppDef_ResConstraintOfTheGradient.hxx +++ b/opencascade/AppDef_ResConstraintOfTheGradient.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class AppDef_MultiLine; class AppDef_MyLineTool; @@ -49,21 +50,21 @@ public: //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. Standard_EXPORT AppDef_ResConstraintOfTheGradient( - const AppDef_MultiLine& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + const AppDef_MultiLine& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -73,7 +74,7 @@ public: //! Returns the derivative of the constraint matrix. Standard_EXPORT const math_Matrix& ConstraintDerivative(const AppDef_MultiLine& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -82,30 +83,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const AppDef_MultiLine& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const AppDef_MultiLine& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _AppDef_ResConstraintOfTheGradient_HeaderFile diff --git a/opencascade/AppDef_SmoothCriterion.hxx b/opencascade/AppDef_SmoothCriterion.hxx index dc421d3de..3bc3f7a90 100644 --- a/opencascade/AppDef_SmoothCriterion.hxx +++ b/opencascade/AppDef_SmoothCriterion.hxx @@ -20,83 +20,82 @@ #include #include -#include +#include +#include #include -#include -#include #include +#include +#include #include -#include class FEmTool_Curve; class math_Matrix; -class AppDef_SmoothCriterion; -DEFINE_STANDARD_HANDLE(AppDef_SmoothCriterion, Standard_Transient) - -//! defined criterion to smooth points in curve +//! defined criterion to smooth points in curve class AppDef_SmoothCriterion : public Standard_Transient { public: - Standard_EXPORT virtual void SetParameters(const Handle(TColStd_HArray1OfReal)& Parameters) = 0; + Standard_EXPORT virtual void SetParameters( + const occ::handle>& Parameters) = 0; + + Standard_EXPORT virtual void SetCurve(const occ::handle& C) = 0; - Standard_EXPORT virtual void SetCurve(const Handle(FEmTool_Curve)& C) = 0; + //! Returns the curve associated with this criterion. + //! @return handle to the FEmTool curve + [[nodiscard]] occ::handle Curve() const + { + occ::handle aCurve; + GetCurve(aCurve); + return aCurve; + } - Standard_EXPORT virtual void GetCurve(Handle(FEmTool_Curve)& C) const = 0; + Standard_EXPORT virtual void GetCurve(occ::handle& C) const = 0; - Standard_EXPORT virtual void SetEstimation(const Standard_Real E1, - const Standard_Real E2, - const Standard_Real E3) = 0; + Standard_EXPORT virtual void SetEstimation(const double E1, const double E2, const double E3) = 0; - Standard_EXPORT virtual Standard_Real& EstLength() = 0; + Standard_EXPORT virtual double& EstLength() = 0; - Standard_EXPORT virtual void GetEstimation(Standard_Real& E1, - Standard_Real& E2, - Standard_Real& E3) const = 0; + Standard_EXPORT virtual void GetEstimation(double& E1, double& E2, double& E3) const = 0; - Standard_EXPORT virtual Handle(FEmTool_HAssemblyTable) AssemblyTable() const = 0; + Standard_EXPORT virtual occ::handle>>> + AssemblyTable() const = 0; - Standard_EXPORT virtual Handle(TColStd_HArray2OfInteger) DependenceTable() const = 0; + Standard_EXPORT virtual occ::handle> DependenceTable() const = 0; - Standard_EXPORT virtual Standard_Integer QualityValues(const Standard_Real J1min, - const Standard_Real J2min, - const Standard_Real J3min, - Standard_Real& J1, - Standard_Real& J2, - Standard_Real& J3) = 0; + Standard_EXPORT virtual int QualityValues(const double J1min, + const double J2min, + const double J3min, + double& J1, + double& J2, + double& J3) = 0; - Standard_EXPORT virtual void ErrorValues(Standard_Real& MaxError, - Standard_Real& QuadraticError, - Standard_Real& AverageError) = 0; + Standard_EXPORT virtual void ErrorValues(double& MaxError, + double& QuadraticError, + double& AverageError) = 0; - Standard_EXPORT virtual void Hessian(const Standard_Integer Element, - const Standard_Integer Dimension1, - const Standard_Integer Dimension2, - math_Matrix& H) = 0; + Standard_EXPORT virtual void Hessian(const int Element, + const int Dimension1, + const int Dimension2, + math_Matrix& H) = 0; - Standard_EXPORT virtual void Gradient(const Standard_Integer Element, - const Standard_Integer Dimension, - math_Vector& G) = 0; + Standard_EXPORT virtual void Gradient(const int Element, const int Dimension, math_Vector& G) = 0; //! Convert the assembly Vector in an Curve; - Standard_EXPORT virtual void InputVector(const math_Vector& X, - const Handle(FEmTool_HAssemblyTable)& AssTable) = 0; + Standard_EXPORT virtual void InputVector( + const math_Vector& X, + const occ::handle>>>& AssTable) = 0; - Standard_EXPORT virtual void SetWeight(const Standard_Real QuadraticWeight, - const Standard_Real QualityWeight, - const Standard_Real percentJ1, - const Standard_Real percentJ2, - const Standard_Real percentJ3) = 0; + Standard_EXPORT virtual void SetWeight(const double QuadraticWeight, + const double QualityWeight, + const double percentJ1, + const double percentJ2, + const double percentJ3) = 0; - Standard_EXPORT virtual void GetWeight(Standard_Real& QuadraticWeight, - Standard_Real& QualityWeight) const = 0; + Standard_EXPORT virtual void GetWeight(double& QuadraticWeight, double& QualityWeight) const = 0; - Standard_EXPORT virtual void SetWeight(const TColStd_Array1OfReal& Weight) = 0; + Standard_EXPORT virtual void SetWeight(const NCollection_Array1& Weight) = 0; DEFINE_STANDARD_RTTIEXT(AppDef_SmoothCriterion, Standard_Transient) - -protected: -private: }; #endif // _AppDef_SmoothCriterion_HeaderFile diff --git a/opencascade/AppDef_TheFunction.hxx b/opencascade/AppDef_TheFunction.hxx index e6dab6b3d..e92809fac 100644 --- a/opencascade/AppDef_TheFunction.hxx +++ b/opencascade/AppDef_TheFunction.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class AppDef_MultiLine; @@ -43,30 +44,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT AppDef_TheFunction( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -77,24 +78,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -102,31 +102,31 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; - AppDef_MultiLine MyMultiLine; - AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; - math_Vector myParameters; - Standard_Real FVal; - math_Vector ValGrad_F; - math_Matrix MyF; - math_Matrix PTLX; - math_Matrix PTLY; - math_Matrix PTLZ; - math_Matrix A; - math_Matrix DA; - AppDef_TheLeastSquares MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Done; + AppDef_MultiLine MyMultiLine; + AppParCurves_MultiCurve MyMultiCurve; + int Degre; + math_Vector myParameters; + double FVal; + math_Vector ValGrad_F; + math_Matrix MyF; + math_Matrix PTLX; + math_Matrix PTLY; + math_Matrix PTLZ; + math_Matrix A; + math_Matrix DA; + AppDef_TheLeastSquares MyLeastSquare; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _AppDef_TheFunction_HeaderFile diff --git a/opencascade/AppDef_TheGradient.hxx b/opencascade/AppDef_TheGradient.hxx index d1cf8566d..93b2c085d 100644 --- a/opencascade/AppDef_TheGradient.hxx +++ b/opencascade/AppDef_TheGradient.hxx @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class AppDef_MultiLine; @@ -48,18 +50,18 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT AppDef_TheGradient( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the Bezier curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -69,28 +71,27 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; -protected: private: AppParCurves_MultiCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + bool Done; }; #endif // _AppDef_TheGradient_HeaderFile diff --git a/opencascade/AppDef_TheLeastSquares.hxx b/opencascade/AppDef_TheLeastSquares.hxx index 31c9f8513..9eba2e6ac 100644 --- a/opencascade/AppDef_TheLeastSquares.hxx +++ b/opencascade/AppDef_TheLeastSquares.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -64,20 +62,20 @@ public: //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -94,59 +92,57 @@ public: //! and is also the same for each MultiLine point because //! they are approximated in parallel(so with the same //! parameter, only the vector B changes). - Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const math_Vector& Parameters, - const Standard_Integer NbPol); + Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const int NbPol); //! Initializes the fields of the object. - Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const AppParCurves_Constraint FirstCons, - const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + Standard_EXPORT AppDef_TheLeastSquares(const AppDef_MultiLine& SSP, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -170,10 +166,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -182,15 +175,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -206,25 +199,23 @@ public: protected: //! is used by the constructors above. - Standard_EXPORT void Init(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, const int FirstPoint, const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + Standard_EXPORT int NbBColumns(const AppDef_MultiLine& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -243,41 +234,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _AppDef_TheLeastSquares_HeaderFile diff --git a/opencascade/AppDef_TheResol.hxx b/opencascade/AppDef_TheResol.hxx index 64152e516..4d046b153 100644 --- a/opencascade/AppDef_TheResol.hxx +++ b/opencascade/AppDef_TheResol.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class AppDef_MultiLine; class AppDef_MyLineTool; @@ -48,21 +49,22 @@ public: //! and DA is the derivative bernstein matrix.(They can come //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. - Standard_EXPORT AppDef_TheResol(const AppDef_MultiLine& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + Standard_EXPORT AppDef_TheResol( + const AppDef_MultiLine& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -72,7 +74,7 @@ public: //! Returns the derivative of the constraint matrix. Standard_EXPORT const math_Matrix& ConstraintDerivative(const AppDef_MultiLine& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -81,30 +83,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const AppDef_MultiLine& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const AppDef_MultiLine& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _AppDef_TheResol_HeaderFile diff --git a/opencascade/AppDef_Variational.hxx b/opencascade/AppDef_Variational.hxx index 9fb62020a..ca0584e6b 100644 --- a/opencascade/AppDef_Variational.hxx +++ b/opencascade/AppDef_Variational.hxx @@ -23,21 +23,22 @@ #include #include -#include +#include +#include +#include #include #include #include -#include #include #include +#include class AppDef_SmoothCriterion; class math_Matrix; class FEmTool_Curve; class FEmTool_Assembly; -class PLib_Base; //! This class is used to smooth N points with constraints -//! by minimization of quadratic criterium but also +//! by minimization of quadratic criterium but also //! variational criterium in order to obtain " fair Curve " //! Computes the approximation of a Multiline by //! Variational optimization. @@ -47,45 +48,44 @@ public: DEFINE_STANDARD_ALLOC //! Constructor. - //! Initialization of the fields. - //! warning : Nc0 : number of PassagePoint consraints - //! Nc2 : number of TangencyPoint constraints - //! Nc3 : number of CurvaturePoint constraints - //! if - //! ((MaxDegree-Continuity)*MaxSegment -Nc0 - 2*Nc1 - //! -3*Nc2) - //! is negative + //! Initialization of the fields. + //! Warning: + //! Nc0 : number of PassagePoint consraints + //! Nc2 : number of TangencyPoint constraints + //! Nc3 : number of CurvaturePoint constraints + //! if ((MaxDegree-Continuity)*MaxSegment -Nc0 - 2*Nc1 -3*Nc2) + //! is negative //! The problem is over-constrained. //! //! Limitation : The MultiLine from AppDef has to be composed by //! only one Line ( Dimension 2 or 3). Standard_EXPORT AppDef_Variational( - const AppDef_MultiLine& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer MaxDegree = 14, - const Standard_Integer MaxSegment = 100, - const GeomAbs_Shape Continuity = GeomAbs_C2, - const Standard_Boolean WithMinMax = Standard_False, - const Standard_Boolean WithCutting = Standard_True, - const Standard_Real Tolerance = 1.0, - const Standard_Integer NbIterations = 2); + const AppDef_MultiLine& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const int MaxDegree = 14, + const int MaxSegment = 100, + const GeomAbs_Shape Continuity = GeomAbs_C2, + const bool WithMinMax = false, + const bool WithCutting = true, + const double Tolerance = 1.0, + const int NbIterations = 2); //! Makes the approximation with the current fields. Standard_EXPORT void Approximate(); //! returns True if the creation is done - //! and correspond to the current fields. - Standard_EXPORT Standard_Boolean IsCreated() const; + //! and correspond to the current fields. + Standard_EXPORT bool IsCreated() const; - //! returns True if the approximation is ok - //! and correspond to the current fields. - Standard_EXPORT Standard_Boolean IsDone() const; + //! returns True if the approximation is ok + //! and correspond to the current fields. + Standard_EXPORT bool IsDone() const; //! returns True if the problem is overconstrained //! in this case, approximation cannot be done. - Standard_EXPORT Standard_Boolean IsOverConstrained() const; + Standard_EXPORT bool IsOverConstrained() const; //! returns all the BSpline curves approximating the //! MultiLine from AppDef SSP after minimization of the parameter. @@ -94,15 +94,15 @@ public: //! returns the maximum of the distances between //! the points of the multiline and the approximation //! curves. - Standard_EXPORT Standard_Real MaxError() const; + Standard_EXPORT double MaxError() const; //! returns the index of the MultiPoint of ErrorMax - Standard_EXPORT Standard_Integer MaxErrorIndex() const; + Standard_EXPORT int MaxErrorIndex() const; //! returns the quadratic average of the distances between //! the points of the multiline and the approximation //! curves. - Standard_EXPORT Standard_Real QuadraticError() const; + Standard_EXPORT double QuadraticError() const; //! returns the distances between the points of the //! multiline and the approximation curves. @@ -110,46 +110,44 @@ public: //! returns the average error between //! the MultiLine from AppDef and the approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; //! returns the parameters uses to the approximations - Standard_EXPORT const Handle(TColStd_HArray1OfReal)& Parameters() const; + Standard_EXPORT const occ::handle>& Parameters() const; //! returns the knots uses to the approximations - Standard_EXPORT const Handle(TColStd_HArray1OfReal)& Knots() const; + Standard_EXPORT const occ::handle>& Knots() const; //! returns the values of the quality criterium. - Standard_EXPORT void Criterium(Standard_Real& VFirstOrder, - Standard_Real& VSecondOrder, - Standard_Real& VThirdOrder) const; + Standard_EXPORT void Criterium(double& VFirstOrder, + double& VSecondOrder, + double& VThirdOrder) const; - //! returns the Weights (as percent) associed to the criterium used in - //! the optimization. - Standard_EXPORT void CriteriumWeight(Standard_Real& Percent1, - Standard_Real& Percent2, - Standard_Real& Percent3) const; + //! returns the Weights (as percent) associed to the criterium used in + //! the optimization. + Standard_EXPORT void CriteriumWeight(double& Percent1, double& Percent2, double& Percent3) const; //! returns the Maximum Degree used in the approximation - Standard_EXPORT Standard_Integer MaxDegree() const; + Standard_EXPORT int MaxDegree() const; //! returns the Maximum of segment used in the approximation - Standard_EXPORT Standard_Integer MaxSegment() const; + Standard_EXPORT int MaxSegment() const; //! returns the Continuity used in the approximation Standard_EXPORT GeomAbs_Shape Continuity() const; - //! returns if the approximation search to minimize the + //! returns if the approximation search to minimize the //! maximum Error or not. - Standard_EXPORT Standard_Boolean WithMinMax() const; + Standard_EXPORT bool WithMinMax() const; - //! returns if the approximation can insert new Knots or not. - Standard_EXPORT Standard_Boolean WithCutting() const; + //! returns if the approximation can insert new Knots or not. + Standard_EXPORT bool WithCutting() const; //! returns the tolerance used in the approximation. - Standard_EXPORT Standard_Real Tolerance() const; + Standard_EXPORT double Tolerance() const; //! returns the number of iterations used in the approximation. - Standard_EXPORT Standard_Integer NbIterations() const; + Standard_EXPORT int NbIterations() const; //! Prints on the stream o information on the current state //! of the object. @@ -160,175 +158,173 @@ public: //! Define the constraints to approximate //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean - SetConstraints(const Handle(AppParCurves_HArray1OfConstraintCouple)& aConstrainst); + Standard_EXPORT bool SetConstraints( + const occ::handle>& aConstrainst); //! Defines the parameters used by the approximations. - Standard_EXPORT void SetParameters(const Handle(TColStd_HArray1OfReal)& param); + Standard_EXPORT void SetParameters(const occ::handle>& param); //! Defines the knots used by the approximations //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean SetKnots(const Handle(TColStd_HArray1OfReal)& knots); + Standard_EXPORT bool SetKnots(const occ::handle>& knots); //! Define the Maximum Degree used in the approximation //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean SetMaxDegree(const Standard_Integer Degree); + Standard_EXPORT bool SetMaxDegree(const int Degree); //! Define the maximum number of segments used in the approximation //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean SetMaxSegment(const Standard_Integer NbSegment); + Standard_EXPORT bool SetMaxSegment(const int NbSegment); //! Define the Continuity used in the approximation //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean SetContinuity(const GeomAbs_Shape C); + Standard_EXPORT bool SetContinuity(const GeomAbs_Shape C); - //! Define if the approximation search to minimize the + //! Define if the approximation search to minimize the //! maximum Error or not. - Standard_EXPORT void SetWithMinMax(const Standard_Boolean MinMax); + Standard_EXPORT void SetWithMinMax(const bool MinMax); - //! Define if the approximation can insert new Knots or not. + //! Define if the approximation can insert new Knots or not. //! If this value is incompatible with the others fields //! this method modify nothing and returns false - Standard_EXPORT Standard_Boolean SetWithCutting(const Standard_Boolean Cutting); + Standard_EXPORT bool SetWithCutting(const bool Cutting); //! define the Weights (as percent) associed to the criterium used in - //! the optimization. + //! the optimization. //! //! if Percent <= 0 - Standard_EXPORT void SetCriteriumWeight(const Standard_Real Percent1, - const Standard_Real Percent2, - const Standard_Real Percent3); + Standard_EXPORT void SetCriteriumWeight(const double Percent1, + const double Percent2, + const double Percent3); - //! define the Weight (as percent) associed to the - //! criterium Order used in the optimization : Others + //! define the Weight (as percent) associed to the + //! criterium Order used in the optimization : Others //! weights are updated. //! if Percent < 0 //! if Order < 1 or Order > 3 - Standard_EXPORT void SetCriteriumWeight(const Standard_Integer Order, - const Standard_Real Percent); + Standard_EXPORT void SetCriteriumWeight(const int Order, const double Percent); //! define the tolerance used in the approximation. - Standard_EXPORT void SetTolerance(const Standard_Real Tol); + Standard_EXPORT void SetTolerance(const double Tol); //! define the number of iterations used in the approximation. //! if Iter < 1 - Standard_EXPORT void SetNbIterations(const Standard_Integer Iter); + Standard_EXPORT void SetNbIterations(const int Iter); -protected: private: - Standard_EXPORT void TheMotor(Handle(AppDef_SmoothCriterion)& J, - const Standard_Real WQuadratic, - const Standard_Real WQuality, - Handle(FEmTool_Curve)& TheCurve, - TColStd_Array1OfReal& Ecarts); - - Standard_EXPORT void Adjusting(Handle(AppDef_SmoothCriterion)& J, - Standard_Real& WQuadratic, - Standard_Real& WQuality, - Handle(FEmTool_Curve)& TheCurve, - TColStd_Array1OfReal& Ecarts); - - Standard_EXPORT void Optimization(Handle(AppDef_SmoothCriterion)& J, - FEmTool_Assembly& A, - const Standard_Boolean ToAssemble, - const Standard_Real EpsDeg, - Handle(FEmTool_Curve)& Curve, - const TColStd_Array1OfReal& Parameters) const; - - Standard_EXPORT void Project(const Handle(FEmTool_Curve)& C, - const TColStd_Array1OfReal& Ti, - TColStd_Array1OfReal& ProjTi, - TColStd_Array1OfReal& Distance, - Standard_Integer& NumPoints, - Standard_Real& MaxErr, - Standard_Real& QuaErr, - Standard_Real& AveErr, - const Standard_Integer NbIterations = 2) const; - - Standard_EXPORT void ACR(Handle(FEmTool_Curve)& Curve, - TColStd_Array1OfReal& Ti, - const Standard_Integer Decima) const; - - Standard_EXPORT void SplitCurve(const Handle(FEmTool_Curve)& InCurve, - const TColStd_Array1OfReal& Ti, - const Standard_Real CurveTol, - Handle(FEmTool_Curve)& OutCurve, - Standard_Boolean& iscut) const; + Standard_EXPORT void TheMotor(occ::handle& J, + const double WQuadratic, + const double WQuality, + occ::handle& TheCurve, + NCollection_Array1& Ecarts); + + Standard_EXPORT void Adjusting(occ::handle& J, + double& WQuadratic, + double& WQuality, + occ::handle& TheCurve, + NCollection_Array1& Ecarts); + + Standard_EXPORT void Optimization(occ::handle& J, + FEmTool_Assembly& A, + const bool ToAssemble, + const double EpsDeg, + occ::handle& Curve, + const NCollection_Array1& Parameters) const; + + Standard_EXPORT void Project(const occ::handle& C, + const NCollection_Array1& Ti, + NCollection_Array1& ProjTi, + NCollection_Array1& Distance, + int& NumPoints, + double& MaxErr, + double& QuaErr, + double& AveErr, + const int NbIterations = 2) const; + + Standard_EXPORT void ACR(occ::handle& Curve, + NCollection_Array1& Ti, + const int Decima) const; + + Standard_EXPORT void SplitCurve(const occ::handle& InCurve, + const NCollection_Array1& Ti, + const double CurveTol, + occ::handle& OutCurve, + bool& iscut) const; Standard_EXPORT void Init(); Standard_EXPORT void InitSmoothCriterion(); - Standard_EXPORT void InitParameters(Standard_Real& Length); - - Standard_EXPORT void InitCriterionEstimations(const Standard_Real Length, - Standard_Real& J1, - Standard_Real& J2, - Standard_Real& J3) const; - - Standard_EXPORT void EstTangent(const Standard_Integer ipnt, math_Vector& VTang) const; - - Standard_EXPORT void EstSecnd(const Standard_Integer ipnt, - const math_Vector& VTang1, - const math_Vector& VTang2, - const Standard_Real Length, - math_Vector& VScnd) const; - - Standard_EXPORT void InitCutting(const Handle(PLib_Base)& aBase, - const Standard_Real CurvTol, - Handle(FEmTool_Curve)& aCurve) const; - - Standard_EXPORT void AssemblingConstraints(const Handle(FEmTool_Curve)& Curve, - const TColStd_Array1OfReal& Parameters, - const Standard_Real CBLONG, - FEmTool_Assembly& A) const; - - Standard_EXPORT Standard_Boolean InitTthetaF(const Standard_Integer ndimen, - const AppParCurves_Constraint typcon, - const Standard_Integer begin, - const Standard_Integer jndex); - - AppDef_MultiLine mySSP; - Standard_Integer myNbP3d; - Standard_Integer myNbP2d; - Standard_Integer myDimension; - Standard_Integer myFirstPoint; - Standard_Integer myLastPoint; - Standard_Integer myNbPoints; - Handle(TColStd_HArray1OfReal) myTabPoints; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Integer myNbConstraints; - Handle(TColStd_HArray1OfReal) myTabConstraints; - Standard_Integer myNbPassPoints; - Standard_Integer myNbTangPoints; - Standard_Integer myNbCurvPoints; - Handle(TColStd_HArray1OfInteger) myTypConstraints; - Handle(TColStd_HArray1OfReal) myTtheta; - Handle(TColStd_HArray1OfReal) myTfthet; - Standard_Integer myMaxDegree; - Standard_Integer myMaxSegment; - Standard_Integer myNbIterations; - Standard_Real myTolerance; - GeomAbs_Shape myContinuity; - Standard_Integer myNivCont; - Standard_Boolean myWithMinMax; - Standard_Boolean myWithCutting; - Standard_Real myPercent[3]; - Standard_Real myCriterium[4]; - Handle(AppDef_SmoothCriterion) mySmoothCriterion; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myKnots; - AppParCurves_MultiBSpCurve myMBSpCurve; - Standard_Real myMaxError; - Standard_Integer myMaxErrorIndex; - Standard_Real myAverageError; - Standard_Boolean myIsCreated; - Standard_Boolean myIsDone; - Standard_Boolean myIsOverConstr; + Standard_EXPORT void InitParameters(double& Length); + + Standard_EXPORT void InitCriterionEstimations(const double Length, + double& J1, + double& J2, + double& J3) const; + + Standard_EXPORT void EstTangent(const int ipnt, math_Vector& VTang) const; + + Standard_EXPORT void EstSecnd(const int ipnt, + const math_Vector& VTang1, + const math_Vector& VTang2, + const double Length, + math_Vector& VScnd) const; + + Standard_EXPORT void InitCutting(const PLib_HermitJacobi& aBase, + const double CurvTol, + occ::handle& aCurve) const; + + Standard_EXPORT void AssemblingConstraints(const occ::handle& Curve, + const NCollection_Array1& Parameters, + const double CBLONG, + FEmTool_Assembly& A) const; + + Standard_EXPORT bool InitTthetaF(const int ndimen, + const AppParCurves_Constraint typcon, + const int begin, + const int jndex); + + AppDef_MultiLine mySSP; + int myNbP3d; + int myNbP2d; + int myDimension; + int myFirstPoint; + int myLastPoint; + int myNbPoints; + occ::handle> myTabPoints; + occ::handle> myConstraints; + int myNbConstraints; + occ::handle> myTabConstraints; + int myNbPassPoints; + int myNbTangPoints; + int myNbCurvPoints; + occ::handle> myTypConstraints; + occ::handle> myTtheta; + occ::handle> myTfthet; + int myMaxDegree; + int myMaxSegment; + int myNbIterations; + double myTolerance; + GeomAbs_Shape myContinuity; + int myNivCont; + bool myWithMinMax; + bool myWithCutting; + double myPercent[3]; + double myCriterium[4]; + occ::handle mySmoothCriterion; + occ::handle> myParameters; + occ::handle> myKnots; + AppParCurves_MultiBSpCurve myMBSpCurve; + double myMaxError; + int myMaxErrorIndex; + double myAverageError; + bool myIsCreated; + bool myIsDone; + bool myIsOverConstr; }; #endif // _AppDef_Variational_HeaderFile diff --git a/opencascade/AppParCurves.hxx b/opencascade/AppParCurves.hxx index 8c6164650..d002b8fb2 100644 --- a/opencascade/AppParCurves.hxx +++ b/opencascade/AppParCurves.hxx @@ -34,24 +34,24 @@ class AppParCurves public: DEFINE_STANDARD_ALLOC - Standard_EXPORT static void BernsteinMatrix(const Standard_Integer NbPoles, - const math_Vector& U, - math_Matrix& A); - - Standard_EXPORT static void Bernstein(const Standard_Integer NbPoles, - const math_Vector& U, - math_Matrix& A, - math_Matrix& DA); - - Standard_EXPORT static void SecondDerivativeBernstein(const Standard_Real U, math_Vector& DDA); - - Standard_EXPORT static void SplineFunction(const Standard_Integer NbPoles, - const Standard_Integer Degree, - const math_Vector& Parameters, - const math_Vector& FlatKnots, - math_Matrix& A, - math_Matrix& DA, - math_IntegerVector& Index); + Standard_EXPORT static void BernsteinMatrix(const int NbPoles, + const math_Vector& U, + math_Matrix& A); + + Standard_EXPORT static void Bernstein(const int NbPoles, + const math_Vector& U, + math_Matrix& A, + math_Matrix& DA); + + Standard_EXPORT static void SecondDerivativeBernstein(const double U, math_Vector& DDA); + + Standard_EXPORT static void SplineFunction(const int NbPoles, + const int Degree, + const math_Vector& Parameters, + const math_Vector& FlatKnots, + math_Matrix& A, + math_Matrix& DA, + math_IntegerVector& Index); }; #endif // _AppParCurves_HeaderFile diff --git a/opencascade/AppParCurves_Array1OfConstraintCouple.hxx b/opencascade/AppParCurves_Array1OfConstraintCouple.hxx index b3e8ef71a..87670e6c5 100644 --- a/opencascade/AppParCurves_Array1OfConstraintCouple.hxx +++ b/opencascade/AppParCurves_Array1OfConstraintCouple.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_Array1OfConstraintCouple_HeaderFile -#define AppParCurves_Array1OfConstraintCouple_HeaderFile +//! @file AppParCurves_Array1OfConstraintCouple.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _AppParCurves_Array1OfConstraintCouple_hxx +#define _AppParCurves_Array1OfConstraintCouple_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_Array1OfConstraintCouple.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_Array1 directly.") + + Standard_DEPRECATED("AppParCurves_Array1OfConstraintCouple is deprecated, use " + "NCollection_Array1 directly") typedef NCollection_Array1 AppParCurves_Array1OfConstraintCouple; -#endif +#endif // _AppParCurves_Array1OfConstraintCouple_hxx diff --git a/opencascade/AppParCurves_Array1OfMultiBSpCurve.hxx b/opencascade/AppParCurves_Array1OfMultiBSpCurve.hxx index b7d81a5f9..45a5c177d 100644 --- a/opencascade/AppParCurves_Array1OfMultiBSpCurve.hxx +++ b/opencascade/AppParCurves_Array1OfMultiBSpCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_Array1OfMultiBSpCurve_HeaderFile -#define AppParCurves_Array1OfMultiBSpCurve_HeaderFile +//! @file AppParCurves_Array1OfMultiBSpCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _AppParCurves_Array1OfMultiBSpCurve_hxx +#define _AppParCurves_Array1OfMultiBSpCurve_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_Array1OfMultiBSpCurve.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_Array1 directly.") + + Standard_DEPRECATED("AppParCurves_Array1OfMultiBSpCurve is deprecated, use " + "NCollection_Array1 directly") typedef NCollection_Array1 AppParCurves_Array1OfMultiBSpCurve; -#endif +#endif // _AppParCurves_Array1OfMultiBSpCurve_hxx diff --git a/opencascade/AppParCurves_Array1OfMultiCurve.hxx b/opencascade/AppParCurves_Array1OfMultiCurve.hxx index 0fd326fcd..3d8468d34 100644 --- a/opencascade/AppParCurves_Array1OfMultiCurve.hxx +++ b/opencascade/AppParCurves_Array1OfMultiCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_Array1OfMultiCurve_HeaderFile -#define AppParCurves_Array1OfMultiCurve_HeaderFile +//! @file AppParCurves_Array1OfMultiCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _AppParCurves_Array1OfMultiCurve_hxx +#define _AppParCurves_Array1OfMultiCurve_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_Array1OfMultiCurve.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_Array1 directly.") + + Standard_DEPRECATED("AppParCurves_Array1OfMultiCurve is deprecated, use " + "NCollection_Array1 directly") typedef NCollection_Array1 AppParCurves_Array1OfMultiCurve; -#endif +#endif // _AppParCurves_Array1OfMultiCurve_hxx diff --git a/opencascade/AppParCurves_Array1OfMultiPoint.hxx b/opencascade/AppParCurves_Array1OfMultiPoint.hxx index c3e2179cc..b5aa43ef8 100644 --- a/opencascade/AppParCurves_Array1OfMultiPoint.hxx +++ b/opencascade/AppParCurves_Array1OfMultiPoint.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_Array1OfMultiPoint_HeaderFile -#define AppParCurves_Array1OfMultiPoint_HeaderFile +//! @file AppParCurves_Array1OfMultiPoint.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _AppParCurves_Array1OfMultiPoint_hxx +#define _AppParCurves_Array1OfMultiPoint_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_Array1OfMultiPoint.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_Array1 directly.") + + Standard_DEPRECATED("AppParCurves_Array1OfMultiPoint is deprecated, use " + "NCollection_Array1 directly") typedef NCollection_Array1 AppParCurves_Array1OfMultiPoint; -#endif +#endif // _AppParCurves_Array1OfMultiPoint_hxx diff --git a/opencascade/AppParCurves_ConstraintCouple.hxx b/opencascade/AppParCurves_ConstraintCouple.hxx index a77fa41d4..af1115a10 100644 --- a/opencascade/AppParCurves_ConstraintCouple.hxx +++ b/opencascade/AppParCurves_ConstraintCouple.hxx @@ -35,24 +35,23 @@ public: //! Create a couple the object will have the //! constraint . - Standard_EXPORT AppParCurves_ConstraintCouple(const Standard_Integer TheIndex, + Standard_EXPORT AppParCurves_ConstraintCouple(const int TheIndex, const AppParCurves_Constraint Cons); //! returns the index of the constraint object. - Standard_EXPORT Standard_Integer Index() const; + Standard_EXPORT int Index() const; //! returns the constraint of the object. Standard_EXPORT AppParCurves_Constraint Constraint() const; //! Changes the index of the constraint object. - Standard_EXPORT void SetIndex(const Standard_Integer TheIndex); + Standard_EXPORT void SetIndex(const int TheIndex); //! Changes the constraint of the object. Standard_EXPORT void SetConstraint(const AppParCurves_Constraint Cons); -protected: private: - Standard_Integer myIndex; + int myIndex; AppParCurves_Constraint myConstraint; }; diff --git a/opencascade/AppParCurves_HArray1OfConstraintCouple.hxx b/opencascade/AppParCurves_HArray1OfConstraintCouple.hxx index 7e9f971f3..927bf3234 100644 --- a/opencascade/AppParCurves_HArray1OfConstraintCouple.hxx +++ b/opencascade/AppParCurves_HArray1OfConstraintCouple.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_HArray1OfConstraintCouple_HeaderFile -#define AppParCurves_HArray1OfConstraintCouple_HeaderFile +//! @file AppParCurves_HArray1OfConstraintCouple.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _AppParCurves_HArray1OfConstraintCouple_hxx +#define _AppParCurves_HArray1OfConstraintCouple_hxx + +#include #include -#include +#include + +Standard_HEADER_DEPRECATED( + "AppParCurves_HArray1OfConstraintCouple.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_HArray1 directly.") -DEFINE_HARRAY1(AppParCurves_HArray1OfConstraintCouple, AppParCurves_Array1OfConstraintCouple) + Standard_DEPRECATED("AppParCurves_HArray1OfConstraintCouple is deprecated, use " + "NCollection_HArray1 directly") +typedef NCollection_HArray1 AppParCurves_HArray1OfConstraintCouple; -#endif +#endif // _AppParCurves_HArray1OfConstraintCouple_hxx diff --git a/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx b/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx index cac25aec2..de904078c 100644 --- a/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx +++ b/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_HArray1OfMultiBSpCurve_HeaderFile -#define AppParCurves_HArray1OfMultiBSpCurve_HeaderFile +//! @file AppParCurves_HArray1OfMultiBSpCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _AppParCurves_HArray1OfMultiBSpCurve_hxx +#define _AppParCurves_HArray1OfMultiBSpCurve_hxx + +#include #include #include -#include +#include + +Standard_HEADER_DEPRECATED("AppParCurves_HArray1OfMultiBSpCurve.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_HArray1 directly.") -DEFINE_HARRAY1(AppParCurves_HArray1OfMultiBSpCurve, AppParCurves_Array1OfMultiBSpCurve) + Standard_DEPRECATED("AppParCurves_HArray1OfMultiBSpCurve is deprecated, use " + "NCollection_HArray1 directly") +typedef NCollection_HArray1 AppParCurves_HArray1OfMultiBSpCurve; -#endif +#endif // _AppParCurves_HArray1OfMultiBSpCurve_hxx diff --git a/opencascade/AppParCurves_HArray1OfMultiCurve.hxx b/opencascade/AppParCurves_HArray1OfMultiCurve.hxx index 2a7eedfea..beb56dbb1 100644 --- a/opencascade/AppParCurves_HArray1OfMultiCurve.hxx +++ b/opencascade/AppParCurves_HArray1OfMultiCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_HArray1OfMultiCurve_HeaderFile -#define AppParCurves_HArray1OfMultiCurve_HeaderFile +//! @file AppParCurves_HArray1OfMultiCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _AppParCurves_HArray1OfMultiCurve_hxx +#define _AppParCurves_HArray1OfMultiCurve_hxx + +#include #include #include -#include +#include + +Standard_HEADER_DEPRECATED("AppParCurves_HArray1OfMultiCurve.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_HArray1 directly.") -DEFINE_HARRAY1(AppParCurves_HArray1OfMultiCurve, AppParCurves_Array1OfMultiCurve) + Standard_DEPRECATED("AppParCurves_HArray1OfMultiCurve is deprecated, use " + "NCollection_HArray1 directly") +typedef NCollection_HArray1 AppParCurves_HArray1OfMultiCurve; -#endif +#endif // _AppParCurves_HArray1OfMultiCurve_hxx diff --git a/opencascade/AppParCurves_HArray1OfMultiPoint.hxx b/opencascade/AppParCurves_HArray1OfMultiPoint.hxx index 5896d775a..aa3f4adc5 100644 --- a/opencascade/AppParCurves_HArray1OfMultiPoint.hxx +++ b/opencascade/AppParCurves_HArray1OfMultiPoint.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_HArray1OfMultiPoint_HeaderFile -#define AppParCurves_HArray1OfMultiPoint_HeaderFile +//! @file AppParCurves_HArray1OfMultiPoint.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _AppParCurves_HArray1OfMultiPoint_hxx +#define _AppParCurves_HArray1OfMultiPoint_hxx + +#include #include #include -#include +#include + +Standard_HEADER_DEPRECATED("AppParCurves_HArray1OfMultiPoint.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_HArray1 directly.") -DEFINE_HARRAY1(AppParCurves_HArray1OfMultiPoint, AppParCurves_Array1OfMultiPoint) + Standard_DEPRECATED("AppParCurves_HArray1OfMultiPoint is deprecated, use " + "NCollection_HArray1 directly") +typedef NCollection_HArray1 AppParCurves_HArray1OfMultiPoint; -#endif +#endif // _AppParCurves_HArray1OfMultiPoint_hxx diff --git a/opencascade/AppParCurves_MultiBSpCurve.hxx b/opencascade/AppParCurves_MultiBSpCurve.hxx index ed65876a7..9ab09ebc0 100644 --- a/opencascade/AppParCurves_MultiBSpCurve.hxx +++ b/opencascade/AppParCurves_MultiBSpCurve.hxx @@ -21,13 +21,11 @@ #include #include -#include -#include +#include +#include #include #include -#include -#include -#include +#include #include class gp_Pnt; class gp_Pnt2d; @@ -68,103 +66,96 @@ public: //! creates a MultiBSpCurve, describing BSpline curves all //! containing the same number of MultiPoint. //! An exception is raised if Degree < 0. - Standard_EXPORT AppParCurves_MultiBSpCurve(const Standard_Integer NbPol); + Standard_EXPORT AppParCurves_MultiBSpCurve(const int NbPol); //! creates a MultiBSpCurve, describing BSpline curves all //! containing the same number of MultiPoint. //! Each MultiPoint must have NbCurves Poles. - Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_Array1OfMultiPoint& tabMU, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults); + Standard_EXPORT AppParCurves_MultiBSpCurve( + const NCollection_Array1& tabMU, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults); //! creates a MultiBSpCurve, describing BSpline //! curves, taking control points from . - Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_MultiCurve& SC, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults); + Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_MultiCurve& SC, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults); //! Knots of the multiBSpCurve are assigned to . - Standard_EXPORT void SetKnots(const TColStd_Array1OfReal& theKnots); + Standard_EXPORT void SetKnots(const NCollection_Array1& theKnots); //! Multiplicities of the multiBSpCurve are assigned //! to . - Standard_EXPORT void SetMultiplicities(const TColStd_Array1OfInteger& theMults); + Standard_EXPORT void SetMultiplicities(const NCollection_Array1& theMults); //! Returns an array of Reals containing //! the multiplicities of curves resulting from the approximation. - Standard_EXPORT const TColStd_Array1OfReal& Knots() const; + Standard_EXPORT const NCollection_Array1& Knots() const; //! Returns an array of Reals containing the //! multiplicities of curves resulting from the approximation. - Standard_EXPORT const TColStd_Array1OfInteger& Multiplicities() const; + Standard_EXPORT const NCollection_Array1& Multiplicities() const; //! returns the degree of the curve(s). - Standard_EXPORT virtual Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void Value(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt) const Standard_OVERRIDE; + Standard_EXPORT void Value(const int CuIndex, const double U, gp_Pnt& Pt) const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void Value(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt) const Standard_OVERRIDE; + Standard_EXPORT void Value(const int CuIndex, const double U, gp_Pnt2d& Pt) const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void D1(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt, - gp_Vec& V1) const Standard_OVERRIDE; + Standard_EXPORT void D1(const int CuIndex, const double U, gp_Pnt& Pt, gp_Vec& V1) const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void D1(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt, - gp_Vec2d& V1) const Standard_OVERRIDE; + Standard_EXPORT void D1(const int CuIndex, + const double U, + gp_Pnt2d& Pt, + gp_Vec2d& V1) const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void D2(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt, - gp_Vec& V1, - gp_Vec& V2) const Standard_OVERRIDE; + Standard_EXPORT void D2(const int CuIndex, + const double U, + gp_Pnt& Pt, + gp_Vec& V1, + gp_Vec& V2) const override; //! returns the value of the point with a parameter U //! on the BSpline curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void D2(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt, - gp_Vec2d& V1, - gp_Vec2d& V2) const Standard_OVERRIDE; + Standard_EXPORT void D2(const int CuIndex, + const double U, + gp_Pnt2d& Pt, + gp_Vec2d& V1, + gp_Vec2d& V2) const override; //! Prints on the stream o information on the current //! state of the object. //! Is used to redefine the operator <<. - Standard_EXPORT virtual void Dump(Standard_OStream& o) const Standard_OVERRIDE; + Standard_EXPORT void Dump(Standard_OStream& o) const override; -protected: private: - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - Standard_Integer myDegree; + occ::handle> myknots; + occ::handle> mymults; + int myDegree; }; #endif // _AppParCurves_MultiBSpCurve_HeaderFile diff --git a/opencascade/AppParCurves_MultiCurve.hxx b/opencascade/AppParCurves_MultiCurve.hxx index e458954b7..f82681b86 100644 --- a/opencascade/AppParCurves_MultiCurve.hxx +++ b/opencascade/AppParCurves_MultiCurve.hxx @@ -21,11 +21,12 @@ #include #include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include #include #include class AppParCurves_MultiPoint; @@ -66,138 +67,128 @@ public: //! creates a MultiCurve, describing Bezier curves all //! containing the same number of MultiPoint. //! An exception is raised if Degree < 0. - Standard_EXPORT AppParCurves_MultiCurve(const Standard_Integer NbPol); + Standard_EXPORT AppParCurves_MultiCurve(const int NbPol); //! creates a MultiCurve, describing Bezier curves all //! containing the same number of MultiPoint. //! Each MultiPoint must have NbCurves Poles. - Standard_EXPORT AppParCurves_MultiCurve(const AppParCurves_Array1OfMultiPoint& tabMU); + Standard_EXPORT AppParCurves_MultiCurve(const NCollection_Array1& tabMU); Standard_EXPORT virtual ~AppParCurves_MultiCurve(); //! The number of poles of the MultiCurve //! will be set to . - Standard_EXPORT void SetNbPoles(const Standard_Integer nbPoles); + Standard_EXPORT void SetNbPoles(const int nbPoles); //! sets the MultiPoint of range Index to the value //! . //! An exception is raised if Index <0 or Index >NbMPoint. - Standard_EXPORT void SetValue(const Standard_Integer Index, - const AppParCurves_MultiPoint& MPoint); + Standard_EXPORT void SetValue(const int Index, const AppParCurves_MultiPoint& MPoint); //! Returns the number of curves resulting from the //! approximation of a MultiLine. - Standard_EXPORT Standard_Integer NbCurves() const; + Standard_EXPORT int NbCurves() const; //! Returns the number of poles on curves resulting from the approximation of a MultiLine. - Standard_EXPORT virtual Standard_Integer NbPoles() const; + Standard_EXPORT virtual int NbPoles() const; //! returns the degree of the curves. - Standard_EXPORT virtual Standard_Integer Degree() const; + Standard_EXPORT virtual int Degree() const; //! returns the dimension of the CuIndex curve. //! An exception is raised if CuIndex<0 or CuIndex>NbCurves. - Standard_EXPORT Standard_Integer Dimension(const Standard_Integer CuIndex) const; + Standard_EXPORT int Dimension(const int CuIndex) const; //! returns the Pole array of the curve of range CuIndex. //! An exception is raised if the dimension of the curve //! is 2d. - Standard_EXPORT void Curve(const Standard_Integer CuIndex, TColgp_Array1OfPnt& TabPnt) const; + Standard_EXPORT void Curve(const int CuIndex, NCollection_Array1& TabPnt) const; //! returns the Pole array of the curve of range CuIndex. //! An exception is raised if the dimension of the curve //! is 3d. - Standard_EXPORT void Curve(const Standard_Integer CuIndex, TColgp_Array1OfPnt2d& TabPnt) const; + Standard_EXPORT void Curve(const int CuIndex, NCollection_Array1& TabPnt) const; //! returns the Index MultiPoint. //! An exception is raised if Index <0 or Index >Degree+1. - Standard_EXPORT const AppParCurves_MultiPoint& Value(const Standard_Integer Index) const; + Standard_EXPORT const AppParCurves_MultiPoint& Value(const int Index) const; //! returns the Nieme pole of the CuIndex curve. //! the curve must be a 3D curve. - Standard_EXPORT const gp_Pnt& Pole(const Standard_Integer CuIndex, - const Standard_Integer Nieme) const; + Standard_EXPORT const gp_Pnt& Pole(const int CuIndex, const int Nieme) const; //! returns the Nieme pole of the CuIndex curve. //! the curve must be a 2D curve. - Standard_EXPORT const gp_Pnt2d& Pole2d(const Standard_Integer CuIndex, - const Standard_Integer Nieme) const; + Standard_EXPORT const gp_Pnt2d& Pole2d(const int CuIndex, const int Nieme) const; //! Applies a transformation to the curve of range //! . //! newx = x + dx*oldx //! newy = y + dy*oldy for all points of the curve. //! newz = z + dz*oldz - Standard_EXPORT void Transform(const Standard_Integer CuIndex, - const Standard_Real x, - const Standard_Real dx, - const Standard_Real y, - const Standard_Real dy, - const Standard_Real z, - const Standard_Real dz); + Standard_EXPORT void Transform(const int CuIndex, + const double x, + const double dx, + const double y, + const double dy, + const double z, + const double dz); //! Applies a transformation to the Curve of range //! . //! newx = x + dx*oldx //! newy = y + dy*oldy for all points of the curve. - Standard_EXPORT void Transform2d(const Standard_Integer CuIndex, - const Standard_Real x, - const Standard_Real dx, - const Standard_Real y, - const Standard_Real dy); + Standard_EXPORT void Transform2d(const int CuIndex, + const double x, + const double dx, + const double y, + const double dy); //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void Value(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt) const; + Standard_EXPORT virtual void Value(const int CuIndex, const double U, gp_Pnt& Pt) const; //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void Value(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt) const; + Standard_EXPORT virtual void Value(const int CuIndex, const double U, gp_Pnt2d& Pt) const; //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void D1(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt, - gp_Vec& V1) const; + Standard_EXPORT virtual void D1(const int CuIndex, const double U, gp_Pnt& Pt, gp_Vec& V1) const; //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void D1(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt, - gp_Vec2d& V1) const; + Standard_EXPORT virtual void D1(const int CuIndex, + const double U, + gp_Pnt2d& Pt, + gp_Vec2d& V1) const; //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 3d. - Standard_EXPORT virtual void D2(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt& Pt, - gp_Vec& V1, - gp_Vec& V2) const; + Standard_EXPORT virtual void D2(const int CuIndex, + const double U, + gp_Pnt& Pt, + gp_Vec& V1, + gp_Vec& V2) const; //! returns the value of the point with a parameter U //! on the Bezier curve number CuIndex. //! An exception is raised if CuIndex <0 or > NbCurves. //! An exception is raised if the curve dimension is 2d. - Standard_EXPORT virtual void D2(const Standard_Integer CuIndex, - const Standard_Real U, - gp_Pnt2d& Pt, - gp_Vec2d& V1, - gp_Vec2d& V2) const; + Standard_EXPORT virtual void D2(const int CuIndex, + const double U, + gp_Pnt2d& Pt, + gp_Vec2d& V1, + gp_Vec2d& V2) const; //! Prints on the stream o information on the current //! state of the object. @@ -205,9 +196,7 @@ public: Standard_EXPORT virtual void Dump(Standard_OStream& o) const; protected: - Handle(AppParCurves_HArray1OfMultiPoint) tabPoint; - -private: + occ::handle> tabPoint; }; #endif // _AppParCurves_MultiCurve_HeaderFile diff --git a/opencascade/AppParCurves_MultiPoint.hxx b/opencascade/AppParCurves_MultiPoint.hxx index 868ad2603..9b4b15805 100644 --- a/opencascade/AppParCurves_MultiPoint.hxx +++ b/opencascade/AppParCurves_MultiPoint.hxx @@ -22,8 +22,9 @@ #include #include -#include -#include +#include +#include +#include #include #include class Standard_Transient; @@ -50,77 +51,76 @@ public: //! Points will be initialized with SetPoint and SetPoint2d. //! NbPoints is the number of 3D Points. //! NbPoints2d is the number of 2D Points. - Standard_EXPORT AppParCurves_MultiPoint(const Standard_Integer NbPoints, - const Standard_Integer NbPoints2d); + Standard_EXPORT AppParCurves_MultiPoint(const int NbPoints, const int NbPoints2d); //! creates a MultiPoint only composed of 3D points. - Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP); + Standard_EXPORT AppParCurves_MultiPoint(const NCollection_Array1& tabP); //! creates a MultiPoint only composed of 2D points. - Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt2d& tabP2d); + Standard_EXPORT AppParCurves_MultiPoint(const NCollection_Array1& tabP2d); //! constructs a set of Points used to approximate a //! Multiline. //! These Points can be of 2 or 3 dimensions. //! Points will be initialized with SetPoint and SetPoint2d. //! NbPoints is the total number of Points. - Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP, - const TColgp_Array1OfPnt2d& tabP2d); + Standard_EXPORT AppParCurves_MultiPoint(const NCollection_Array1& tabP, + const NCollection_Array1& tabP2d); Standard_EXPORT virtual ~AppParCurves_MultiPoint(); //! the 3d Point of range Index of this MultiPoint is //! set to . //! An exception is raised if Index < 0 or //! Index > number of 3d Points. - Standard_EXPORT void SetPoint(const Standard_Integer Index, const gp_Pnt& Point); + Standard_EXPORT void SetPoint(const int Index, const gp_Pnt& Point); //! returns the 3d Point of range Index. //! An exception is raised if Index < 0 or //! Index < number of 3d Points. - Standard_EXPORT const gp_Pnt& Point(const Standard_Integer Index) const; + Standard_EXPORT const gp_Pnt& Point(const int Index) const; //! The 2d Point of range Index is set to . //! An exception is raised if Index > 3d Points or //! Index > total number of Points. - Standard_EXPORT void SetPoint2d(const Standard_Integer Index, const gp_Pnt2d& Point); + Standard_EXPORT void SetPoint2d(const int Index, const gp_Pnt2d& Point); //! returns the 2d Point of range Index. //! An exception is raised if index <= number of //! 3d Points or Index > total number of Points. - Standard_EXPORT const gp_Pnt2d& Point2d(const Standard_Integer Index) const; + Standard_EXPORT const gp_Pnt2d& Point2d(const int Index) const; //! returns the dimension of the point of range Index. //! An exception is raised if Index <0 or Index > NbCurves. - Standard_Integer Dimension(const Standard_Integer Index) const; + int Dimension(const int Index) const; //! returns the number of points of dimension 3D. - Standard_Integer NbPoints() const; + int NbPoints() const; //! returns the number of points of dimension 2D. - Standard_Integer NbPoints2d() const; + int NbPoints2d() const; //! Applies a transformation to the curve of range //! . //! newx = x + dx*oldx //! newy = y + dy*oldy for all points of the curve. //! newz = z + dz*oldz - Standard_EXPORT void Transform(const Standard_Integer CuIndex, - const Standard_Real x, - const Standard_Real dx, - const Standard_Real y, - const Standard_Real dy, - const Standard_Real z, - const Standard_Real dz); + Standard_EXPORT void Transform(const int CuIndex, + const double x, + const double dx, + const double y, + const double dy, + const double z, + const double dz); //! Applies a transformation to the Curve of range //! . //! newx = x + dx*oldx //! newy = y + dy*oldy for all points of the curve. - Standard_EXPORT void Transform2d(const Standard_Integer CuIndex, - const Standard_Real x, - const Standard_Real dx, - const Standard_Real y, - const Standard_Real dy); + Standard_EXPORT void Transform2d(const int CuIndex, + const double x, + const double dx, + const double y, + const double dy); //! Prints on the stream o information on the current //! state of the object. @@ -128,12 +128,10 @@ public: Standard_EXPORT virtual void Dump(Standard_OStream& o) const; protected: - Handle(Standard_Transient) ttabPoint; - Handle(Standard_Transient) ttabPoint2d; - Standard_Integer nbP; - Standard_Integer nbP2d; - -private: + occ::handle ttabPoint; + occ::handle ttabPoint2d; + int nbP; + int nbP2d; }; #include diff --git a/opencascade/AppParCurves_MultiPoint.lxx b/opencascade/AppParCurves_MultiPoint.lxx index d3451112e..defaf430d 100644 --- a/opencascade/AppParCurves_MultiPoint.lxx +++ b/opencascade/AppParCurves_MultiPoint.lxx @@ -22,17 +22,17 @@ inline Standard_OStream& operator<<(Standard_OStream& o, const AppParCurves_Mult return o; } -inline Standard_Integer AppParCurves_MultiPoint::NbPoints() const +inline int AppParCurves_MultiPoint::NbPoints() const { return nbP; } -inline Standard_Integer AppParCurves_MultiPoint::NbPoints2d() const +inline int AppParCurves_MultiPoint::NbPoints2d() const { return nbP2d; } -inline Standard_Integer AppParCurves_MultiPoint::Dimension(const Standard_Integer Index) const +inline int AppParCurves_MultiPoint::Dimension(const int Index) const { if (Index < 0 || Index > (nbP + nbP2d)) { diff --git a/opencascade/AppParCurves_SequenceOfMultiBSpCurve.hxx b/opencascade/AppParCurves_SequenceOfMultiBSpCurve.hxx index 629f81fe6..079a8379b 100644 --- a/opencascade/AppParCurves_SequenceOfMultiBSpCurve.hxx +++ b/opencascade/AppParCurves_SequenceOfMultiBSpCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_SequenceOfMultiBSpCurve_HeaderFile -#define AppParCurves_SequenceOfMultiBSpCurve_HeaderFile +//! @file AppParCurves_SequenceOfMultiBSpCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _AppParCurves_SequenceOfMultiBSpCurve_hxx +#define _AppParCurves_SequenceOfMultiBSpCurve_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_SequenceOfMultiBSpCurve.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_Sequence directly.") + + Standard_DEPRECATED("AppParCurves_SequenceOfMultiBSpCurve is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence AppParCurves_SequenceOfMultiBSpCurve; -#endif +#endif // _AppParCurves_SequenceOfMultiBSpCurve_hxx diff --git a/opencascade/AppParCurves_SequenceOfMultiCurve.hxx b/opencascade/AppParCurves_SequenceOfMultiCurve.hxx index e2abf9f80..0ac21a16b 100644 --- a/opencascade/AppParCurves_SequenceOfMultiCurve.hxx +++ b/opencascade/AppParCurves_SequenceOfMultiCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1991-04-11 -// Created by: Laurent PAINNOT -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef AppParCurves_SequenceOfMultiCurve_HeaderFile -#define AppParCurves_SequenceOfMultiCurve_HeaderFile +//! @file AppParCurves_SequenceOfMultiCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _AppParCurves_SequenceOfMultiCurve_hxx +#define _AppParCurves_SequenceOfMultiCurve_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("AppParCurves_SequenceOfMultiCurve.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_Sequence directly.") + + Standard_DEPRECATED("AppParCurves_SequenceOfMultiCurve is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence AppParCurves_SequenceOfMultiCurve; -#endif +#endif // _AppParCurves_SequenceOfMultiCurve_hxx diff --git a/opencascade/AppStdL_Application.hxx b/opencascade/AppStdL_Application.hxx index 1d8515d5d..6295a7dfd 100644 --- a/opencascade/AppStdL_Application.hxx +++ b/opencascade/AppStdL_Application.hxx @@ -20,19 +20,16 @@ #include -class AppStdL_Application; -DEFINE_STANDARD_HANDLE(AppStdL_Application, TDocStd_Application) - //! Legacy class defining resources name for lite OCAF documents class AppStdL_Application : public TDocStd_Application { public: - //! returns the file name which contains application + //! returns the file name which contains application //! resources - Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE; + Standard_EXPORT const char* ResourcesName() override; //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; DEFINE_STANDARD_RTTIEXT(AppStdL_Application, TDocStd_Application) }; diff --git a/opencascade/AppStd_Application.hxx b/opencascade/AppStd_Application.hxx index c84915364..388f07540 100644 --- a/opencascade/AppStd_Application.hxx +++ b/opencascade/AppStd_Application.hxx @@ -20,19 +20,15 @@ #include -class AppStd_Application; -DEFINE_STANDARD_HANDLE(AppStd_Application, TDocStd_Application) - //! Legacy class defining resources name for standard OCAF documents class AppStd_Application : public TDocStd_Application { public: - //! returns the file name which contains application - //! resources - Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE; + //! returns the file name which contains application resources + Standard_EXPORT const char* ResourcesName() override; //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; DEFINE_STANDARD_RTTIEXT(AppStd_Application, TDocStd_Application) }; diff --git a/opencascade/ApproxInt_KnotTools.hxx b/opencascade/ApproxInt_KnotTools.hxx index 5a23977e1..e24c8c253 100644 --- a/opencascade/ApproxInt_KnotTools.hxx +++ b/opencascade/ApproxInt_KnotTools.hxx @@ -18,15 +18,15 @@ #include #include #include -#include +#include #include #include #include #include #include -#include -#include -#include +#include +#include +#include #include class IntPatch_WLine; @@ -61,31 +61,31 @@ public: //! @param theApproxU2V2 - Flag existence of second 2d set. //! @param theMinNbPnts - Minimal number of points per knot interval. //! @param theKnots - output knots sequence. - Standard_EXPORT static void BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ, - const TColgp_Array1OfPnt2d& thePntsU1V1, - const TColgp_Array1OfPnt2d& thePntsU2V2, - const math_Vector& thePars, - const Standard_Boolean theApproxXYZ, - const Standard_Boolean theApproxU1V1, - const Standard_Boolean theApproxU2V2, - const Standard_Integer theMinNbPnts, - NCollection_Vector& theKnots); + Standard_EXPORT static void BuildKnots(const NCollection_Array1& thePntsXYZ, + const NCollection_Array1& thePntsU1V1, + const NCollection_Array1& thePntsU2V2, + const math_Vector& thePars, + const bool theApproxXYZ, + const bool theApproxU1V1, + const bool theApproxU2V2, + const int theMinNbPnts, + NCollection_DynamicArray& theKnots); //! Builds discrete curvature - Standard_EXPORT static void BuildCurvature(const NCollection_LocalArray& theCoords, - const Standard_Integer theDim, - const math_Vector& thePars, - TColStd_Array1OfReal& theCurv, - Standard_Real& theMaxCurv); + Standard_EXPORT static void BuildCurvature(const NCollection_LocalArray& theCoords, + const int theDim, + const math_Vector& thePars, + NCollection_Array1& theCurv, + double& theMaxCurv); //! Defines preferable parametrization type for theWL Standard_EXPORT static Approx_ParametrizationType DefineParType( - const Handle(IntPatch_WLine)& theWL, - const Standard_Integer theFpar, - const Standard_Integer theLpar, - const Standard_Boolean theApproxXYZ, - const Standard_Boolean theApproxU1V1, - const Standard_Boolean theApproxU2V2); + const occ::handle& theWL, + const int theFpar, + const int theLpar, + const bool theApproxXYZ, + const bool theApproxU1V1, + const bool theApproxU2V2); private: //! Compute indices of knots: @@ -98,10 +98,10 @@ private: //! III: Put knots in monotone intervals of curvature. //! //! IV: Put additional knots near extrema points. - static void ComputeKnotInds(const NCollection_LocalArray& theCoords, - const Standard_Integer theDim, - const math_Vector& thePars, - NCollection_Sequence& theInds); + static void ComputeKnotInds(const NCollection_LocalArray& theCoords, + const int theDim, + const math_Vector& thePars, + NCollection_Sequence& theInds); //! Insert knots before index I. //! @@ -112,12 +112,12 @@ private: //! II: Check midpoint criteria: //! If exist point between two knot indices with angle greater than //! threshold value, then stop and put this index as knot. - static Standard_Boolean InsKnotBefI(const Standard_Integer theI, - const TColStd_Array1OfReal& theCurv, - const NCollection_LocalArray& theCoords, - const Standard_Integer theDim, - NCollection_Sequence& theInds, - const Standard_Boolean ChkCurv); + static bool InsKnotBefI(const int theI, + const NCollection_Array1& theCurv, + const NCollection_LocalArray& theCoords, + const int theDim, + NCollection_Sequence& theInds, + const bool ChkCurv); //! Perform knots filtration. //! @@ -126,9 +126,9 @@ private: //! II: Filter points with too small amount of points per knot interval. //! //! III: Fill Last Knot. - static void FilterKnots(NCollection_Sequence& theInds, - const Standard_Integer theMinNbPnts, - NCollection_Vector& theLKnots); + static void FilterKnots(NCollection_Sequence& theInds, + const int theMinNbPnts, + NCollection_DynamicArray& theLKnots); }; #endif diff --git a/opencascade/ApproxInt_MultiLineTool.lxx b/opencascade/ApproxInt_MultiLineTool.lxx index 1a69839e0..85bf4f76c 100644 --- a/opencascade/ApproxInt_MultiLineTool.lxx +++ b/opencascade/ApproxInt_MultiLineTool.lxx @@ -16,137 +16,138 @@ #include TheMultiLine_hxx -#include -#include -#include -#include +#include +#include +#include +#include +#include #include //================================================================================================= -inline Standard_Integer ApproxInt_MultiLineTool::NbP2d(const TheMultiLine& ML) +inline int ApproxInt_MultiLineTool::NbP2d(const TheMultiLine& ML) { return (ML.NbP2d()); } //================================================================================================= -inline Standard_Integer ApproxInt_MultiLineTool::NbP3d(const TheMultiLine& ML) +inline int ApproxInt_MultiLineTool::NbP3d(const TheMultiLine& ML) { return (ML.NbP3d()); } //================================================================================================= -inline Standard_Integer ApproxInt_MultiLineTool::FirstPoint(const TheMultiLine& ML) +inline int ApproxInt_MultiLineTool::FirstPoint(const TheMultiLine& ML) { return (ML.FirstPoint()); } //================================================================================================= -inline Standard_Integer ApproxInt_MultiLineTool::LastPoint(const TheMultiLine& ML) +inline int ApproxInt_MultiLineTool::LastPoint(const TheMultiLine& ML) { return (ML.LastPoint()); } //================================================================================================= -inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfPnt& TabPnt) +inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabPnt) { ML.Value(Index, TabPnt); } //================================================================================================= -inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfPnt2d& TabPnt2d) +inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabPnt2d) { ML.Value(Index, TabPnt2d); } //================================================================================================= -inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfPnt& TabPnt, - TColgp_Array1OfPnt2d& TabPnt2d) +inline void ApproxInt_MultiLineTool::Value(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabPnt, + NCollection_Array1& TabPnt2d) { ML.Value(Index, TabPnt, TabPnt2d); } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfVec& TabVec) +inline bool ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabVec) { return (ML.Tangency(Index, TabVec)); } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfVec2d& TabVec2d) +inline bool ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabVec2d) { return (ML.Tangency(Index, TabVec2d)); } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, - const Standard_Integer Index, - TColgp_Array1OfVec& TabVec, - TColgp_Array1OfVec2d& TabVec2d) +inline bool ApproxInt_MultiLineTool::Tangency(const TheMultiLine& ML, + const int Index, + NCollection_Array1& TabVec, + NCollection_Array1& TabVec2d) { return (ML.Tangency(Index, TabVec, TabVec2d)); } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML - , - const Standard_Integer // Index - , - TColgp_Array1OfVec&) +inline bool ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML + , + const int // Index + , + NCollection_Array1&) { // TabVec - return Standard_False; + return false; } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML - , - const Standard_Integer // Index - , - TColgp_Array1OfVec2d&) +inline bool ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML + , + const int // Index + , + NCollection_Array1&) { // TabVec2d - return Standard_False; + return false; } //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML - , - const Standard_Integer // Index - , - TColgp_Array1OfVec& // TabVec - , - TColgp_Array1OfVec2d&) +inline bool ApproxInt_MultiLineTool::Curvature(const TheMultiLine& // ML + , + const int // Index + , + NCollection_Array1& // TabVec + , + NCollection_Array1&) { // TabVec2d - return Standard_False; + return false; } //================================================================================================= inline Approx_Status ApproxInt_MultiLineTool::WhatStatus(const TheMultiLine& ML, - const Standard_Integer, - const Standard_Integer) + const int, + const int) { //-- PointsAdded, //-- NoPointsAdded, @@ -157,10 +158,10 @@ inline Approx_Status ApproxInt_MultiLineTool::WhatStatus(const TheMultiLine& ML, //================================================================================================= -inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer NbPMin) +inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& ML, + const int I1, + const int I2, + const int NbPMin) { return (ML.MakeMLBetween(I1, I2, NbPMin)); @@ -168,11 +169,11 @@ inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& //================================================================================================= -inline Standard_Boolean ApproxInt_MultiLineTool::MakeMLOneMorePoint(const TheMultiLine& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer indbad, - TheMultiLine& OtherLine) +inline bool ApproxInt_MultiLineTool::MakeMLOneMorePoint(const TheMultiLine& ML, + const int I1, + const int I2, + const int indbad, + TheMultiLine& OtherLine) { return (ML.MakeMLOneMorePoint(I1, I2, indbad, OtherLine)); } diff --git a/opencascade/ApproxInt_SvSurfaces.hxx b/opencascade/ApproxInt_SvSurfaces.hxx index 7a8b4e5e9..d0fcc4aa3 100644 --- a/opencascade/ApproxInt_SvSurfaces.hxx +++ b/opencascade/ApproxInt_SvSurfaces.hxx @@ -49,53 +49,53 @@ public: } //! returns True if Tg,Tguv1 Tguv2 can be computed. - Standard_EXPORT virtual Standard_Boolean Compute(Standard_Real& u1, - Standard_Real& v1, - Standard_Real& u2, - Standard_Real& v2, - gp_Pnt& Pt, - gp_Vec& Tg, - gp_Vec2d& Tguv1, - gp_Vec2d& Tguv2) = 0; + Standard_EXPORT virtual bool Compute(double& u1, + double& v1, + double& u2, + double& v2, + gp_Pnt& Pt, + gp_Vec& Tg, + gp_Vec2d& Tguv1, + gp_Vec2d& Tguv2) = 0; - Standard_EXPORT virtual void Pnt(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Pnt& P) = 0; + Standard_EXPORT virtual void Pnt(const double u1, + const double v1, + const double u2, + const double v2, + gp_Pnt& P) = 0; //! computes point on curve and parameters on the surfaces - Standard_EXPORT virtual Standard_Boolean SeekPoint(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - IntSurf_PntOn2S& Point) = 0; + Standard_EXPORT virtual bool SeekPoint(const double u1, + const double v1, + const double u2, + const double v2, + IntSurf_PntOn2S& Point) = 0; - Standard_EXPORT virtual Standard_Boolean Tangency(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec& Tg) = 0; + Standard_EXPORT virtual bool Tangency(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec& Tg) = 0; - Standard_EXPORT virtual Standard_Boolean TangencyOnSurf1(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg) = 0; + Standard_EXPORT virtual bool TangencyOnSurf1(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) = 0; - Standard_EXPORT virtual Standard_Boolean TangencyOnSurf2(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg) = 0; + Standard_EXPORT virtual bool TangencyOnSurf2(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) = 0; Standard_EXPORT virtual ~ApproxInt_SvSurfaces(); - void SetUseSolver(const Standard_Boolean theUseSol) { myUseSolver = theUseSol; } + void SetUseSolver(const bool theUseSol) { myUseSolver = theUseSol; } - virtual Standard_Boolean GetUseSolver() const { return myUseSolver; } + virtual bool GetUseSolver() const { return myUseSolver; } private: - Standard_Boolean myUseSolver; + bool myUseSolver; }; #endif // _ApproxInt_SvSurfaces_HeaderFile diff --git a/opencascade/Approx_Array1OfAdHSurface.hxx b/opencascade/Approx_Array1OfAdHSurface.hxx index 5c5ea5a37..eba96d057 100644 --- a/opencascade/Approx_Array1OfAdHSurface.hxx +++ b/opencascade/Approx_Array1OfAdHSurface.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-01-26 -// Created by: Laurent PAINNOT -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Approx_Array1OfAdHSurface_HeaderFile -#define Approx_Array1OfAdHSurface_HeaderFile +//! @file Approx_Array1OfAdHSurface.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1> directly instead. +#ifndef _Approx_Array1OfAdHSurface_hxx +#define _Approx_Array1OfAdHSurface_hxx + +#include #include #include -typedef NCollection_Array1 Approx_Array1OfAdHSurface; +Standard_HEADER_DEPRECATED("Approx_Array1OfAdHSurface.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Array1> directly.") + + Standard_DEPRECATED("Approx_Array1OfAdHSurface is deprecated, use " + "NCollection_Array1> directly") +typedef NCollection_Array1> Approx_Array1OfAdHSurface; -#endif +#endif // _Approx_Array1OfAdHSurface_hxx diff --git a/opencascade/Approx_Array1OfGTrsf2d.hxx b/opencascade/Approx_Array1OfGTrsf2d.hxx index 5b90de5b9..76afcb09b 100644 --- a/opencascade/Approx_Array1OfGTrsf2d.hxx +++ b/opencascade/Approx_Array1OfGTrsf2d.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-01-26 -// Created by: Laurent PAINNOT -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Approx_Array1OfGTrsf2d_HeaderFile -#define Approx_Array1OfGTrsf2d_HeaderFile +//! @file Approx_Array1OfGTrsf2d.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _Approx_Array1OfGTrsf2d_hxx +#define _Approx_Array1OfGTrsf2d_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("Approx_Array1OfGTrsf2d.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Array1 directly.") + + Standard_DEPRECATED( + "Approx_Array1OfGTrsf2d is deprecated, use NCollection_Array1 directly") typedef NCollection_Array1 Approx_Array1OfGTrsf2d; -#endif +#endif // _Approx_Array1OfGTrsf2d_hxx diff --git a/opencascade/Approx_BSplineApproxInterp.hxx b/opencascade/Approx_BSplineApproxInterp.hxx new file mode 100644 index 000000000..15fc66ad4 --- /dev/null +++ b/opencascade/Approx_BSplineApproxInterp.hxx @@ -0,0 +1,237 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Approx_BSplineApproxInterp_HeaderFile +#define _Approx_BSplineApproxInterp_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include + +class GeomAdaptor_Curve; + +//! Constrained least-squares B-spline curve approximation with exact interpolation constraints. +//! +//! This class fits a B-spline curve through a set of 3D points, where each point +//! can be either approximated (in the least-squares sense) or exactly interpolated. +//! Selected interpolation points can additionally be marked as "kinks" - the solver +//! then inserts high-multiplicity knots at the corresponding parameters to preserve +//! C0 discontinuities. +//! +//! The algorithm solves a KKT (Karush-Kuhn-Tucker) saddle-point system: +//! @code +//! | A^T*A C^T L^T | | x | | A^T*b | +//! | C 0 0 | * | l | = | d | +//! | L 0 0 | | m | | 0 | +//! @endcode +//! where: +//! - A is the basis matrix for approximated points +//! - C is the basis matrix for interpolated points +//! - L encodes continuity constraints (C1/C2 for closed curves) +//! - x are the control point coordinates +//! - l, m are Lagrange multipliers +//! +//! Usage: +//! @code +//! NCollection_Array1 aPts(1, 100); +//! // ... fill points ... +//! Approx_BSplineApproxInterp anApprox(aPts, 20); +//! anApprox.InterpolatePoint(0); // first point exact +//! anApprox.InterpolatePoint(99); // last point exact +//! anApprox.InterpolatePoint(50, true); // kink at midpoint +//! anApprox.Perform(aParams); +//! if (anApprox.IsDone()) +//! { +//! const occ::handle& aCurve = anApprox.Curve(); +//! double aMaxErr = anApprox.MaxError(); +//! } +//! @endcode +class Approx_BSplineApproxInterp +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates a constrained approximation solver. + //! @param[in] thePoints array of 3D points to fit (1-based indexing) + //! @param[in] theNbControlPts desired number of control points for the B-spline + //! @param[in] theDegree degree of the B-spline (default 3) + //! @param[in] theContinuousIfClosed if true, enforces C2 continuity for closed curves + Standard_EXPORT Approx_BSplineApproxInterp(const NCollection_Array1& thePoints, + int theNbControlPts, + int theDegree = 3, + bool theContinuousIfClosed = false); + + //! Marks a point to be exactly interpolated rather than approximated. + //! @param[in] thePointIndex 0-based index of the point + //! @param[in] theWithKink if true, a kink (C0 break) is inserted at this parameter + Standard_EXPORT void InterpolatePoint(int thePointIndex, bool theWithKink = false); + + //! Performs the fit using automatically computed parameters. + //! Parameters are computed from input points using current parametrization alpha. + Standard_EXPORT void Perform(); + + //! Performs the fit with given parameters. + //! @param[in] theParams parameter values for each point (size must match point count) + Standard_EXPORT void Perform(const NCollection_Array1& theParams); + + //! Performs the fit with iterative parameter optimization using automatically + //! computed initial parameters. + //! @param[in] theMaxIter maximum number of optimization iterations + Standard_EXPORT void PerformOptimal(int theMaxIter); + + //! Performs the fit with iterative parameter optimization. + //! Parameters of approximated points are re-projected onto the curve + //! after each iteration to improve the fit. + //! @param[in] theParams initial parameter values + //! @param[in] theMaxIter maximum number of optimization iterations + Standard_EXPORT void PerformOptimal(const NCollection_Array1& theParams, int theMaxIter); + + //! Returns true if the fit was successfully computed. + [[nodiscard]] bool IsDone() const { return myIsDone; } + + //! Returns the resulting B-spline curve. + [[nodiscard]] Standard_EXPORT const occ::handle& Curve() const; + + //! Returns the maximum approximation error (distance at approximated points). + [[nodiscard]] double MaxError() const { return myMaxError; } + + //! Sets the parametrization power for automatic parameter computation. + //! 0.0 = uniform, 0.5 = centripetal (default), 1.0 = chord-length. + //! @param[in] theAlpha parametrization exponent in [0, 1] + void SetParametrizationAlpha(double theAlpha) { myAlpha = theAlpha; } + + //! Sets the minimum pivot value for the Gauss solver. + //! Matrices with pivots below this threshold are treated as singular. + //! @param[in] theMinPivot minimum pivot threshold (default 1e-20) + void SetMinPivot(double theMinPivot) { myMinPivot = theMinPivot; } + + //! Sets the relative tolerance for detecting closed curves. + //! Closedness is detected when first/last points are within + //! theRelTol * (bounding box diagonal). + //! @param[in] theRelTol relative tolerance (default 1e-12) + void SetClosedTolerance(double theRelTol) { myClosedRelTol = theRelTol; } + + //! Sets the tolerance for detecting duplicate knot positions during insertion. + //! @param[in] theTol knot matching tolerance (default 1e-4) + void SetKnotInsertionTolerance(double theTol) { myKnotInsertTol = theTol; } + + //! Sets the convergence tolerance for parameter optimization. + //! Optimization stops when relative error reduction falls below this value. + //! @param[in] theTol convergence tolerance (default 1e-3) + void SetConvergenceTolerance(double theTol) { myConvergenceTol = theTol; } + + //! Sets the tolerance for point projection onto curve during optimization. + //! @param[in] theTol projection accuracy (default 1e-6) + void SetProjectionTolerance(double theTol) { myProjectionTol = theTol; } + +private: + //! Computes centripetal/chord-length parameters from point distances. + //! @param[in] theAlpha parametrization power + //! @return array of parameters in [0, 1] + NCollection_Array1 computeParameters(double theAlpha) const; + + //! Computes knot vector from parameters and number of control points. + //! Inserts high-multiplicity knots at kink parameters. + //! @param[in] theNbCP number of control points + //! @param[in] theParams parameter values + //! @param[out] theKnots computed knot values + //! @param[out] theMults computed knot multiplicities + void computeKnots(int theNbCP, + const NCollection_Array1& theParams, + NCollection_Array1& theKnots, + NCollection_Array1& theMults) const; + + //! Solves the constrained least-squares system. + //! @param[in] theParams parameter values + //! @param[in] theKnots knot values + //! @param[in] theMults knot multiplicities + //! @return true if the system was solved successfully + bool solve(const NCollection_Array1& theParams, + const NCollection_Array1& theKnots, + const NCollection_Array1& theMults); + + //! Builds the B-spline basis matrix for given parameters and flat knots. + //! @param[in] theFlatKnots flat knot vector + //! @param[in] theParams parameter values (1-based) + //! @param[in] theDerivOrder derivative order (0 = values, 1 = first deriv, etc.) + //! @return matrix of size (theParams.Length() x nControlPoints) + math_Matrix buildBasisMatrix(const NCollection_Array1& theFlatKnots, + const NCollection_Array1& theParams, + int theDerivOrder = 0) const; + + //! Builds the continuity constraint matrix for closed curve C1/C2 conditions. + //! @param[in] theNbCtrPnts number of control points + //! @param[in] theNbContinuity number of continuity conditions + //! @param[in] theParams parameter values + //! @param[in] theFlatKnots flat knot vector + //! @return continuity matrix (theNbContinuity x theNbCtrPnts) + math_Matrix buildContinuityMatrix(int theNbCtrPnts, + int theNbContinuity, + const NCollection_Array1& theParams, + const NCollection_Array1& theFlatKnots) const; + + //! Re-projects approximated points onto the curve to optimize parameters. + //! @param[in] theCurve current fitted curve + //! @param[in,out] theParams parameters to optimize + void optimizeParameters(const occ::handle& theCurve, + NCollection_Array1& theParams) const; + + //! Projects a point onto a curve using Newton iteration. + //! @param[in] thePnt point to project + //! @param[in] theCurveAdaptor curve adaptor to project onto + //! @param[in] theInitParam initial parameter guess + //! @param[out] theParam optimized parameter + //! @return projection distance + double projectOnCurve(const gp_Pnt& thePnt, + const GeomAdaptor_Curve& theCurveAdaptor, + double theInitParam, + double& theParam) const; + + //! Returns cached adaptor for the given curve, reloading cache when curve changes. + const GeomAdaptor_Curve& curveAdaptor(const occ::handle& theCurve) const; + + //! Returns true if the point set represents a closed curve. + bool isClosed() const; + + //! Returns true if the first and last points are in the interpolated set. + bool isFirstAndLastInterpolated() const; + + //! Computes the diagonal of the bounding box of the points. + double boundingBoxDiagonal() const; + + NCollection_Array1 myPoints; + NCollection_DynamicArray myInterpolated; + NCollection_DynamicArray myApproximated; + NCollection_DynamicArray myKinks; + occ::handle myCurve; + mutable occ::handle myCurveAdaptorCache; + int myDegree = 3; + int myNbControlPts = 0; + double myMaxError = 0.0; + double myAlpha = 0.5; + double myMinPivot = 1.0e-20; + double myClosedRelTol = 1.0e-12; + double myKnotInsertTol = 1.0e-4; + double myConvergenceTol = 1.0e-3; + double myProjectionTol = 1.0e-6; + bool myContinuousIfClosed = false; + bool myIsDone = false; +}; + +#endif // _Approx_BSplineApproxInterp_HeaderFile diff --git a/opencascade/Approx_Curve2d.hxx b/opencascade/Approx_Curve2d.hxx index 7fcef70ae..c3929f157 100644 --- a/opencascade/Approx_Curve2d.hxx +++ b/opencascade/Approx_Curve2d.hxx @@ -21,37 +21,37 @@ #include #include -//! Makes an approximation for HCurve2d from Adaptor3d +//! Makes an approximation for HCurve2d from Adaptor3d class Approx_Curve2d { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real TolU, - const Standard_Real TolV, - const GeomAbs_Shape Continuity, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSegments); + Standard_EXPORT Approx_Curve2d(const occ::handle& C2D, + const double First, + const double Last, + const double TolU, + const double TolV, + const GeomAbs_Shape Continuity, + const int MaxDegree, + const int MaxSegments); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; - Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve() const; + Standard_EXPORT occ::handle Curve() const; - Standard_EXPORT Standard_Real MaxError2dU() const; + Standard_EXPORT double MaxError2dU() const; - Standard_EXPORT Standard_Real MaxError2dV() const; + Standard_EXPORT double MaxError2dV() const; private: - Handle(Geom2d_BSplineCurve) myCurve; - Standard_Boolean myIsDone; - Standard_Boolean myHasResult; - Standard_Real myMaxError2dU; - Standard_Real myMaxError2dV; + occ::handle myCurve; + bool myIsDone; + bool myHasResult; + double myMaxError2dU; + double myMaxError2dV; }; #endif // _Approx_Curve2d_HeaderFile diff --git a/opencascade/Approx_Curve3d.hxx b/opencascade/Approx_Curve3d.hxx index 453f379b7..d432459f5 100644 --- a/opencascade/Approx_Curve3d.hxx +++ b/opencascade/Approx_Curve3d.hxx @@ -26,37 +26,37 @@ class Approx_Curve3d public: DEFINE_STANDARD_ALLOC - //! Approximation of a curve with respect of the + //! Approximation of a curve with respect of the //! required tolerance Tol3D. - Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve, - const Standard_Real Tol3d, - const GeomAbs_Shape Order, - const Standard_Integer MaxSegments, - const Standard_Integer MaxDegree); + Standard_EXPORT Approx_Curve3d(const occ::handle& Curve, + const double Tol3d, + const GeomAbs_Shape Order, + const int MaxSegments, + const int MaxDegree); - Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const; + Standard_EXPORT occ::handle Curve() const; - //! returns Standard_True if the approximation has - //! been done within required tolerance - Standard_EXPORT Standard_Boolean IsDone() const; + //! returns true if the approximation has + //! been done within required tolerance + Standard_EXPORT bool IsDone() const; - //! returns Standard_True if the approximation did come out - //! with a result that is not NECESSARELY within the required + //! returns true if the approximation did come out + //! with a result that is not NECESSARILY within the required //! tolerance - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; - //! returns the Maximum Error (>0 when an approximation - //! has been done, 0 if no approximation) - Standard_EXPORT Standard_Real MaxError() const; + //! returns the Maximum Error (>0 when an approximation + //! has been done, 0 if no approximation) + Standard_EXPORT double MaxError() const; - //! Print on the stream o information about the object + //! Print on the stream 'o' information about the object Standard_EXPORT void Dump(Standard_OStream& o) const; private: - Standard_Boolean myIsDone; - Standard_Boolean myHasResult; - Handle(Geom_BSplineCurve) myBSplCurve; - Standard_Real myMaxError; + bool myIsDone; + bool myHasResult; + occ::handle myBSplCurve; + double myMaxError; }; #endif // _Approx_Curve3d_HeaderFile diff --git a/opencascade/Approx_CurveOnSurface.hxx b/opencascade/Approx_CurveOnSurface.hxx index 5bcea0ada..6619f6610 100644 --- a/opencascade/Approx_CurveOnSurface.hxx +++ b/opencascade/Approx_CurveOnSurface.hxx @@ -24,7 +24,7 @@ class Geom_BSplineCurve; class Geom2d_BSplineCurve; -//! Approximation of curve on surface +//! Approximation of curve on surface class Approx_CurveOnSurface { public: @@ -33,16 +33,16 @@ public: //! This constructor calls perform method. This constructor is deprecated. Standard_DEPRECATED( "This constructor is deprecated. Use other constructor and perform method instead.") - Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D, - const Handle(Adaptor3d_Surface)& Surf, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol, - const GeomAbs_Shape Continuity, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSegments, - const Standard_Boolean Only3d = Standard_False, - const Standard_Boolean Only2d = Standard_False); + Standard_EXPORT Approx_CurveOnSurface(const occ::handle& C2D, + const occ::handle& Surf, + const double First, + const double Last, + const double Tol, + const GeomAbs_Shape Continuity, + const int MaxDegree, + const int MaxSegments, + const bool Only3d = false, + const bool Only2d = false); //! This constructor does not call perform method. //! @param theC2D 2D Curve to be approximated in 3D. @@ -50,27 +50,27 @@ public: //! @param theFirst First parameter of resulting curve. //! @param theFirst Last parameter of resulting curve. //! @param theTol Computation tolerance. - Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D, - const Handle(Adaptor3d_Surface)& theSurf, - const Standard_Real theFirst, - const Standard_Real theLast, - const Standard_Real theTol); + Standard_EXPORT Approx_CurveOnSurface(const occ::handle& theC2D, + const occ::handle& theSurf, + const double theFirst, + const double theLast, + const double theTol); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; - Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const; + Standard_EXPORT occ::handle Curve3d() const; - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; - Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const; + Standard_EXPORT occ::handle Curve2d() const; - Standard_EXPORT Standard_Real MaxError2dU() const; + Standard_EXPORT double MaxError2dU() const; - //! returns the maximum errors relatively to the U component or the V component of the + //! returns the maximum errors relatively to the U component or the V component of the //! 2d Curve - Standard_EXPORT Standard_Real MaxError2dV() const; + Standard_EXPORT double MaxError2dV() const; //! Constructs the 3d curve. Input parameters are ignored when the input curve is //! U-isoline or V-isoline. @@ -79,11 +79,11 @@ public: //! @param theContinuity Resulting continuity. //! @param theOnly3d Determines building only 3D curve. //! @param theOnly2d Determines building only 2D curve. - Standard_EXPORT void Perform(const Standard_Integer theMaxSegments, - const Standard_Integer theMaxDegree, - const GeomAbs_Shape theContinuity, - const Standard_Boolean theOnly3d = Standard_False, - const Standard_Boolean theOnly2d = Standard_False); + Standard_EXPORT void Perform(const int theMaxSegments, + const int theMaxDegree, + const GeomAbs_Shape theContinuity, + const bool theOnly3d = false, + const bool theOnly2d = false); protected: //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier, @@ -92,11 +92,11 @@ protected: //! @param theIsU Flag indicating that line is u const. //! @param theParam Line parameter. //! @param theIsForward Flag indicating forward parameterization on a isoline. - //! @return Standard_True when 2d curve is a line and Standard_False otherwise. - Standard_Boolean isIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D, - Standard_Boolean& theIsU, - Standard_Real& theParam, - Standard_Boolean& theIsForward) const; + //! @return true when 2d curve is a line and false otherwise. + bool isIsoLine(const occ::handle& theC2D, + bool& theIsU, + double& theParam, + bool& theIsForward) const; //! Builds 3D curve for a isoline. This method takes corresponding isoline from //! the input surface. @@ -104,38 +104,38 @@ protected: //! @param theIsU Flag indicating that line is u const. //! @param theParam Line parameter. //! @param theIsForward Flag indicating forward parameterization on a isoline. - //! @return Standard_True when 3d curve is built and Standard_False otherwise. - Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D, - const Standard_Boolean theIsU, - const Standard_Real theParam, - const Standard_Boolean theIsForward); + //! @return true when 3d curve is built and false otherwise. + bool buildC3dOnIsoLine(const occ::handle& theC2D, + const bool theIsU, + const double theParam, + const bool theIsForward); private: - Approx_CurveOnSurface& operator=(const Approx_CurveOnSurface&); + Approx_CurveOnSurface& operator=(const Approx_CurveOnSurface&) = delete; private: //! Input curve. - const Handle(Adaptor2d_Curve2d) myC2D; + const occ::handle myC2D; //! Input surface. - const Handle(Adaptor3d_Surface) mySurf; + const occ::handle mySurf; //! First parameter of the result. - const Standard_Real myFirst; + const double myFirst; //! Last parameter of the result. - const Standard_Real myLast; + const double myLast; //! Tolerance. - Standard_Real myTol; - - Handle(Geom2d_BSplineCurve) myCurve2d; - Handle(Geom_BSplineCurve) myCurve3d; - Standard_Boolean myIsDone; - Standard_Boolean myHasResult; - Standard_Real myError3d; - Standard_Real myError2dU; - Standard_Real myError2dV; + double myTol; + + occ::handle myCurve2d; + occ::handle myCurve3d; + bool myIsDone; + bool myHasResult; + double myError3d; + double myError2dU; + double myError2dV; }; #endif // _Approx_CurveOnSurface_HeaderFile diff --git a/opencascade/Approx_CurvilinearParameter.hxx b/opencascade/Approx_CurvilinearParameter.hxx index 5405c0f0f..94e8c9fbe 100644 --- a/opencascade/Approx_CurvilinearParameter.hxx +++ b/opencascade/Approx_CurvilinearParameter.hxx @@ -39,75 +39,75 @@ public: DEFINE_STANDARD_ALLOC //! case of a free 3D curve - Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D, - const Standard_Real Tol, - const GeomAbs_Shape Order, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSegments); + Standard_EXPORT Approx_CurvilinearParameter(const occ::handle& C3D, + const double Tol, + const GeomAbs_Shape Order, + const int MaxDegree, + const int MaxSegments); //! case of a curve on one surface - Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D, - const Handle(Adaptor3d_Surface)& Surf, - const Standard_Real Tol, - const GeomAbs_Shape Order, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSegments); + Standard_EXPORT Approx_CurvilinearParameter(const occ::handle& C2D, + const occ::handle& Surf, + const double Tol, + const GeomAbs_Shape Order, + const int MaxDegree, + const int MaxSegments); //! case of a curve on two surfaces - Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1, - const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor2d_Curve2d)& C2D2, - const Handle(Adaptor3d_Surface)& Surf2, - const Standard_Real Tol, - const GeomAbs_Shape Order, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSegments); + Standard_EXPORT Approx_CurvilinearParameter(const occ::handle& C2D1, + const occ::handle& Surf1, + const occ::handle& C2D2, + const occ::handle& Surf2, + const double Tol, + const GeomAbs_Shape Order, + const int MaxDegree, + const int MaxSegments); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; //! returns the Bspline curve corresponding to the reparametrized 3D curve - Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const; + Standard_EXPORT occ::handle Curve3d() const; //! returns the maximum error on the reparametrized 3D curve - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the BsplineCurve representing the reparametrized 2D curve on the //! first surface (case of a curve on one or two surfaces) - Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d1() const; + Standard_EXPORT occ::handle Curve2d1() const; //! returns the maximum error on the first reparametrized 2D curve - Standard_EXPORT Standard_Real MaxError2d1() const; + Standard_EXPORT double MaxError2d1() const; //! returns the BsplineCurve representing the reparametrized 2D curve on the //! second surface (case of a curve on two surfaces) - Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d2() const; + Standard_EXPORT occ::handle Curve2d2() const; //! returns the maximum error on the second reparametrized 2D curve - Standard_EXPORT Standard_Real MaxError2d2() const; + Standard_EXPORT double MaxError2d2() const; //! print the maximum errors(s) Standard_EXPORT void Dump(Standard_OStream& o) const; private: - Standard_EXPORT static void ToleranceComputation(const Handle(Adaptor2d_Curve2d)& C2D, - const Handle(Adaptor3d_Surface)& S, - const Standard_Integer MaxNumber, - const Standard_Real Tol, - Standard_Real& TolV, - Standard_Real& TolW); + Standard_EXPORT static void ToleranceComputation(const occ::handle& C2D, + const occ::handle& S, + const int MaxNumber, + const double Tol, + double& TolV, + double& TolW); private: - Standard_Integer myCase; - Standard_Boolean myDone; - Standard_Boolean myHasResult; - Handle(Geom_BSplineCurve) myCurve3d; - Standard_Real myMaxError3d; - Handle(Geom2d_BSplineCurve) myCurve2d1; - Standard_Real myMaxError2d1; - Handle(Geom2d_BSplineCurve) myCurve2d2; - Standard_Real myMaxError2d2; + int myCase; + bool myDone; + bool myHasResult; + occ::handle myCurve3d; + double myMaxError3d; + occ::handle myCurve2d1; + double myMaxError2d1; + occ::handle myCurve2d2; + double myMaxError2d2; }; #endif // _Approx_CurvilinearParameter_HeaderFile diff --git a/opencascade/Approx_CurvlinFunc.hxx b/opencascade/Approx_CurvlinFunc.hxx index fb236ce33..fdf409ff0 100644 --- a/opencascade/Approx_CurvlinFunc.hxx +++ b/opencascade/Approx_CurvlinFunc.hxx @@ -20,10 +20,8 @@ #include #include #include -#include -#include - -DEFINE_STANDARD_HANDLE(Approx_CurvlinFunc, Standard_Transient) +#include +#include //! defines an abstract curve with //! curvilinear parametrization @@ -31,118 +29,113 @@ class Approx_CurvlinFunc : public Standard_Transient { public: - Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol); + Standard_EXPORT Approx_CurvlinFunc(const occ::handle& C, const double Tol); - Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D, - const Handle(Adaptor3d_Surface)& S, - const Standard_Real Tol); + Standard_EXPORT Approx_CurvlinFunc(const occ::handle& C2D, + const occ::handle& S, + const double Tol); - Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1, - const Handle(Adaptor2d_Curve2d)& C2D2, - const Handle(Adaptor3d_Surface)& S1, - const Handle(Adaptor3d_Surface)& S2, - const Standard_Real Tol); + Standard_EXPORT Approx_CurvlinFunc(const occ::handle& C2D1, + const occ::handle& C2D2, + const occ::handle& S1, + const occ::handle& S2, + const double Tol); //! ---Purpose Update the tolerance to used - Standard_EXPORT void SetTol(const Standard_Real Tol); + Standard_EXPORT void SetTol(const double Tol); - Standard_EXPORT Standard_Real FirstParameter() const; + Standard_EXPORT double FirstParameter() const; - Standard_EXPORT Standard_Real LastParameter() const; + Standard_EXPORT double LastParameter() const; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; + Standard_EXPORT void Intervals(NCollection_Array1& T, const GeomAbs_Shape S) const; //! if First < 0 or Last > 1 - Standard_EXPORT void Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + Standard_EXPORT void Trim(const double First, const double Last, const double Tol); //! Computes length of the curve. Standard_EXPORT void Length(); //! Computes length of the curve segment. - Standard_EXPORT Standard_Real Length(Adaptor3d_Curve& C, - const Standard_Real FirstU, - const Standard_Real LasrU) const; + Standard_EXPORT double Length(Adaptor3d_Curve& C, const double FirstU, const double LasrU) const; - Standard_EXPORT Standard_Real GetLength() const; + Standard_EXPORT double GetLength() const; - //! returns original parameter corresponding S. if + //! returns original parameter corresponding S. if //! Case == 1 computation is performed on myC2D1 and mySurf1, //! otherwise it is done on myC2D2 and mySurf2. - Standard_EXPORT Standard_Real GetUParameter(Adaptor3d_Curve& C, - const Standard_Real S, - const Standard_Integer NumberOfCurve) const; + Standard_EXPORT double GetUParameter(Adaptor3d_Curve& C, + const double S, + const int NumberOfCurve) const; //! returns original parameter corresponding S. - Standard_EXPORT Standard_Real GetSParameter(const Standard_Real U) const; + Standard_EXPORT double GetSParameter(const double U) const; //! if myCase != 1 - Standard_EXPORT Standard_Boolean EvalCase1(const Standard_Real S, - const Standard_Integer Order, - TColStd_Array1OfReal& Result) const; + Standard_EXPORT bool EvalCase1(const double S, + const int Order, + NCollection_Array1& Result) const; //! if myCase != 2 - Standard_EXPORT Standard_Boolean EvalCase2(const Standard_Real S, - const Standard_Integer Order, - TColStd_Array1OfReal& Result) const; + Standard_EXPORT bool EvalCase2(const double S, + const int Order, + NCollection_Array1& Result) const; //! if myCase != 3 - Standard_EXPORT Standard_Boolean EvalCase3(const Standard_Real S, - const Standard_Integer Order, - TColStd_Array1OfReal& Result); + Standard_EXPORT bool EvalCase3(const double S, + const int Order, + NCollection_Array1& Result); DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc, Standard_Transient) -protected: private: Standard_EXPORT void Init(); - Standard_EXPORT void Init(Adaptor3d_Curve& C, - Handle(TColStd_HArray1OfReal)& Si, - Handle(TColStd_HArray1OfReal)& Ui) const; + Standard_EXPORT void Init(Adaptor3d_Curve& C, + occ::handle>& Si, + occ::handle>& Ui) const; //! returns curvilinear parameter corresponding U. - Standard_EXPORT Standard_Real GetSParameter(Adaptor3d_Curve& C, - const Standard_Real U, - const Standard_Real Length) const; - - Standard_EXPORT Standard_Boolean EvalCurOnSur(const Standard_Real S, - const Standard_Integer Order, - TColStd_Array1OfReal& Result, - const Standard_Integer NumberOfCurve) const; - - Handle(Adaptor3d_Curve) myC3D; - Handle(Adaptor2d_Curve2d) myC2D1; - Handle(Adaptor2d_Curve2d) myC2D2; - Handle(Adaptor3d_Surface) mySurf1; - Handle(Adaptor3d_Surface) mySurf2; - Standard_Integer myCase; - Standard_Real myFirstS; - Standard_Real myLastS; - Standard_Real myFirstU1; - Standard_Real myLastU1; - Standard_Real myFirstU2; - Standard_Real myLastU2; - Standard_Real myLength; - Standard_Real myLength1; - Standard_Real myLength2; - Standard_Real myTolLen; - Standard_Real myPrevS; - Standard_Real myPrevU; - Handle(TColStd_HArray1OfReal) myUi_1; - Handle(TColStd_HArray1OfReal) mySi_1; - Handle(TColStd_HArray1OfReal) myUi_2; - Handle(TColStd_HArray1OfReal) mySi_2; + Standard_EXPORT double GetSParameter(Adaptor3d_Curve& C, + const double U, + const double Length) const; + + Standard_EXPORT bool EvalCurOnSur(const double S, + const int Order, + NCollection_Array1& Result, + const int NumberOfCurve) const; + + occ::handle myC3D; + occ::handle myC2D1; + occ::handle myC2D2; + occ::handle mySurf1; + occ::handle mySurf2; + int myCase; + double myFirstS; + double myLastS; + double myFirstU1; + double myLastU1; + double myFirstU2; + double myLastU2; + double myLength; + double myLength1; + double myLength2; + double myTolLen; + double myPrevS; + double myPrevU; + occ::handle> myUi_1; + occ::handle> mySi_1; + occ::handle> myUi_2; + occ::handle> mySi_2; }; #endif // _Approx_CurvlinFunc_HeaderFile diff --git a/opencascade/Approx_FitAndDivide.hxx b/opencascade/Approx_FitAndDivide.hxx index 761c53ead..e98b9a366 100644 --- a/opencascade/Approx_FitAndDivide.hxx +++ b/opencascade/Approx_FitAndDivide.hxx @@ -23,9 +23,8 @@ #include #include #include -#include +#include #include -#include class AppParCurves_MultiCurve; class Approx_FitAndDivide @@ -39,21 +38,21 @@ public: //! with a cutting if the corresponding boolean is True. Standard_EXPORT Approx_FitAndDivide( const AppCont_Function& Line, - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-5, - const Standard_Real Tolerance2d = 1.0e-5, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-5, + const double Tolerance2d = 1.0e-5, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); //! Initializes the fields of the algorithm. Standard_EXPORT Approx_FitAndDivide( - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-05, - const Standard_Real Tolerance2d = 1.0e-05, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-05, + const double Tolerance2d = 1.0e-05, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); @@ -61,85 +60,78 @@ public: Standard_EXPORT void Perform(const AppCont_Function& Line); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! Changes the constraints of the approximation. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC); //! Changes the max number of segments, which is allowed for cutting. - Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments); + Standard_EXPORT void SetMaxSegments(const int theMaxSegments); //! Set inverse order of degree selection: //! if theInvOrdr = true, current degree is chosen by inverse order - //! from maxdegree to mindegree. //! By default inverse order is used. - Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder); + Standard_EXPORT void SetInvOrder(const bool theInvOrder); //! Set value of hang checking flag //! if this flag = true, possible hang of algorithm is checked //! and algorithm is forced to stop. //! By default hang checking is used. - Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking); + Standard_EXPORT void SetHangChecking(const bool theHangChecking); //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiCurve. - Standard_EXPORT void Error(const Standard_Integer Index, - Standard_Real& tol3d, - Standard_Real& tol2d) const; + Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const; //! Returns the number of MultiCurve doing the approximation //! of the MultiLine. - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; //! returns the approximation MultiCurve of range . - Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const; + Standard_EXPORT AppParCurves_MultiCurve Value(const int Index = 1) const; - Standard_EXPORT void Parameters(const Standard_Integer Index, - Standard_Real& firstp, - Standard_Real& lastp) const; + Standard_EXPORT void Parameters(const int Index, double& firstp, double& lastp) const; -protected: private: //! is internally used by the algorithms. - Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line, - const Standard_Real Ufirst, - const Standard_Real Ulast, - Standard_Real& TheTol3d, - Standard_Real& TheTol2d); - - AppParCurves_SequenceOfMultiCurve myMultiCurves; - TColStd_SequenceOfReal myfirstparam; - TColStd_SequenceOfReal mylastparam; - AppParCurves_MultiCurve TheMultiCurve; - Standard_Boolean alldone; - Standard_Boolean tolreached; - TColStd_SequenceOfReal Tolers3d; - TColStd_SequenceOfReal Tolers2d; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - Standard_Integer myMaxSegments; - Standard_Boolean myInvOrder; - Standard_Boolean myHangChecking; + Standard_EXPORT bool Compute(const AppCont_Function& Line, + const double Ufirst, + const double Ulast, + double& TheTol3d, + double& TheTol2d); + + NCollection_Sequence myMultiCurves; + NCollection_Sequence myfirstparam; + NCollection_Sequence mylastparam; + AppParCurves_MultiCurve TheMultiCurve; + bool alldone; + bool tolreached; + NCollection_Sequence Tolers3d; + NCollection_Sequence Tolers2d; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + int myMaxSegments; + bool myInvOrder; + bool myHangChecking; }; #endif // _Approx_FitAndDivide_HeaderFile diff --git a/opencascade/Approx_FitAndDivide2d.hxx b/opencascade/Approx_FitAndDivide2d.hxx index da98a33fb..52710f79f 100644 --- a/opencascade/Approx_FitAndDivide2d.hxx +++ b/opencascade/Approx_FitAndDivide2d.hxx @@ -23,9 +23,8 @@ #include #include #include -#include +#include #include -#include class AppParCurves_MultiCurve; class Approx_FitAndDivide2d @@ -39,21 +38,21 @@ public: //! with a cutting if the corresponding boolean is True. Standard_EXPORT Approx_FitAndDivide2d( const AppCont_Function& Line, - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-5, - const Standard_Real Tolerance2d = 1.0e-5, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-5, + const double Tolerance2d = 1.0e-5, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); //! Initializes the fields of the algorithm. Standard_EXPORT Approx_FitAndDivide2d( - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-05, - const Standard_Real Tolerance2d = 1.0e-05, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-05, + const double Tolerance2d = 1.0e-05, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); @@ -61,85 +60,78 @@ public: Standard_EXPORT void Perform(const AppCont_Function& Line); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! Changes the constraints of the approximation. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC); //! Changes the max number of segments, which is allowed for cutting. - Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments); + Standard_EXPORT void SetMaxSegments(const int theMaxSegments); //! Set inverse order of degree selection: //! if theInvOrdr = true, current degree is chosen by inverse order - //! from maxdegree to mindegree. //! By default inverse order is used. - Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder); + Standard_EXPORT void SetInvOrder(const bool theInvOrder); //! Set value of hang checking flag //! if this flag = true, possible hang of algorithm is checked //! and algorithm is forced to stop. //! By default hang checking is used. - Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking); + Standard_EXPORT void SetHangChecking(const bool theHangChecking); //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiCurve. - Standard_EXPORT void Error(const Standard_Integer Index, - Standard_Real& tol3d, - Standard_Real& tol2d) const; + Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const; //! Returns the number of MultiCurve doing the approximation //! of the MultiLine. - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; //! returns the approximation MultiCurve of range . - Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const; + Standard_EXPORT AppParCurves_MultiCurve Value(const int Index = 1) const; - Standard_EXPORT void Parameters(const Standard_Integer Index, - Standard_Real& firstp, - Standard_Real& lastp) const; + Standard_EXPORT void Parameters(const int Index, double& firstp, double& lastp) const; -protected: private: //! is internally used by the algorithms. - Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line, - const Standard_Real Ufirst, - const Standard_Real Ulast, - Standard_Real& TheTol3d, - Standard_Real& TheTol2d); - - AppParCurves_SequenceOfMultiCurve myMultiCurves; - TColStd_SequenceOfReal myfirstparam; - TColStd_SequenceOfReal mylastparam; - AppParCurves_MultiCurve TheMultiCurve; - Standard_Boolean alldone; - Standard_Boolean tolreached; - TColStd_SequenceOfReal Tolers3d; - TColStd_SequenceOfReal Tolers2d; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - Standard_Integer myMaxSegments; - Standard_Boolean myInvOrder; - Standard_Boolean myHangChecking; + Standard_EXPORT bool Compute(const AppCont_Function& Line, + const double Ufirst, + const double Ulast, + double& TheTol3d, + double& TheTol2d); + + NCollection_Sequence myMultiCurves; + NCollection_Sequence myfirstparam; + NCollection_Sequence mylastparam; + AppParCurves_MultiCurve TheMultiCurve; + bool alldone; + bool tolreached; + NCollection_Sequence Tolers3d; + NCollection_Sequence Tolers2d; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + int myMaxSegments; + bool myInvOrder; + bool myHangChecking; }; #endif // _Approx_FitAndDivide2d_HeaderFile diff --git a/opencascade/Approx_HArray1OfAdHSurface.hxx b/opencascade/Approx_HArray1OfAdHSurface.hxx index 6f557ea62..1e7598e92 100644 --- a/opencascade/Approx_HArray1OfAdHSurface.hxx +++ b/opencascade/Approx_HArray1OfAdHSurface.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-01-26 -// Created by: Laurent PAINNOT -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Approx_HArray1OfAdHSurface_HeaderFile -#define Approx_HArray1OfAdHSurface_HeaderFile +//! @file Approx_HArray1OfAdHSurface.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1> directly instead. +#ifndef _Approx_HArray1OfAdHSurface_hxx +#define _Approx_HArray1OfAdHSurface_hxx + +#include #include #include -#include +#include + +Standard_HEADER_DEPRECATED("Approx_HArray1OfAdHSurface.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_HArray1> directly.") -DEFINE_HARRAY1(Approx_HArray1OfAdHSurface, Approx_Array1OfAdHSurface) + Standard_DEPRECATED("Approx_HArray1OfAdHSurface is deprecated, use " + "NCollection_HArray1> directly") +typedef NCollection_HArray1> Approx_HArray1OfAdHSurface; -#endif +#endif // _Approx_HArray1OfAdHSurface_hxx diff --git a/opencascade/Approx_HArray1OfGTrsf2d.hxx b/opencascade/Approx_HArray1OfGTrsf2d.hxx index b05815315..a0ed8d1f2 100644 --- a/opencascade/Approx_HArray1OfGTrsf2d.hxx +++ b/opencascade/Approx_HArray1OfGTrsf2d.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-01-26 -// Created by: Laurent PAINNOT -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Approx_HArray1OfGTrsf2d_HeaderFile -#define Approx_HArray1OfGTrsf2d_HeaderFile +//! @file Approx_HArray1OfGTrsf2d.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _Approx_HArray1OfGTrsf2d_hxx +#define _Approx_HArray1OfGTrsf2d_hxx + +#include #include -#include +#include + +Standard_HEADER_DEPRECATED("Approx_HArray1OfGTrsf2d.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_HArray1 directly.") -DEFINE_HARRAY1(Approx_HArray1OfGTrsf2d, Approx_Array1OfGTrsf2d) + Standard_DEPRECATED( + "Approx_HArray1OfGTrsf2d is deprecated, use NCollection_HArray1 directly") +typedef NCollection_HArray1 Approx_HArray1OfGTrsf2d; -#endif +#endif // _Approx_HArray1OfGTrsf2d_hxx diff --git a/opencascade/Approx_MCurvesToBSpCurve.hxx b/opencascade/Approx_MCurvesToBSpCurve.hxx index 9e6ec1989..905cfddcc 100644 --- a/opencascade/Approx_MCurvesToBSpCurve.hxx +++ b/opencascade/Approx_MCurvesToBSpCurve.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include class AppParCurves_MultiCurve; class Approx_MCurvesToBSpCurve @@ -37,7 +38,7 @@ public: Standard_EXPORT void Perform(); - Standard_EXPORT void Perform(const AppParCurves_SequenceOfMultiCurve& TheSeq); + Standard_EXPORT void Perform(const NCollection_Sequence& TheSeq); //! return the composite MultiCurves as a MultiBSpCurve. Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const; @@ -45,11 +46,10 @@ public: //! return the composite MultiCurves as a MultiBSpCurve. Standard_EXPORT const AppParCurves_MultiBSpCurve& ChangeValue(); -protected: private: - AppParCurves_MultiBSpCurve mySpline; - Standard_Boolean myDone; - AppParCurves_SequenceOfMultiCurve myCurves; + AppParCurves_MultiBSpCurve mySpline; + bool myDone; + NCollection_Sequence myCurves; }; #endif // _Approx_MCurvesToBSpCurve_HeaderFile diff --git a/opencascade/Approx_SameParameter.hxx b/opencascade/Approx_SameParameter.hxx index 5c1550fc3..d15ab5872 100644 --- a/opencascade/Approx_SameParameter.hxx +++ b/opencascade/Approx_SameParameter.hxx @@ -24,7 +24,7 @@ class Geom_Curve; class Geom2d_Curve; class Geom_Surface; -//! Approximation of a PCurve on a surface to make its +//! Approximation of a PCurve on a surface to make its //! parameter be the same that the parameter of a given 3d //! reference curve. class Approx_SameParameter @@ -33,49 +33,49 @@ public: DEFINE_STANDARD_ALLOC //! Warning: the C3D and C2D must have the same parametric domain. - Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D, - const Handle(Geom2d_Curve)& C2D, - const Handle(Geom_Surface)& S, - const Standard_Real Tol); + Standard_EXPORT Approx_SameParameter(const occ::handle& C3D, + const occ::handle& C2D, + const occ::handle& S, + const double Tol); //! Warning: the C3D and C2D must have the same parametric domain. - Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D, - const Handle(Geom2d_Curve)& C2D, - const Handle(Adaptor3d_Surface)& S, - const Standard_Real Tol); + Standard_EXPORT Approx_SameParameter(const occ::handle& C3D, + const occ::handle& C2D, + const occ::handle& S, + const double Tol); //! Warning: the C3D and C2D must have the same parametric domain. - Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D, - const Handle(Adaptor2d_Curve2d)& C2D, - const Handle(Adaptor3d_Surface)& S, - const Standard_Real Tol); + Standard_EXPORT Approx_SameParameter(const occ::handle& C3D, + const occ::handle& C2D, + const occ::handle& S, + const double Tol); //!@Returns .false. if calculations failed, //! .true. if calculations succeed - Standard_Boolean IsDone() const { return myDone; } + bool IsDone() const { return myDone; } //!@Returns tolerance (maximal distance) between 3d curve //! and curve on surface, generated by 2d curve and surface. - Standard_Real TolReached() const { return myTolReached; } + double TolReached() const { return myTolReached; } //! Tells whether the original data had already the same //! parameter up to the tolerance : in that case nothing //! is done. - Standard_Boolean IsSameParameter() const { return mySameParameter; } + bool IsSameParameter() const { return mySameParameter; } //! Returns the 2D curve that has the same parameter as //! the 3D curve once evaluated on the surface up to the //! specified tolerance. - Handle(Geom2d_Curve) Curve2d() const { return myCurve2d; } + occ::handle Curve2d() const { return myCurve2d; } //! Returns the 3D curve that has the same parameter as //! the 3D curve once evaluated on the surface up to the //! specified tolerance. - Handle(Adaptor3d_Curve) Curve3d() const { return myC3d; } + occ::handle Curve3d() const { return myC3d; } //! Returns the 3D curve on surface that has the same parameter as //! the 3D curve up to the specified tolerance. - Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const { return myCurveOnSurface; } + occ::handle CurveOnSurface() const { return myCurveOnSurface; } private: //! Internal data structure to unify access to the most actively used data. @@ -84,27 +84,27 @@ private: struct Approx_SameParameter_Data { Adaptor3d_CurveOnSurface myCOnS; // Curve on surface. - Standard_Integer myNbPnt; // Number of points. - Standard_Real* myPC3d; // Parameters on 3d curve. - Standard_Real* myPC2d; // Parameters on 2d curve. + int myNbPnt; // Number of points. + double* myPC3d; // Parameters on 3d curve. + double* myPC2d; // Parameters on 2d curve. // Second data arrays. Used in loop over poles. - Standard_Real* myNewPC3d; // Parameters on 3d curve. - Standard_Real* myNewPC2d; // Parameters on 2d curve. + double* myNewPC3d; // Parameters on 3d curve. + double* myNewPC2d; // Parameters on 2d curve. // Parameters ranges. - Standard_Real myC3dPF; // Curve 3d Parameter First. - Standard_Real myC3dPL; // Curve 3d Parameter Last. - Standard_Real myC2dPF; // Curve 2d Parameter First. - Standard_Real myC2dPL; // Curve 2d Parameter Last. + double myC3dPF; // Curve 3d Parameter First. + double myC3dPL; // Curve 3d Parameter Last. + double myC2dPF; // Curve 2d Parameter First. + double myC2dPL; // Curve 2d Parameter Last. - Standard_Real myTol; // Working tolerance. + double myTol; // Working tolerance. // Swap data arrays and update number of points. - void Swap(const Standard_Integer theNewNbPoints) + void Swap(const int theNewNbPoints) { myNbPnt = theNewNbPoints; - Standard_Real* temp; + double* temp; // 3-D temp = myPC3d; @@ -118,59 +118,58 @@ private: } }; - Approx_SameParameter(const Approx_SameParameter&); - Approx_SameParameter& operator=(const Approx_SameParameter&); + Approx_SameParameter(const Approx_SameParameter&) = delete; + Approx_SameParameter& operator=(const Approx_SameParameter&) = delete; //! Computes the pcurve (internal use only). - Standard_EXPORT void Build(const Standard_Real Tol); + Standard_EXPORT void Build(const double Tol); //! Computes initial point distribution. - Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data& theData) const; + bool BuildInitialDistribution(Approx_SameParameter_Data& theData) const; //! Increases initial number of samples in case of the C0 continuity. //! Return new number of points and corresponding data arrays. //@return true if new number of samples is good and false otherwise. - Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data& theData) const; + bool IncreaseInitialNbSamples(Approx_SameParameter_Data& theData) const; //! Computes tangents on boundary points. //@return true if tangents are not null and false otherwise. - Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS, - Standard_Real& theFirstTangent, - Standard_Real& theLastTangent) const; + bool ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS, + double& theFirstTangent, + double& theLastTangent) const; //! Method to check same parameter state //! and build dependency between 2d and 3d curves. //@return true if 2d and 3d curves have same parameter state and false otherwise. - Standard_Boolean CheckSameParameter(Approx_SameParameter_Data& theData, - Standard_Real& theSqDist) const; + bool CheckSameParameter(Approx_SameParameter_Data& theData, double& theSqDist) const; //! Computes interpolated values. //!@Returns .false. if computations failed; - Standard_Boolean Interpolate(const Approx_SameParameter_Data& theData, - const Standard_Real aTangFirst, - const Standard_Real aTangLast, - TColStd_Array1OfReal& thePoles, - TColStd_Array1OfReal& theFlatKnots) const; + bool Interpolate(const Approx_SameParameter_Data& theData, + const double aTangFirst, + const double aTangLast, + NCollection_Array1& thePoles, + NCollection_Array1& theFlatKnots) const; //! Increases number of poles in poles loop. //@return true if poles is changed and false otherwise. - Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal& thePoles, - const TColStd_Array1OfReal& theFlatKnots, - Approx_SameParameter_Data& theData, - Standard_Real& theBestSqTol) const; - - static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape". - static const Standard_Integer myMaxArraySize = 1000; - const Standard_Real myDeltaMin; // Initialization is allowed only for integral types. - - Standard_Boolean mySameParameter; - Standard_Boolean myDone; - Standard_Real myTolReached; - Handle(Geom2d_Curve) myCurve2d; - Handle(Adaptor2d_Curve2d) myHCurve2d; - Handle(Adaptor3d_Curve) myC3d; - Handle(Adaptor3d_Surface) mySurf; - Handle(Adaptor3d_CurveOnSurface) myCurveOnSurface; + bool IncreaseNbPoles(const NCollection_Array1& thePoles, + const NCollection_Array1& theFlatKnots, + Approx_SameParameter_Data& theData, + double& theBestSqTol) const; + + static const int myNbSamples = 22; // To be consistent with "checkshape". + static const int myMaxArraySize = 1000; + const double myDeltaMin; // Initialization is allowed only for integral types. + + bool mySameParameter; + bool myDone; + double myTolReached; + occ::handle myCurve2d; + occ::handle myHCurve2d; + occ::handle myC3d; + occ::handle mySurf; + occ::handle myCurveOnSurface; }; #endif // _Approx_SameParameter_HeaderFile diff --git a/opencascade/Approx_SequenceOfHArray1OfReal.hxx b/opencascade/Approx_SequenceOfHArray1OfReal.hxx index bf3436e9d..af072468f 100644 --- a/opencascade/Approx_SequenceOfHArray1OfReal.hxx +++ b/opencascade/Approx_SequenceOfHArray1OfReal.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-01-26 -// Created by: Laurent PAINNOT -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,26 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Approx_SequenceOfHArray1OfReal_HeaderFile -#define Approx_SequenceOfHArray1OfReal_HeaderFile +//! @file Approx_SequenceOfHArray1OfReal.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence> directly +//! instead. +#ifndef _Approx_SequenceOfHArray1OfReal_hxx +#define _Approx_SequenceOfHArray1OfReal_hxx + +#include #include #include -typedef NCollection_Sequence Approx_SequenceOfHArray1OfReal; +Standard_HEADER_DEPRECATED( + "Approx_SequenceOfHArray1OfReal.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence> directly.") + + Standard_DEPRECATED("Approx_SequenceOfHArray1OfReal is deprecated, use " + "NCollection_Sequence> directly") +typedef NCollection_Sequence> + Approx_SequenceOfHArray1OfReal; -#endif +#endif // _Approx_SequenceOfHArray1OfReal_hxx diff --git a/opencascade/Approx_SweepApproximation.hxx b/opencascade/Approx_SweepApproximation.hxx index 04efa6036..65d41be79 100644 --- a/opencascade/Approx_SweepApproximation.hxx +++ b/opencascade/Approx_SweepApproximation.hxx @@ -22,43 +22,37 @@ #include #include -#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include +#include class Approx_SweepFunction; class AdvApprox_Cutting; -//! Approximation of an Surface S(u,v) -//! (and eventually associate 2d Curves) defined +//! Approximation of an Surface S(u,v) +//! (and eventually associate 2d Curves) defined //! by section's law. //! //! This surface is defined by a function F(u, v) //! where Ft(u) = F(u, t) is a bspline curve. -//! To use this algorithme, you have to implement Ft(u) -//! as a derivative class of Approx_SweepFunction. +//! To use this algorithm, you have to implement Ft(u) +//! as a derivative class of Approx_SweepFunction. //! This algorithm can be used by blending, sweeping... class Approx_SweepApproximation { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func); + Standard_EXPORT Approx_SweepApproximation(const occ::handle& Func); //! Perform the Approximation //! [First, Last] : Approx_SweepApproximation.cdl @@ -75,164 +69,161 @@ public: //! Segmax : The maximum number of span in v required on //! the surface //! Warning : The continuity ci can be obtained only if Ft is Ci - Standard_EXPORT void Perform(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol3d, - const Standard_Real BoundTol, - const Standard_Real Tol2d, - const Standard_Real TolAngular, - const GeomAbs_Shape Continuity = GeomAbs_C0, - const Standard_Integer Degmax = 11, - const Standard_Integer Segmax = 50); + Standard_EXPORT void Perform(const double First, + const double Last, + const double Tol3d, + const double BoundTol, + const double Tol2d, + const double TolAngular, + const GeomAbs_Shape Continuity = GeomAbs_C0, + const int Degmax = 11, + const int Segmax = 50); //! The EvaluatorFunction from AdvApprox; - Standard_EXPORT Standard_Integer Eval(const Standard_Real Parameter, - const Standard_Integer DerivativeRequest, - const Standard_Real First, - const Standard_Real Last, - Standard_Real& Result); + Standard_EXPORT int Eval(const double Parameter, + const int DerivativeRequest, + const double First, + const double Last, + double& Result); //! returns if we have an result - Standard_Boolean IsDone() const; + bool IsDone() const; - Standard_EXPORT void SurfShape(Standard_Integer& UDegree, - Standard_Integer& VDegree, - Standard_Integer& NbUPoles, - Standard_Integer& NbVPoles, - Standard_Integer& NbUKnots, - Standard_Integer& NbVKnots) const; + Standard_EXPORT void SurfShape(int& UDegree, + int& VDegree, + int& NbUPoles, + int& NbVPoles, + int& NbUKnots, + int& NbVKnots) const; - Standard_EXPORT void Surface(TColgp_Array2OfPnt& TPoles, - TColStd_Array2OfReal& TWeights, - TColStd_Array1OfReal& TUKnots, - TColStd_Array1OfReal& TVKnots, - TColStd_Array1OfInteger& TUMults, - TColStd_Array1OfInteger& TVMults) const; + Standard_EXPORT void Surface(NCollection_Array2& TPoles, + NCollection_Array2& TWeights, + NCollection_Array1& TUKnots, + NCollection_Array1& TVKnots, + NCollection_Array1& TUMults, + NCollection_Array1& TVMults) const; - Standard_Integer UDegree() const; + int UDegree() const; - Standard_Integer VDegree() const; + int VDegree() const; - const TColgp_Array2OfPnt& SurfPoles() const; + const NCollection_Array2& SurfPoles() const; - const TColStd_Array2OfReal& SurfWeights() const; + const NCollection_Array2& SurfWeights() const; - const TColStd_Array1OfReal& SurfUKnots() const; + const NCollection_Array1& SurfUKnots() const; - const TColStd_Array1OfReal& SurfVKnots() const; + const NCollection_Array1& SurfVKnots() const; - const TColStd_Array1OfInteger& SurfUMults() const; + const NCollection_Array1& SurfUMults() const; - const TColStd_Array1OfInteger& SurfVMults() const; + const NCollection_Array1& SurfVMults() const; //! returns the maximum error in the surface approximation. - Standard_EXPORT Standard_Real MaxErrorOnSurf() const; + Standard_EXPORT double MaxErrorOnSurf() const; //! returns the average error in the surface approximation. - Standard_EXPORT Standard_Real AverageErrorOnSurf() const; + Standard_EXPORT double AverageErrorOnSurf() const; - Standard_Integer NbCurves2d() const; + int NbCurves2d() const; - Standard_EXPORT void Curves2dShape(Standard_Integer& Degree, - Standard_Integer& NbPoles, - Standard_Integer& NbKnots) const; + Standard_EXPORT void Curves2dShape(int& Degree, int& NbPoles, int& NbKnots) const; - Standard_EXPORT void Curve2d(const Standard_Integer Index, - TColgp_Array1OfPnt2d& TPoles, - TColStd_Array1OfReal& TKnots, - TColStd_Array1OfInteger& TMults) const; + Standard_EXPORT void Curve2d(const int Index, + NCollection_Array1& TPoles, + NCollection_Array1& TKnots, + NCollection_Array1& TMults) const; - Standard_Integer Curves2dDegree() const; + int Curves2dDegree() const; - const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const; + const NCollection_Array1& Curve2dPoles(const int Index) const; - const TColStd_Array1OfReal& Curves2dKnots() const; + const NCollection_Array1& Curves2dKnots() const; - const TColStd_Array1OfInteger& Curves2dMults() const; + const NCollection_Array1& Curves2dMults() const; //! returns the maximum error of the //! 2d curve approximation. - Standard_EXPORT Standard_Real Max2dError(const Standard_Integer Index) const; + Standard_EXPORT double Max2dError(const int Index) const; //! returns the average error of the //! 2d curve approximation. - Standard_EXPORT Standard_Real Average2dError(const Standard_Integer Index) const; + Standard_EXPORT double Average2dError(const int Index) const; - //! returns the maximum 3d error of the + //! returns the maximum 3d error of the //! 2d curve approximation on the Surface. - Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const; + Standard_EXPORT double TolCurveOnSurf(const int Index) const; //! display information on approximation. Standard_EXPORT void Dump(Standard_OStream& o) const; -protected: private: - Standard_EXPORT void Approximation(const Handle(TColStd_HArray1OfReal)& OneDTol, - const Handle(TColStd_HArray1OfReal)& TwoDTol, - const Handle(TColStd_HArray1OfReal)& ThreeDTol, - const Standard_Real BounTol, - const Standard_Real First, - const Standard_Real Last, - const GeomAbs_Shape Continuity, - const Standard_Integer Degmax, - const Standard_Integer Segmax, - const AdvApprox_EvaluatorFunction& TheApproxFunction, - const AdvApprox_Cutting& TheCuttingTool); - - Standard_EXPORT Standard_Boolean D0(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - Standard_Real& Result); - - Standard_EXPORT Standard_Boolean D1(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - Standard_Real& Result); - - Standard_EXPORT Standard_Boolean D2(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - Standard_Real& Result); - - Handle(Approx_SweepFunction) myFunc; - Standard_Boolean done; - Standard_Integer Num1DSS; - Standard_Integer Num2DSS; - Standard_Integer Num3DSS; - Standard_Integer udeg; - Standard_Integer vdeg; - Standard_Integer deg2d; - Handle(TColgp_HArray2OfPnt) tabPoles; - Handle(TColStd_HArray2OfReal) tabWeights; - Handle(TColStd_HArray1OfReal) tabUKnots; - Handle(TColStd_HArray1OfReal) tabVKnots; - Handle(TColStd_HArray1OfReal) tab2dKnots; - Handle(TColStd_HArray1OfInteger) tabUMults; - Handle(TColStd_HArray1OfInteger) tabVMults; - Handle(TColStd_HArray1OfInteger) tab2dMults; - TColgp_SequenceOfArray1OfPnt2d seqPoles2d; - Handle(TColStd_HArray1OfReal) MError1d; - Handle(TColStd_HArray1OfReal) tab2dError; - Handle(TColStd_HArray1OfReal) MError3d; - Handle(TColStd_HArray1OfReal) AError1d; - Handle(TColStd_HArray1OfReal) Ave2dError; - Handle(TColStd_HArray1OfReal) AError3d; - Handle(Approx_HArray1OfGTrsf2d) AAffin; - Handle(TColStd_HArray1OfReal) COnSurfErr; - gp_Vec Translation; - Handle(TColgp_HArray1OfPnt) myPoles; - Handle(TColgp_HArray1OfPnt2d) myPoles2d; - Handle(TColStd_HArray1OfReal) myWeigths; - Handle(TColgp_HArray1OfVec) myDPoles; - Handle(TColgp_HArray1OfVec) myD2Poles; - Handle(TColgp_HArray1OfVec2d) myDPoles2d; - Handle(TColgp_HArray1OfVec2d) myD2Poles2d; - Handle(TColStd_HArray1OfReal) myDWeigths; - Handle(TColStd_HArray1OfReal) myD2Weigths; - Standard_Integer myOrder; - Standard_Real myParam; - Standard_Real first; - Standard_Real last; + Standard_EXPORT void Approximation(const occ::handle>& OneDTol, + const occ::handle>& TwoDTol, + const occ::handle>& ThreeDTol, + const double BounTol, + const double First, + const double Last, + const GeomAbs_Shape Continuity, + const int Degmax, + const int Segmax, + const AdvApprox_EvaluatorFunction& TheApproxFunction, + const AdvApprox_Cutting& TheCuttingTool); + + Standard_EXPORT bool D0(const double Param, + const double First, + const double Last, + double& Result); + + Standard_EXPORT bool D1(const double Param, + const double First, + const double Last, + double& Result); + + Standard_EXPORT bool D2(const double Param, + const double First, + const double Last, + double& Result); + + occ::handle myFunc; + bool done; + int Num1DSS; + int Num2DSS; + int Num3DSS; + int udeg; + int vdeg; + int deg2d; + occ::handle> tabPoles; + occ::handle> tabWeights; + occ::handle> tabUKnots; + occ::handle> tabVKnots; + occ::handle> tab2dKnots; + occ::handle> tabUMults; + occ::handle> tabVMults; + occ::handle> tab2dMults; + NCollection_Sequence>> seqPoles2d; + occ::handle> MError1d; + occ::handle> tab2dError; + occ::handle> MError3d; + occ::handle> AError1d; + occ::handle> Ave2dError; + occ::handle> AError3d; + occ::handle> AAffin; + occ::handle> COnSurfErr; + gp_Vec Translation; + occ::handle> myPoles; + occ::handle> myPoles2d; + occ::handle> myWeigths; + occ::handle> myDPoles; + occ::handle> myD2Poles; + occ::handle> myDPoles2d; + occ::handle> myD2Poles2d; + occ::handle> myDWeigths; + occ::handle> myD2Weigths; + int myOrder; + double myParam; + double first; + double last; }; #include diff --git a/opencascade/Approx_SweepApproximation.lxx b/opencascade/Approx_SweepApproximation.lxx index ed1d30907..b018be961 100644 --- a/opencascade/Approx_SweepApproximation.lxx +++ b/opencascade/Approx_SweepApproximation.lxx @@ -15,18 +15,20 @@ // commercial license or contractual agreement. #include -#include -#include -#include -#include -#include - -inline Standard_Boolean Approx_SweepApproximation::IsDone() const +#include +#include +#include +#include +#include +#include +#include + +inline bool Approx_SweepApproximation::IsDone() const { return done; } -inline Standard_Integer Approx_SweepApproximation::UDegree() const +inline int Approx_SweepApproximation::UDegree() const { if (!done) { @@ -35,7 +37,7 @@ inline Standard_Integer Approx_SweepApproximation::UDegree() const return udeg; } -inline Standard_Integer Approx_SweepApproximation::VDegree() const +inline int Approx_SweepApproximation::VDegree() const { if (!done) { @@ -44,7 +46,7 @@ inline Standard_Integer Approx_SweepApproximation::VDegree() const return vdeg; } -inline const TColgp_Array2OfPnt& Approx_SweepApproximation::SurfPoles() const +inline const NCollection_Array2& Approx_SweepApproximation::SurfPoles() const { if (!done) { @@ -53,7 +55,7 @@ inline const TColgp_Array2OfPnt& Approx_SweepApproximation::SurfPoles() const return tabPoles->Array2(); } -inline const TColStd_Array2OfReal& Approx_SweepApproximation::SurfWeights() const +inline const NCollection_Array2& Approx_SweepApproximation::SurfWeights() const { if (!done) { @@ -62,7 +64,7 @@ inline const TColStd_Array2OfReal& Approx_SweepApproximation::SurfWeights() cons return tabWeights->Array2(); } -inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfUKnots() const +inline const NCollection_Array1& Approx_SweepApproximation::SurfUKnots() const { if (!done) { @@ -71,7 +73,7 @@ inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfUKnots() const return tabUKnots->Array1(); } -inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfVKnots() const +inline const NCollection_Array1& Approx_SweepApproximation::SurfVKnots() const { if (!done) { @@ -80,7 +82,7 @@ inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfVKnots() const return tabVKnots->Array1(); } -inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfUMults() const +inline const NCollection_Array1& Approx_SweepApproximation::SurfUMults() const { if (!done) { @@ -89,7 +91,7 @@ inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfUMults() co return tabUMults->Array1(); } -inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfVMults() const +inline const NCollection_Array1& Approx_SweepApproximation::SurfVMults() const { if (!done) { @@ -98,7 +100,7 @@ inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfVMults() co return tabVMults->Array1(); } -inline Standard_Integer Approx_SweepApproximation::NbCurves2d() const +inline int Approx_SweepApproximation::NbCurves2d() const { if (!done) { @@ -107,7 +109,7 @@ inline Standard_Integer Approx_SweepApproximation::NbCurves2d() const return Num2DSS; } -inline Standard_Integer Approx_SweepApproximation::Curves2dDegree() const +inline int Approx_SweepApproximation::Curves2dDegree() const { if (!done) { @@ -120,8 +122,8 @@ inline Standard_Integer Approx_SweepApproximation::Curves2dDegree() const return deg2d; } -inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles( - const Standard_Integer Index) const +inline const NCollection_Array1& Approx_SweepApproximation::Curve2dPoles( + const int Index) const { if (!done) { @@ -134,7 +136,7 @@ inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles( return seqPoles2d(Index)->Array1(); } -inline const TColStd_Array1OfReal& Approx_SweepApproximation::Curves2dKnots() const +inline const NCollection_Array1& Approx_SweepApproximation::Curves2dKnots() const { if (!done) { @@ -147,7 +149,7 @@ inline const TColStd_Array1OfReal& Approx_SweepApproximation::Curves2dKnots() co return tab2dKnots->Array1(); } -inline const TColStd_Array1OfInteger& Approx_SweepApproximation::Curves2dMults() const +inline const NCollection_Array1& Approx_SweepApproximation::Curves2dMults() const { if (!done) { @@ -161,7 +163,7 @@ inline const TColStd_Array1OfInteger& Approx_SweepApproximation::Curves2dMults() } /* -inline void Approx_SweepApproximation::TolReached(Standard_Real& Tol3d,Standard_Real& Tol2d) const +inline void Approx_SweepApproximation::TolReached(double& Tol3d,double& Tol2d) const { }*/ diff --git a/opencascade/Approx_SweepFunction.hxx b/opencascade/Approx_SweepFunction.hxx index 2f6c4599d..25ca2e8b5 100644 --- a/opencascade/Approx_SweepFunction.hxx +++ b/opencascade/Approx_SweepFunction.hxx @@ -23,17 +23,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include class gp_Pnt; -class Approx_SweepFunction; -DEFINE_STANDARD_HANDLE(Approx_SweepFunction, Standard_Transient) - //! defined the function used by SweepApproximation to //! perform sweeping application. class Approx_SweepFunction : public Standard_Transient @@ -41,98 +37,96 @@ class Approx_SweepFunction : public Standard_Transient public: //! compute the section for v = param - Standard_EXPORT virtual Standard_Boolean D0(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) = 0; - - //! compute the first derivative in v direction of the - //! section for v = param + Standard_EXPORT virtual bool D0(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) = 0; + + //! compute the first derivative in v direction of the + //! section for v = param //! Warning : It used only for C1 or C2 approximation - Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths); - - //! compute the second derivative in v direction of the - //! section for v = param + Standard_EXPORT virtual bool D1(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths); + + //! compute the second derivative in v direction of the + //! section for v = param //! Warning : It used only for C2 approximation - Standard_EXPORT virtual Standard_Boolean D2(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths); - - //! get the number of 2d curves to approximate. - Standard_EXPORT virtual Standard_Integer Nb2dCurves() const = 0; - - //! get the format of an section - Standard_EXPORT virtual void SectionShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree) const = 0; + Standard_EXPORT virtual bool D2(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths); + + //! get the number of 2d curves to approximate. + Standard_EXPORT virtual int Nb2dCurves() const = 0; + + //! get the format of an section + Standard_EXPORT virtual void SectionShape(int& NbPoles, int& NbKnots, int& Degree) const = 0; //! get the Knots of the section - Standard_EXPORT virtual void Knots(TColStd_Array1OfReal& TKnots) const = 0; + Standard_EXPORT virtual void Knots(NCollection_Array1& TKnots) const = 0; //! get the Multplicities of the section - Standard_EXPORT virtual void Mults(TColStd_Array1OfInteger& TMults) const = 0; + Standard_EXPORT virtual void Mults(NCollection_Array1& TMults) const = 0; //! Returns if the sections are rational or not - Standard_EXPORT virtual Standard_Boolean IsRational() const = 0; + Standard_EXPORT virtual bool IsRational() const = 0; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . //! May be one if Continuity(me) >= - Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const = 0; + Standard_EXPORT virtual int NbIntervals(const GeomAbs_Shape S) const = 0; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0; + Standard_EXPORT virtual void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const = 0; //! Sets the bounds of the parametric interval on - //! the fonction + //! the function //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT virtual void SetInterval(const Standard_Real First, const Standard_Real Last) = 0; + Standard_EXPORT virtual void SetInterval(const double First, const double Last) = 0; - //! Returns the resolutions in the sub-space 2d - //! This information is usfull to find an good tolerance in + //! Returns the resolutions in the sub-space 2d + //! This information is useful to find a good tolerance in //! 2d approximation. - Standard_EXPORT virtual void Resolution(const Standard_Integer Index, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const; + Standard_EXPORT virtual void Resolution(const int Index, + const double Tol, + double& TolU, + double& TolV) const; //! Returns the tolerance to reach in approximation //! to satisfy. //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary (in radian) //! SurfTol error inside the surface. - Standard_EXPORT virtual void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - TColStd_Array1OfReal& Tol3d) const = 0; + Standard_EXPORT virtual void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + NCollection_Array1& Tol3d) const = 0; //! Is useful, if (me) have to run numerical algorithm to perform D0, D1 or D2 - Standard_EXPORT virtual void SetTolerance(const Standard_Real Tol3d, - const Standard_Real Tol2d) = 0; + Standard_EXPORT virtual void SetTolerance(const double Tol3d, const double Tol2d) = 0; //! Get the barycentre of Surface. //! An very poor estimation is sufficient. @@ -141,19 +135,16 @@ public: Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const; //! Returns the length of the greater section. - //! Thisinformation is useful to G1's control. + //! This information is useful to G1's control. //! Warning: With an little value, approximation can be slower. - Standard_EXPORT virtual Standard_Real MaximalSection() const; + Standard_EXPORT virtual double MaximalSection() const; - //! Compute the minimal value of weight for each poles in all sections. + //! Compute the minimal value of weight for each poles in all sections. //! This information is useful to control error in rational approximation. //! Warning: Used only if IsRational - Standard_EXPORT virtual void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const; + Standard_EXPORT virtual void GetMinimalWeight(NCollection_Array1& Weigths) const; DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient) - -protected: -private: }; #endif // _Approx_SweepFunction_HeaderFile diff --git a/opencascade/Aspect_AspectFillAreaDefinitionError.hxx b/opencascade/Aspect_AspectFillAreaDefinitionError.hxx index 0656968d4..1675c6ca3 100644 --- a/opencascade/Aspect_AspectFillAreaDefinitionError.hxx +++ b/opencascade/Aspect_AspectFillAreaDefinitionError.hxx @@ -16,13 +16,9 @@ #ifndef _Aspect_AspectFillAreaDefinitionError_HeaderFile #define _Aspect_AspectFillAreaDefinitionError_HeaderFile -#include #include #include -class Aspect_AspectFillAreaDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_AspectFillAreaDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_AspectFillAreaDefinitionError #define Aspect_AspectFillAreaDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_AspectLineDefinitionError.hxx b/opencascade/Aspect_AspectLineDefinitionError.hxx index a9a2dfa19..0f8dbba9c 100644 --- a/opencascade/Aspect_AspectLineDefinitionError.hxx +++ b/opencascade/Aspect_AspectLineDefinitionError.hxx @@ -16,13 +16,9 @@ #ifndef _Aspect_AspectLineDefinitionError_HeaderFile #define _Aspect_AspectLineDefinitionError_HeaderFile -#include #include #include -class Aspect_AspectLineDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_AspectLineDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_AspectLineDefinitionError #define Aspect_AspectLineDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_AspectMarkerDefinitionError.hxx b/opencascade/Aspect_AspectMarkerDefinitionError.hxx index bc6d391be..67e3c4e73 100644 --- a/opencascade/Aspect_AspectMarkerDefinitionError.hxx +++ b/opencascade/Aspect_AspectMarkerDefinitionError.hxx @@ -16,13 +16,9 @@ #ifndef _Aspect_AspectMarkerDefinitionError_HeaderFile #define _Aspect_AspectMarkerDefinitionError_HeaderFile -#include #include #include -class Aspect_AspectMarkerDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_AspectMarkerDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_AspectMarkerDefinitionError #define Aspect_AspectMarkerDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_Background.hxx b/opencascade/Aspect_Background.hxx index 8726afd03..5a0a4ed50 100644 --- a/opencascade/Aspect_Background.hxx +++ b/opencascade/Aspect_Background.hxx @@ -44,9 +44,8 @@ public: Standard_EXPORT Quantity_Color Color() const; //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; -protected: private: Quantity_Color MyColor; }; diff --git a/opencascade/Aspect_CircularGrid.hxx b/opencascade/Aspect_CircularGrid.hxx index 2dc2b39a1..ed9db0221 100644 --- a/opencascade/Aspect_CircularGrid.hxx +++ b/opencascade/Aspect_CircularGrid.hxx @@ -26,50 +26,81 @@ class Aspect_CircularGrid : public Aspect_Grid public: //! creates a new grid. By default this grid is not //! active. - Standard_EXPORT Aspect_CircularGrid(const Standard_Real aRadiusStep, - const Standard_Integer aDivisionNumber, - const Standard_Real XOrigin = 0, - const Standard_Real anYOrigin = 0, - const Standard_Real aRotationAngle = 0); + Standard_EXPORT Aspect_CircularGrid(const double aRadiusStep, + const int aDivisionNumber, + const double XOrigin = 0, + const double anYOrigin = 0, + const double aRotationAngle = 0); //! defines the x step of the grid. - Standard_EXPORT void SetRadiusStep(const Standard_Real aStep); + Standard_EXPORT void SetRadiusStep(const double aStep); //! defines the step of the grid. - Standard_EXPORT void SetDivisionNumber(const Standard_Integer aNumber); + Standard_EXPORT void SetDivisionNumber(const int aNumber); - Standard_EXPORT void SetGridValues(const Standard_Real XOrigin, - const Standard_Real YOrigin, - const Standard_Real RadiusStep, - const Standard_Integer DivisionNumber, - const Standard_Real RotationAngle); + Standard_EXPORT void SetGridValues(const double XOrigin, + const double YOrigin, + const double RadiusStep, + const int DivisionNumber, + const double RotationAngle); //! returns the point of the grid the closest to the point X,Y - Standard_EXPORT virtual void Compute(const Standard_Real X, - const Standard_Real Y, - Standard_Real& gridX, - Standard_Real& gridY) const Standard_OVERRIDE; + Standard_EXPORT void Compute(const double X, + const double Y, + double& gridX, + double& gridY) const override; //! returns the x step of the grid. - Standard_EXPORT Standard_Real RadiusStep() const; + Standard_EXPORT double RadiusStep() const; //! returns the x step of the grid. - Standard_EXPORT Standard_Integer DivisionNumber() const; + Standard_EXPORT int DivisionNumber() const; - Standard_EXPORT virtual void Init() Standard_OVERRIDE; + //! Set the circular grid radius (plane-local units). 0.0 (default) means + //! unbounded - the shader draws the grid to the horizon. + Standard_EXPORT void SetRadius(const double theRadius); + + //! Return the bounded radius. 0.0 means unbounded. + double Radius() const { return myRadius; } + + //! Set signed offset along the plane normal for display only; snap math + //! stays on the plane. Use a small negative value to avoid z-fighting with + //! coplanar geometry. + Standard_EXPORT void SetZOffset(const double theOffset); + + //! Return the display-time Z-offset along the plane normal. + double ZOffset() const { return myZOffset; } + + //! Restrict the grid to an angular wedge, walking counter-clockwise from + //! @p theStart to @p theEnd (radians, measured from the rotated plane X + //! axis). Setting both values equal (e.g. both 0.0) returns to full-circle + //! rendering - the sentinel used for unbounded. + Standard_EXPORT void SetArcRange(const double theStart, const double theEnd); + + //! Return the arc start angle (radians). Meaningful only when IsArc() is true. + double AngleStart() const { return myAngleStart; } + + //! Return the arc end angle (radians). Meaningful only when IsArc() is true. + double AngleEnd() const { return myAngleEnd; } + + //! Return TRUE when the grid is restricted to an angular wedge. + bool IsArc() const { return myAngleStart != myAngleEnd; } + + Standard_EXPORT void Init() override; //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; private: - Standard_Real myRadiusStep; - Standard_Integer myDivisionNumber; - Standard_Real myAlpha; - Standard_Real myA1; - Standard_Real myB1; + double myRadiusStep; + int myDivisionNumber; + double myAlpha; + double myA1; + double myB1; + double myRadius; + double myZOffset; + double myAngleStart; + double myAngleEnd; }; -DEFINE_STANDARD_HANDLE(Aspect_CircularGrid, Aspect_Grid) - #endif // _Aspect_CircularGrid_HeaderFile diff --git a/opencascade/Aspect_DisplayConnection.hxx b/opencascade/Aspect_DisplayConnection.hxx index 462978629..caedc8a24 100644 --- a/opencascade/Aspect_DisplayConnection.hxx +++ b/opencascade/Aspect_DisplayConnection.hxx @@ -37,13 +37,16 @@ public: Standard_EXPORT Aspect_DisplayConnection(); //! Destructor. Close opened connection. - Standard_EXPORT virtual ~Aspect_DisplayConnection(); + Standard_EXPORT ~Aspect_DisplayConnection() override; //! Constructor. Creates connection with display specified in theDisplayName. //! Display name should be in format "hostname:number" or "hostname:number.screen_number", where: - //! hostname - Specifies the name of the host machine on which the display is physically - //! attached. number - Specifies the number of the display server on that host machine. - //! screen_number - Specifies the screen to be used on that server. Optional variable. + //! hostname + //! - Specifies the name of the host machine on which the display is physically attached. + //! number + //! - Specifies the number of the display server on that host machine. + //! screen_number + //! - Specifies the screen to be used on that server. Optional variable. Standard_EXPORT Aspect_DisplayConnection(const TCollection_AsciiString& theDisplayName); //! Constructor wrapping existing Display instance. @@ -55,7 +58,7 @@ public: Aspect_XDisplay* GetDisplayAspect() { return myDisplay; } //! @return TRUE if X Display has been allocated by this class - Standard_Boolean IsOwnDisplay() const { return myIsOwnDisplay; } + bool IsOwnDisplay() const { return myIsOwnDisplay; } //! @return identifier(atom) for custom named property associated with windows that use current //! connection to X server. @@ -119,14 +122,12 @@ private: Aspect_FBConfig myDefFBConfig; NCollection_DataMap myAtoms; TCollection_AsciiString myDisplayName; - Standard_Boolean myIsOwnDisplay; + bool myIsOwnDisplay; private: //! To protect the connection from closing copying allowed only through the handles. - Aspect_DisplayConnection(const Aspect_DisplayConnection&); - Aspect_DisplayConnection& operator=(const Aspect_DisplayConnection&); + Aspect_DisplayConnection(const Aspect_DisplayConnection&) = delete; + Aspect_DisplayConnection& operator=(const Aspect_DisplayConnection&) = delete; }; -DEFINE_STANDARD_HANDLE(Aspect_DisplayConnection, Standard_Transient) - #endif // _Aspect_DisplayConnection_H__ diff --git a/opencascade/Aspect_DisplayConnectionDefinitionError.hxx b/opencascade/Aspect_DisplayConnectionDefinitionError.hxx index 27b230004..050921451 100644 --- a/opencascade/Aspect_DisplayConnectionDefinitionError.hxx +++ b/opencascade/Aspect_DisplayConnectionDefinitionError.hxx @@ -16,14 +16,10 @@ #ifndef _Aspect_DisplayConnectionDefinitionError_HeaderFile #define _Aspect_DisplayConnectionDefinitionError_HeaderFile -#include #include #include #include -class Aspect_DisplayConnectionDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_DisplayConnectionDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_DisplayConnectionDefinitionError #define Aspect_DisplayConnectionDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_GenId.hxx b/opencascade/Aspect_GenId.hxx index 4ebba4dca..123084584 100644 --- a/opencascade/Aspect_GenId.hxx +++ b/opencascade/Aspect_GenId.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include //! This class permits the creation and control of integer identifiers. @@ -36,44 +37,44 @@ public: //! Creates an available set of identifiers with specified range. //! Raises IdentDefinitionError if theUpper is less than theLow. - Standard_EXPORT Aspect_GenId(const Standard_Integer theLow, const Standard_Integer theUpper); + Standard_EXPORT Aspect_GenId(const int theLow, const int theUpper); //! Free all identifiers - make the whole range available again. Standard_EXPORT void Free(); //! Free specified identifier. Warning - method has no protection against double-freeing! - Standard_EXPORT void Free(const Standard_Integer theId); + Standard_EXPORT void Free(const int theId); //! Returns true if there are available identifiers in range. - Standard_Boolean HasFree() const { return myFreeCount > 0 || myFreeIds.Extent() > 0; } + bool HasFree() const { return myFreeCount > 0 || myFreeIds.Extent() > 0; } //! Returns the number of available identifiers. - Standard_Integer Available() const { return myFreeCount + myFreeIds.Extent(); } + int Available() const { return myFreeCount + myFreeIds.Extent(); } //! Returns the lower identifier in range. - Standard_Integer Lower() const { return myLowerBound; } + int Lower() const { return myLowerBound; } //! Returns the next available identifier. //! Warning: Raises IdentDefinitionError if all identifiers are busy. - Standard_EXPORT Standard_Integer Next(); + Standard_EXPORT int Next(); //! Generates the next available identifier. //! @param[out] theId generated identifier //! @return FALSE if all identifiers are busy. - Standard_EXPORT Standard_Boolean Next(Standard_Integer& theId); + Standard_EXPORT bool Next(int& theId); //! Returns the upper identifier in range. - Standard_Integer Upper() const { return myUpperBound; } + int Upper() const { return myUpperBound; } //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; private: - Standard_Integer myFreeCount; - Standard_Integer myLength; - Standard_Integer myLowerBound; - Standard_Integer myUpperBound; - TColStd_ListOfInteger myFreeIds; + int myFreeCount; + int myLength; + int myLowerBound; + int myUpperBound; + NCollection_List myFreeIds; }; #endif // _Aspect_GenId_HeaderFile diff --git a/opencascade/Aspect_GradientBackground.hxx b/opencascade/Aspect_GradientBackground.hxx index 2e2251f90..36ab6c80f 100644 --- a/opencascade/Aspect_GradientBackground.hxx +++ b/opencascade/Aspect_GradientBackground.hxx @@ -49,7 +49,7 @@ public: Standard_EXPORT Aspect_GradientFillMethod BgGradientFillMethod() const; //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; private: Quantity_Color MyColor2; diff --git a/opencascade/Aspect_GraphicDeviceDefinitionError.hxx b/opencascade/Aspect_GraphicDeviceDefinitionError.hxx index 23a9ff3b0..898f59bd8 100644 --- a/opencascade/Aspect_GraphicDeviceDefinitionError.hxx +++ b/opencascade/Aspect_GraphicDeviceDefinitionError.hxx @@ -16,14 +16,10 @@ #ifndef _Aspect_GraphicDeviceDefinitionError_HeaderFile #define _Aspect_GraphicDeviceDefinitionError_HeaderFile -#include #include #include #include -class Aspect_GraphicDeviceDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_GraphicDeviceDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_GraphicDeviceDefinitionError #define Aspect_GraphicDeviceDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_Grid.hxx b/opencascade/Aspect_Grid.hxx index c32c945bb..1f8081274 100644 --- a/opencascade/Aspect_Grid.hxx +++ b/opencascade/Aspect_Grid.hxx @@ -28,19 +28,19 @@ class Aspect_Grid : public Standard_Transient DEFINE_STANDARD_RTTIEXT(Aspect_Grid, Standard_Transient) public: //! defines the x Origin of the grid. - Standard_EXPORT void SetXOrigin(const Standard_Real anOrigin); + Standard_EXPORT void SetXOrigin(const double anOrigin); //! defines the y Origin of the grid. - Standard_EXPORT void SetYOrigin(const Standard_Real anOrigin); + Standard_EXPORT void SetYOrigin(const double anOrigin); //! defines the orientation of the grid. - Standard_EXPORT void SetRotationAngle(const Standard_Real anAngle); + Standard_EXPORT void SetRotationAngle(const double anAngle); //! Rotate the grid from a relative angle. - Standard_EXPORT void Rotate(const Standard_Real anAngle); + Standard_EXPORT void Rotate(const double anAngle); //! Translate the grid from a relative distance. - Standard_EXPORT void Translate(const Standard_Real aDx, const Standard_Real aDy); + Standard_EXPORT void Translate(const double aDx, const double aDy); //! Change the colors of the grid Standard_EXPORT virtual void SetColors(const Quantity_Color& aColor, @@ -49,37 +49,34 @@ public: //! returns the point of the grid the closest to the point X,Y //! if the grid is active. If the grid is not active returns //! X,Y. - Standard_EXPORT void Hit(const Standard_Real X, - const Standard_Real Y, - Standard_Real& gridX, - Standard_Real& gridY) const; + Standard_EXPORT void Hit(const double X, const double Y, double& gridX, double& gridY) const; //! returns the point of the grid the closest to the point X,Y - Standard_EXPORT virtual void Compute(const Standard_Real X, - const Standard_Real Y, - Standard_Real& gridX, - Standard_Real& gridY) const = 0; + Standard_EXPORT virtual void Compute(const double X, + const double Y, + double& gridX, + double& gridY) const = 0; //! activates the grid. The Hit method will return //! gridx and gridx computed according to the steps //! of the grid. - void Activate() { myIsActive = Standard_True; } + void Activate() { myIsActive = true; } //! deactivates the grid. The hit method will return //! gridx and gridx as the enter value X & Y. - void Deactivate() { myIsActive = Standard_False; } + void Deactivate() { myIsActive = false; } //! returns the x Origin of the grid. - Standard_Real XOrigin() const { return myXOrigin; } + double XOrigin() const { return myXOrigin; } //! returns the x Origin of the grid. - Standard_Real YOrigin() const { return myYOrigin; } + double YOrigin() const { return myYOrigin; } //! returns the x Angle of the grid. - Standard_Real RotationAngle() const { return myRotationAngle; } + double RotationAngle() const { return myRotationAngle; } //! Returns TRUE when the grid is active. - Standard_Boolean IsActive() const { return myIsActive; } + bool IsActive() const { return myIsActive; } //! Returns the colors of the grid. Standard_EXPORT void Colors(Quantity_Color& aColor, Quantity_Color& aTenthColor) const; @@ -97,19 +94,18 @@ public: Standard_EXPORT virtual void Erase() const = 0; //! Returns TRUE when the grid is displayed at screen. - Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0; + Standard_EXPORT virtual bool IsDisplayed() const = 0; Standard_EXPORT virtual void Init() = 0; //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const; + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; protected: //! Creates a new grid. By default this grid is not active. - Standard_EXPORT Aspect_Grid(const Standard_Real theXOrigin = 0.0, - const Standard_Real theYOrigin = 0.0, - const Standard_Real theRotationAngle = 0, + Standard_EXPORT Aspect_Grid(const double theXOrigin = 0.0, + const double theYOrigin = 0.0, + const double theRotationAngle = 0, const Quantity_Color& theColor = Quantity_NOC_GRAY50, const Quantity_Color& theTenthColor = Quantity_NOC_GRAY70); @@ -117,15 +113,13 @@ protected: Standard_EXPORT virtual void UpdateDisplay() = 0; protected: - Standard_Real myRotationAngle; - Standard_Real myXOrigin; - Standard_Real myYOrigin; + double myRotationAngle; + double myXOrigin; + double myYOrigin; Quantity_Color myColor; Quantity_Color myTenthColor; - Standard_Boolean myIsActive; + bool myIsActive; Aspect_GridDrawMode myDrawMode; }; -DEFINE_STANDARD_HANDLE(Aspect_Grid, Standard_Transient) - #endif // _Aspect_Grid_HeaderFile diff --git a/opencascade/Aspect_GridParams.hxx b/opencascade/Aspect_GridParams.hxx new file mode 100644 index 000000000..48ef46eec --- /dev/null +++ b/opencascade/Aspect_GridParams.hxx @@ -0,0 +1,262 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_GridParams_HeaderFile +#define _Aspect_GridParams_HeaderFile + +#include +#include +#include + +#include +#include +#include + +//! Shader grid appearance (color, scale, bounds, arc, draw mode, background / adaptive flags). +//! Consumed only by the GPU path: V3d_View::GridDisplay -> OpenGl_View::renderGrid. +//! No effect on the CPU path (V3d_Viewer::ActivateGrid). Snap math is independent and +//! lives on Aspect_RectangularGrid / Aspect_CircularGrid. +class Aspect_GridParams +{ +public: + DEFINE_STANDARD_ALLOC + + //! Construct with sensible defaults: grey lines on the plane origin with + //! axis coloring enabled, 1/100 plane-unit spacing, overlay mode, + //! unbounded in extent and radius. + Aspect_GridParams() + : myColor(Quantity_NOC_GRAY70), + myAccentColor(Quantity_NOC_GRAY50), + myOrigin(0.0, 0.0, 0.0), + myScale(0.01), + myScaleY(0.0), + myAccentScaleX(0.0), + myAccentScaleY(0.0), + myAccentAngularScale(0.0), + myLineThickness(0.01), + myRotationAngle(0.0), + mySizeX(0.0), + mySizeY(0.0), + myRadius(0.0), + myZOffset(0.0), + myAngleStart(0.0), + myAngleEnd(0.0), + myAngularDivisions(0), + myDrawMode(Aspect_GDM_Lines), + myIsBackground(false), + myIsDrawAxis(true), + myIsViewAdaptive(false) + { + } + + //! Return grid line color. + const Quantity_Color& Color() const { return myColor; } + + //! Set grid line color. + void SetColor(const Quantity_Color& theColor) { myColor = theColor; } + + //! Return local offset of the grid origin within the plane. + const gp_Pnt& Origin() const { return myOrigin; } + + //! Set local offset of the grid origin within the plane. + void SetOrigin(const gp_Pnt& theOrigin) { myOrigin = theOrigin; } + + //! Return every-tenth-line / accent colour rendered by the shader. + const Quantity_Color& AccentColor() const { return myAccentColor; } + + //! Set every-tenth-line / accent colour rendered by the shader. + void SetAccentColor(const Quantity_Color& theColor) { myAccentColor = theColor; } + + //! Return accent overlay scale along the plane X/radial direction. + //! Zero disables the accent layer on that axis. + double AccentScaleX() const { return myAccentScaleX; } + + //! Set accent overlay scale along the plane X/radial direction. + void SetAccentScaleX(const double theScale) { myAccentScaleX = theScale; } + + //! Return accent overlay scale along the plane Y direction. + //! Zero disables the accent layer on that axis. + double AccentScaleY() const { return myAccentScaleY; } + + //! Set accent overlay scale along the plane Y direction. + void SetAccentScaleY(const double theScale) { myAccentScaleY = theScale; } + + //! Return accent overlay angular scale for circular-grid spokes. + //! Zero disables the angular accent layer. + double AccentAngularScale() const { return myAccentAngularScale; } + + //! Set accent overlay angular scale for circular-grid spokes. + void SetAccentAngularScale(const double theScale) { myAccentAngularScale = theScale; } + + //! Return major-grid scale factor along the plane X direction (cells per plane unit). + double Scale() const { return myScale; } + + //! Set major-grid scale factor along the plane X direction (cells per plane unit). + //! Must be non-negative; zero is a valid "unused" sentinel. + void SetScale(const double theScale) + { + Standard_NegativeValue_Raise_if(theScale < 0.0, "invalid grid scale"); + myScale = theScale; + } + + //! Return explicit Y-direction scale. When 0.0, renderer falls back to Scale() (isotropic). + double ScaleY() const { return myScaleY; } + + //! Set explicit Y-direction scale. Pass 0.0 to mirror Scale() (isotropic, default). + void SetScaleY(const double theScaleY) + { + Standard_NegativeValue_Raise_if(theScaleY < 0.0, "invalid grid Y-scale"); + myScaleY = theScaleY; + } + + //! Effective Y-direction scale actually consumed by the renderer. + double EffectiveScaleY() const { return myScaleY > 0.0 ? myScaleY : myScale; } + + //! Return line thickness in plane units (minimum pixel-space line width is derived from fwidth). + double LineThickness() const { return myLineThickness; } + + //! Set line thickness in plane units. + void SetLineThickness(const double theThickness) + { + Standard_NegativeValue_Raise_if(theThickness < 0.0, "invalid grid line thickness"); + myLineThickness = theThickness; + } + + //! Return in-plane rotation angle (radians) applied to the grid axes around the plane normal. + double RotationAngle() const { return myRotationAngle; } + + //! Set in-plane rotation angle (radians) applied to the grid axes around the plane normal. + void SetRotationAngle(const double theAngle) { myRotationAngle = theAngle; } + + //! Return the angular subdivision count of the half-circle for circular grids. + //! Zero means rectangular grid (default); any positive value switches the + //! renderer to polar rings (Scale -> radial step) and spokes at pi/N rad. + int AngularDivisions() const { return myAngularDivisions; } + + //! Set angular subdivision count (0 = rectangular grid, N>0 = circular with N spokes per 180 + //! deg). + void SetAngularDivisions(const int theDivisions) { myAngularDivisions = theDivisions; } + + //! Return TRUE when the parameters describe a circular (polar) grid. + bool IsCircular() const { return myAngularDivisions > 0; } + + //! Return rectangular bounded extent along plane X; 0.0 means unbounded. + double SizeX() const { return mySizeX; } + + //! Set rectangular bounded extent along plane X; 0.0 means unbounded. + void SetSizeX(const double theSize) + { + Standard_NegativeValue_Raise_if(theSize < 0.0, "invalid grid X-size"); + mySizeX = theSize; + } + + //! Return rectangular bounded extent along plane Y; 0.0 means unbounded. + double SizeY() const { return mySizeY; } + + //! Set rectangular bounded extent along plane Y; 0.0 means unbounded. + void SetSizeY(const double theSize) + { + Standard_NegativeValue_Raise_if(theSize < 0.0, "invalid grid Y-size"); + mySizeY = theSize; + } + + //! Return circular bounded radius; 0.0 means unbounded. + double Radius() const { return myRadius; } + + //! Set circular bounded radius; 0.0 means unbounded. + void SetRadius(const double theRadius) + { + Standard_NegativeValue_Raise_if(theRadius < 0.0, "invalid grid radius"); + myRadius = theRadius; + } + + //! Return signed plane-normal offset applied at render time. + double ZOffset() const { return myZOffset; } + + //! Set signed plane-normal offset applied at render time (display only; + //! snap math stays on the unshifted plane). + void SetZOffset(const double theOffset) { myZOffset = theOffset; } + + //! Return arc start angle (radians). Meaningful only when IsArc() is true. + double AngleStart() const { return myAngleStart; } + + //! Return arc end angle (radians). Meaningful only when IsArc() is true. + double AngleEnd() const { return myAngleEnd; } + + //! Restrict the circular grid to an angular wedge [start, end], walking CCW. + //! Equal start and end (e.g. 0.0 and 0.0) returns to full-circle rendering. + void SetArcRange(const double theStart, const double theEnd) + { + myAngleStart = theStart; + myAngleEnd = theEnd; + } + + //! Return TRUE when the parameters describe a bounded rectangle or disc. + bool IsBounded() const { return mySizeX > 0.0 || mySizeY > 0.0 || myRadius > 0.0; } + + //! Return TRUE when the circular grid is restricted to a sub-arc. + bool IsArc() const { return myAngleStart != myAngleEnd; } + + //! Return draw mode: lines, points at grid intersections, or none. + Aspect_GridDrawMode DrawMode() const { return myDrawMode; } + + //! Set draw mode. Aspect_GDM_None suppresses rendering entirely; Points draws + //! dots at grid-line intersections, Lines (default) draws the full grid. + void SetDrawMode(const Aspect_GridDrawMode theMode) { myDrawMode = theMode; } + + //! Return TRUE if grid is drawn as a view-space background (behind all geometry). + bool IsBackground() const { return myIsBackground; } + + //! Set background-mode rendering on/off. + void SetIsBackground(const bool theIsBackground) { myIsBackground = theIsBackground; } + + //! Return TRUE if axis lines on the grid plane are drawn in red/green/blue. + bool IsDrawAxis() const { return myIsDrawAxis; } + + //! Set axis coloring on/off. + void SetIsDrawAxis(const bool theIsDrawAxis) { myIsDrawAxis = theIsDrawAxis; } + + //! Return TRUE if grid spacing and visible extents adapt to the camera view. + bool IsViewAdaptive() const { return myIsViewAdaptive; } + + //! Set view-adaptive grid on/off. When enabled, renderer derives temporary + //! cell spacing and bounds from the current camera. The inverse of ScaleY() + //! (or Scale() when ScaleY() is zero) is used as the target number of cells + //! across the view height. + void SetIsViewAdaptive(const bool theIsViewAdaptive) { myIsViewAdaptive = theIsViewAdaptive; } + +private: + Quantity_Color myColor; + Quantity_Color myAccentColor; + gp_Pnt myOrigin; + double myScale; + double myScaleY; + double myAccentScaleX; + double myAccentScaleY; + double myAccentAngularScale; + double myLineThickness; + double myRotationAngle; + double mySizeX; + double mySizeY; + double myRadius; + double myZOffset; + double myAngleStart; + double myAngleEnd; + int myAngularDivisions; + Aspect_GridDrawMode myDrawMode; + bool myIsBackground; + bool myIsDrawAxis; + bool myIsViewAdaptive; +}; + +#endif // _Aspect_GridParams_HeaderFile diff --git a/opencascade/Aspect_IdentDefinitionError.hxx b/opencascade/Aspect_IdentDefinitionError.hxx index 1e37aede2..3a4043f3a 100644 --- a/opencascade/Aspect_IdentDefinitionError.hxx +++ b/opencascade/Aspect_IdentDefinitionError.hxx @@ -16,14 +16,10 @@ #ifndef _Aspect_IdentDefinitionError_HeaderFile #define _Aspect_IdentDefinitionError_HeaderFile -#include #include #include #include -class Aspect_IdentDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_IdentDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_IdentDefinitionError #define Aspect_IdentDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_NeutralWindow.hxx b/opencascade/Aspect_NeutralWindow.hxx index b01d5a3c7..95b2f5f6f 100644 --- a/opencascade/Aspect_NeutralWindow.hxx +++ b/opencascade/Aspect_NeutralWindow.hxx @@ -30,53 +30,50 @@ public: Standard_EXPORT Aspect_NeutralWindow(); //! Return native handle of this drawable. - virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE { return myHandle; } + Aspect_Drawable NativeHandle() const override { return myHandle; } //! Return native handle of the parent drawable. - virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return myParentHandle; } + Aspect_Drawable NativeParentHandle() const override { return myParentHandle; } //! Return FBConfig. - virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return myFBConfig; } + Aspect_FBConfig NativeFBConfig() const override { return myFBConfig; } //! Set native handle. //! @return true if definition has been changed - Standard_Boolean SetNativeHandle(Aspect_Drawable theWindow) + bool SetNativeHandle(Aspect_Drawable theWindow) { - return SetNativeHandles(theWindow, 0, 0); + return SetNativeHandles(theWindow, 0, nullptr); } //! Set native handles. //! @return true if definition has been changed - Standard_EXPORT Standard_Boolean SetNativeHandles(Aspect_Drawable theWindow, - Aspect_Drawable theParentWindow, - Aspect_FBConfig theFbConfig); + Standard_EXPORT bool SetNativeHandles(Aspect_Drawable theWindow, + Aspect_Drawable theParentWindow, + Aspect_FBConfig theFbConfig); //! Return true if window is not hidden. - virtual Standard_Boolean IsMapped() const Standard_OVERRIDE { return myIsMapped; } + bool IsMapped() const override { return myIsMapped; } //! Change window mapped flag to TRUE. - virtual void Map() const Standard_OVERRIDE { myIsMapped = Standard_True; } + void Map() const override { myIsMapped = true; } //! Change window mapped flag to FALSE. - virtual void Unmap() const Standard_OVERRIDE { myIsMapped = Standard_False; } + void Unmap() const override { myIsMapped = false; } //! Resize window - do nothing. - virtual Aspect_TypeOfResize DoResize() Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; } + Aspect_TypeOfResize DoResize() override { return Aspect_TOR_UNKNOWN; } //! Map window - do nothing. - virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; } + bool DoMapping() const override { return true; } //! Returns window ratio equal to the physical width/height dimensions. - virtual Standard_Real Ratio() const Standard_OVERRIDE + double Ratio() const override { - return (myWidth != 0 && myHeight != 0) ? Standard_Real(myWidth) / Standard_Real(myHeight) : 1.0; + return (myWidth != 0 && myHeight != 0) ? double(myWidth) / double(myHeight) : 1.0; } //! Return the window position. - virtual void Position(Standard_Integer& theX1, - Standard_Integer& theY1, - Standard_Integer& theX2, - Standard_Integer& theY2) const Standard_OVERRIDE + void Position(int& theX1, int& theY1, int& theX2, int& theY2) const override { theX1 = myPosX; theX2 = myPosX + myWidth; @@ -86,17 +83,14 @@ public: //! Set the window position. //! @return true if position has been changed - Standard_EXPORT Standard_Boolean SetPosition(Standard_Integer theX1, Standard_Integer theY1); + Standard_EXPORT bool SetPosition(int theX1, int theY1); //! Set the window position. //! @return true if position has been changed - Standard_EXPORT Standard_Boolean SetPosition(Standard_Integer theX1, - Standard_Integer theY1, - Standard_Integer theX2, - Standard_Integer theY2); + Standard_EXPORT bool SetPosition(int theX1, int theY1, int theX2, int theY2); //! Return the window size. - virtual void Size(Standard_Integer& theWidth, Standard_Integer& theHeight) const Standard_OVERRIDE + void Size(int& theWidth, int& theHeight) const override { theWidth = myWidth; theHeight = myHeight; @@ -104,20 +98,17 @@ public: //! Set the window size. //! @return true if size has been changed - Standard_EXPORT Standard_Boolean SetSize(const Standard_Integer theWidth, - const Standard_Integer theHeight); + Standard_EXPORT bool SetSize(const int theWidth, const int theHeight); protected: - Aspect_Drawable myHandle; - Aspect_Drawable myParentHandle; - Aspect_FBConfig myFBConfig; - Standard_Integer myPosX; - Standard_Integer myPosY; - Standard_Integer myWidth; - Standard_Integer myHeight; - mutable Standard_Boolean myIsMapped; + Aspect_Drawable myHandle; + Aspect_Drawable myParentHandle; + Aspect_FBConfig myFBConfig; + int myPosX; + int myPosY; + int myWidth; + int myHeight; + mutable bool myIsMapped; }; -DEFINE_STANDARD_HANDLE(Aspect_NeutralWindow, Aspect_Window) - #endif // _Aspect_NeutralWindow_HeaderFile diff --git a/opencascade/Aspect_OpenVRSession.hxx b/opencascade/Aspect_OpenVRSession.hxx index 96242315c..fa36cd0b2 100644 --- a/opencascade/Aspect_OpenVRSession.hxx +++ b/opencascade/Aspect_OpenVRSession.hxx @@ -30,39 +30,37 @@ public: Standard_EXPORT Aspect_OpenVRSession(); //! Destructor. - Standard_EXPORT virtual ~Aspect_OpenVRSession(); + Standard_EXPORT ~Aspect_OpenVRSession() override; //! Return TRUE if session is opened. - Standard_EXPORT virtual bool IsOpen() const Standard_OVERRIDE; + Standard_EXPORT bool IsOpen() const override; //! Initialize session. - Standard_EXPORT virtual bool Open() Standard_OVERRIDE; + Standard_EXPORT bool Open() override; //! Release session. - Standard_EXPORT virtual void Close() Standard_OVERRIDE; + Standard_EXPORT void Close() override; //! Fetch actual poses of tracked devices. - Standard_EXPORT virtual bool WaitPoses() Standard_OVERRIDE; + Standard_EXPORT bool WaitPoses() override; //! Return recommended viewport Width x Height for rendering into VR. - virtual NCollection_Vec2 RecommendedViewport() const Standard_OVERRIDE { return myRendSize; } + NCollection_Vec2 RecommendedViewport() const override { return myRendSize; } //! Return transformation from eye to head. //! vr::GetEyeToHeadTransform() wrapper. - Standard_EXPORT virtual NCollection_Mat4 EyeToHeadTransform(Aspect_Eye theEye) const - Standard_OVERRIDE; + Standard_EXPORT NCollection_Mat4 EyeToHeadTransform(Aspect_Eye theEye) const override; //! Return projection matrix. - Standard_EXPORT virtual NCollection_Mat4 ProjectionMatrix(Aspect_Eye theEye, - double theZNear, - double theZFar) const - Standard_OVERRIDE; + Standard_EXPORT NCollection_Mat4 ProjectionMatrix(Aspect_Eye theEye, + double theZNear, + double theZFar) const override; //! Return TRUE. - virtual bool HasProjectionFrustums() const Standard_OVERRIDE { return true; } + bool HasProjectionFrustums() const override { return true; } //! Receive XR events. - Standard_EXPORT virtual void ProcessEvents() Standard_OVERRIDE; + Standard_EXPORT void ProcessEvents() override; //! Submit texture eye to XR Composer. //! @param[in] theTexture texture handle @@ -72,34 +70,31 @@ public: //! Linear means to sRGB color conversion by composer //! @param[in] theEye eye to display //! @return FALSE on error - Standard_EXPORT virtual bool SubmitEye(void* theTexture, - Aspect_GraphicsLibrary theGraphicsLib, - Aspect_ColorSpace theColorSpace, - Aspect_Eye theEye) Standard_OVERRIDE; + Standard_EXPORT bool SubmitEye(void* theTexture, + Aspect_GraphicsLibrary theGraphicsLib, + Aspect_ColorSpace theColorSpace, + Aspect_Eye theEye) override; //! Query information. - Standard_EXPORT virtual TCollection_AsciiString GetString(InfoString theInfo) const - Standard_OVERRIDE; + Standard_EXPORT TCollection_AsciiString GetString(InfoString theInfo) const override; //! Return index of tracked device of known role. - Standard_EXPORT virtual Standard_Integer NamedTrackedDevice( - Aspect_XRTrackedDeviceRole theDevice) const Standard_OVERRIDE; + Standard_EXPORT int NamedTrackedDevice(Aspect_XRTrackedDeviceRole theDevice) const override; //! Fetch data for digital input action (like button). - Standard_EXPORT virtual Aspect_XRDigitalActionData GetDigitalActionData( - const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE; + Standard_EXPORT Aspect_XRDigitalActionData + GetDigitalActionData(const occ::handle& theAction) const override; //! Fetch data for analog input action (like axis). - Standard_EXPORT virtual Aspect_XRAnalogActionData GetAnalogActionData( - const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE; + Standard_EXPORT Aspect_XRAnalogActionData + GetAnalogActionData(const occ::handle& theAction) const override; //! Fetch data for pose input action (like fingertip position). - Standard_EXPORT virtual Aspect_XRPoseActionData GetPoseActionDataForNextFrame( - const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE; + Standard_EXPORT Aspect_XRPoseActionData + GetPoseActionDataForNextFrame(const occ::handle& theAction) const override; //! Set tracking origin. - Standard_EXPORT virtual void SetTrackingOrigin(TrackingUniverseOrigin theOrigin) - Standard_OVERRIDE; + Standard_EXPORT void SetTrackingOrigin(TrackingUniverseOrigin theOrigin) override; protected: //! Find location of default actions manifest file (based on CSF_OCCTResourcePath or CASROOT @@ -116,24 +111,24 @@ protected: Standard_EXPORT virtual bool initInput(); //! Handle tracked device activation. - Standard_EXPORT virtual void onTrackedDeviceActivated(Standard_Integer theDeviceIndex); + Standard_EXPORT virtual void onTrackedDeviceActivated(int theDeviceIndex); //! Handle tracked device deactivation. - Standard_EXPORT virtual void onTrackedDeviceDeactivated(Standard_Integer theDeviceIndex); + Standard_EXPORT virtual void onTrackedDeviceDeactivated(int theDeviceIndex); //! Handle tracked device update. - Standard_EXPORT virtual void onTrackedDeviceUpdated(Standard_Integer theDeviceIndex); + Standard_EXPORT virtual void onTrackedDeviceUpdated(int theDeviceIndex); //! Trigger vibration. - Standard_EXPORT virtual void triggerHapticVibrationAction( - const Handle(Aspect_XRAction)& theAction, - const Aspect_XRHapticActionData& theParams) Standard_OVERRIDE; + Standard_EXPORT void triggerHapticVibrationAction( + const occ::handle& theAction, + const Aspect_XRHapticActionData& theParams) override; //! Return model for displaying device. - Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) loadRenderModel( - Standard_Integer theDevice, - Standard_Boolean theToApplyUnitFactor, - Handle(Image_Texture)& theTexture) Standard_OVERRIDE; + Standard_EXPORT occ::handle loadRenderModel( + int theDevice, + bool theToApplyUnitFactor, + occ::handle& theTexture) override; protected: //! Access vr::IVRSystem* - OpenVR session object. diff --git a/opencascade/Aspect_RectangularGrid.hxx b/opencascade/Aspect_RectangularGrid.hxx index 9cb034aca..b2befab7d 100644 --- a/opencascade/Aspect_RectangularGrid.hxx +++ b/opencascade/Aspect_RectangularGrid.hxx @@ -29,72 +29,93 @@ public: //! active. //! The first angle is given relatively to the horizontal. //! The second angle is given relatively to the vertical. - Standard_EXPORT Aspect_RectangularGrid(const Standard_Real aXStep, - const Standard_Real aYStep, - const Standard_Real anXOrigin = 0, - const Standard_Real anYOrigin = 0, - const Standard_Real aFirstAngle = 0, - const Standard_Real aSecondAngle = 0, - const Standard_Real aRotationAngle = 0); + Standard_EXPORT Aspect_RectangularGrid(const double aXStep, + const double aYStep, + const double anXOrigin = 0, + const double anYOrigin = 0, + const double aFirstAngle = 0, + const double aSecondAngle = 0, + const double aRotationAngle = 0); //! defines the x step of the grid. - Standard_EXPORT void SetXStep(const Standard_Real aStep); + Standard_EXPORT void SetXStep(const double aStep); //! defines the y step of the grid. - Standard_EXPORT void SetYStep(const Standard_Real aStep); + Standard_EXPORT void SetYStep(const double aStep); //! defines the angle of the second network //! the fist angle is given relatively to the horizontal. //! the second angle is given relatively to the vertical. - Standard_EXPORT void SetAngle(const Standard_Real anAngle1, const Standard_Real anAngle2); + Standard_EXPORT void SetAngle(const double anAngle1, const double anAngle2); - Standard_EXPORT void SetGridValues(const Standard_Real XOrigin, - const Standard_Real YOrigin, - const Standard_Real XStep, - const Standard_Real YStep, - const Standard_Real RotationAngle); + Standard_EXPORT void SetGridValues(const double XOrigin, + const double YOrigin, + const double XStep, + const double YStep, + const double RotationAngle); //! returns the point of the grid the closest to the point X,Y - Standard_EXPORT virtual void Compute(const Standard_Real X, - const Standard_Real Y, - Standard_Real& gridX, - Standard_Real& gridY) const Standard_OVERRIDE; + Standard_EXPORT void Compute(const double X, + const double Y, + double& gridX, + double& gridY) const override; //! returns the x step of the grid. - Standard_EXPORT Standard_Real XStep() const; + Standard_EXPORT double XStep() const; //! returns the x step of the grid. - Standard_EXPORT Standard_Real YStep() const; + Standard_EXPORT double YStep() const; //! returns the x Angle of the grid, relatively to the horizontal. - Standard_EXPORT Standard_Real FirstAngle() const; + Standard_EXPORT double FirstAngle() const; //! returns the y Angle of the grid, relatively to the vertical. - Standard_EXPORT Standard_Real SecondAngle() const; + Standard_EXPORT double SecondAngle() const; - Standard_EXPORT virtual void Init() Standard_OVERRIDE; + //! Set full extent of the bounded grid along the plane X direction (plane-local units). + //! 0.0 (default) means unbounded - the shader draws the grid to the horizon. + Standard_EXPORT void SetSizeX(const double theSize); + + //! Return the bounded-region extent along plane X. 0.0 means unbounded. + double SizeX() const { return mySizeX; } + + //! Set full extent of the bounded grid along the plane Y direction (plane-local units). + //! 0.0 (default) means unbounded. + Standard_EXPORT void SetSizeY(const double theSize); + + //! Return the bounded-region extent along plane Y. 0.0 means unbounded. + double SizeY() const { return mySizeY; } + + //! Set signed offset (plane-local units) applied along the plane normal for + //! display only - snap math stays on the plane. Use a small negative value + //! to push the grid slightly below coplanar geometry and avoid z-fighting. + Standard_EXPORT void SetZOffset(const double theOffset); + + //! Return the display-time Z-offset along the plane normal. + double ZOffset() const { return myZOffset; } + + Standard_EXPORT void Init() override; //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, - Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override; private: - Standard_EXPORT Standard_Boolean CheckAngle(const Standard_Real alpha, - const Standard_Real beta) const; + Standard_EXPORT bool CheckAngle(const double alpha, const double beta) const; private: - Standard_Real myXStep; - Standard_Real myYStep; - Standard_Real myFirstAngle; - Standard_Real mySecondAngle; - Standard_Real a1; - Standard_Real b1; - Standard_Real c1; - Standard_Real a2; - Standard_Real b2; - Standard_Real c2; + double myXStep; + double myYStep; + double myFirstAngle; + double mySecondAngle; + double mySizeX; + double mySizeY; + double myZOffset; + double a1; + double b1; + double c1; + double a2; + double b2; + double c2; }; -DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid) - #endif // _Aspect_RectangularGrid_HeaderFile diff --git a/opencascade/Aspect_ScrollDelta.hxx b/opencascade/Aspect_ScrollDelta.hxx index 374dd846f..170bb5798 100644 --- a/opencascade/Aspect_ScrollDelta.hxx +++ b/opencascade/Aspect_ScrollDelta.hxx @@ -22,7 +22,7 @@ struct Aspect_ScrollDelta { NCollection_Vec2 Point; //!< scale position - Standard_Real Delta; //!< delta in pixels + double Delta; //!< delta in pixels Aspect_VKeyFlags Flags; //!< key flags //! Return true if action has point defined. @@ -41,7 +41,7 @@ struct Aspect_ScrollDelta //! Constructor. Aspect_ScrollDelta(const NCollection_Vec2& thePnt, - Standard_Real theValue, + double theValue, Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE) : Point(thePnt), Delta(theValue), @@ -50,7 +50,7 @@ struct Aspect_ScrollDelta } //! Constructor with undefined point. - Aspect_ScrollDelta(Standard_Real theValue, Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE) + Aspect_ScrollDelta(double theValue, Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE) : Point(-1, -1), Delta(theValue), Flags(theFlags) diff --git a/opencascade/Aspect_SequenceOfColor.hxx b/opencascade/Aspect_SequenceOfColor.hxx index 2e82600ef..fe74bedcf 100644 --- a/opencascade/Aspect_SequenceOfColor.hxx +++ b/opencascade/Aspect_SequenceOfColor.hxx @@ -1,6 +1,4 @@ -// Created by: NW,JPB,CAL -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef Aspect_SequenceOfColor_HeaderFile -#define Aspect_SequenceOfColor_HeaderFile +//! @file Aspect_SequenceOfColor.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _Aspect_SequenceOfColor_hxx +#define _Aspect_SequenceOfColor_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("Aspect_SequenceOfColor.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence directly.") + + Standard_DEPRECATED( + "Aspect_SequenceOfColor is deprecated, use NCollection_Sequence directly") typedef NCollection_Sequence Aspect_SequenceOfColor; -#endif +#endif // _Aspect_SequenceOfColor_hxx diff --git a/opencascade/Aspect_SkydomeBackground.hxx b/opencascade/Aspect_SkydomeBackground.hxx index 43b6fb5e7..509aeb628 100644 --- a/opencascade/Aspect_SkydomeBackground.hxx +++ b/opencascade/Aspect_SkydomeBackground.hxx @@ -17,7 +17,8 @@ #define _Aspect_SkydomeBackground_Header #include -#include +#include +#include #include #include #include @@ -42,11 +43,11 @@ public: //! appearance. //! @param[in] theFogginess fog intensity, 0.0 means no fog and 1.0 - high fogginess //! @param[in] theSize size of cubemap side in pixels. - Standard_EXPORT Aspect_SkydomeBackground(const gp_Dir& theSunDirection, - Standard_ShortReal theCloudiness, - Standard_ShortReal theTime, - Standard_ShortReal theFogginess, - Standard_Integer theSize); + Standard_EXPORT Aspect_SkydomeBackground(const gp_Dir& theSunDirection, + float theCloudiness, + float theTime, + float theFogginess, + int theSize); //! Destructor. Standard_EXPORT ~Aspect_SkydomeBackground(); @@ -57,18 +58,18 @@ public: //! Get cloud intensity. By default this value is 0.2 //! 0.0 means no clouds at all and 1.0 - high clody. - Standard_ShortReal Cloudiness() const { return myCloudiness; } + float Cloudiness() const { return myCloudiness; } //! Get time of cloud simulation. By default this value is 0.0 //! This value might be tweaked to slightly change appearance of clouds. - Standard_ShortReal TimeParameter() const { return myTime; } + float TimeParameter() const { return myTime; } //! Get fog intensity. By default this value is 0.0 //! 0.0 means no fog and 1.0 - high fogginess - Standard_ShortReal Fogginess() const { return myFogginess; } + float Fogginess() const { return myFogginess; } //! Get size of cubemap. By default this value is 512 - Standard_Integer Size() const { return mySize; } + int Size() const { return mySize; } //! Set sun direction. By default this value is (0, 1, 0) //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction. @@ -76,28 +77,28 @@ public: //! Set cloud intensity. By default this value is 0.2 //! 0.0 means no clouds at all and 1.0 - high clody. - Standard_EXPORT void SetCloudiness(Standard_ShortReal theCloudiness); + Standard_EXPORT void SetCloudiness(float theCloudiness); //! Set time of cloud simulation. By default this value is 0.0 //! This value might be tweaked to slightly change appearance of clouds. - void SetTimeParameter(Standard_ShortReal theTime) { myTime = theTime; } + void SetTimeParameter(float theTime) { myTime = theTime; } //! Set fog intensity. By default this value is 0.0 //! 0.0 means no fog and 1.0 - high fogginess - Standard_EXPORT void SetFogginess(Standard_ShortReal theFogginess); + Standard_EXPORT void SetFogginess(float theFogginess); //! Set size of cubemap. By default this value is 512 - Standard_EXPORT void SetSize(Standard_Integer theSize); + Standard_EXPORT void SetSize(int theSize); //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; private: - gp_Dir mySunDirection; //!< Sun (moon) light direction. - Standard_ShortReal myCloudiness; //!< Cloud intensity. - Standard_ShortReal myTime; //!< Simulation time parameter. - Standard_ShortReal myFogginess; //!< Fog intensity - Standard_Integer mySize; //!< Size of cubemap in pixels + gp_Dir mySunDirection; //!< Sun (moon) light direction. + float myCloudiness; //!< Cloud intensity. + float myTime; //!< Simulation time parameter. + float myFogginess; //!< Fog intensity + int mySize; //!< Size of cubemap in pixels }; #endif // _Aspect_SkydomeBackground_Header diff --git a/opencascade/Aspect_Touch.hxx b/opencascade/Aspect_Touch.hxx index 2d7955d28..da5d3da5e 100644 --- a/opencascade/Aspect_Touch.hxx +++ b/opencascade/Aspect_Touch.hxx @@ -20,14 +20,14 @@ class Aspect_Touch { public: - NCollection_Vec2 From; //!< original touch position - NCollection_Vec2 To; //!< current touch position - // clang-format off - Standard_Boolean IsPreciseDevice; //!< precise device input (e.g. mouse cursor, NOT emulated from touch screen) - // clang-format on + NCollection_Vec2 From; //!< original touch position + NCollection_Vec2 To; //!< current touch position + // clang-format off + bool IsPreciseDevice; //!< precise device input (e.g. mouse cursor, NOT emulated from touch screen) + // clang-format on //! Return values delta. - NCollection_Vec2 Delta() const { return To - From; } + NCollection_Vec2 Delta() const { return To - From; } //! Empty constructor Aspect_Touch() @@ -38,7 +38,7 @@ public: } //! Constructor with initialization. - Aspect_Touch(const NCollection_Vec2& thePnt, Standard_Boolean theIsPreciseDevice) + Aspect_Touch(const NCollection_Vec2& thePnt, bool theIsPreciseDevice) : From(thePnt), To(thePnt), IsPreciseDevice(theIsPreciseDevice) @@ -46,7 +46,7 @@ public: } //! Constructor with initialization. - Aspect_Touch(Standard_Real theX, Standard_Real theY, Standard_Boolean theIsPreciseDevice) + Aspect_Touch(double theX, double theY, bool theIsPreciseDevice) : From(theX, theY), To(theX, theY), IsPreciseDevice(theIsPreciseDevice) diff --git a/opencascade/Aspect_TouchMap.hxx b/opencascade/Aspect_TouchMap.hxx index 0f4b1d341..5d3b7ee5c 100644 --- a/opencascade/Aspect_TouchMap.hxx +++ b/opencascade/Aspect_TouchMap.hxx @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2019 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -11,13 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _Aspect_TouchMap_HeaderFile -#define _Aspect_TouchMap_HeaderFile +//! @file Aspect_TouchMap.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap directly instead. -#include +#ifndef _Aspect_TouchMap_hxx +#define _Aspect_TouchMap_hxx +#include +#include #include -typedef NCollection_IndexedDataMap Aspect_TouchMap; +Standard_HEADER_DEPRECATED("Aspect_TouchMap.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedDataMap directly.") + + Standard_DEPRECATED( + "Aspect_TouchMap is deprecated, use NCollection_IndexedDataMap directly") +typedef NCollection_IndexedDataMap Aspect_TouchMap; -#endif // _Aspect_TouchMap_HeaderFile +#endif // _Aspect_TouchMap_hxx diff --git a/opencascade/Aspect_TrackedDevicePose.hxx b/opencascade/Aspect_TrackedDevicePose.hxx index 83a6598c0..f556aa564 100644 --- a/opencascade/Aspect_TrackedDevicePose.hxx +++ b/opencascade/Aspect_TrackedDevicePose.hxx @@ -35,6 +35,5 @@ struct Aspect_TrackedDevicePose }; //! Array of tracked poses. -typedef NCollection_Array1 Aspect_TrackedDevicePoseArray; #endif // _Aspect_TrackedDevicePose_HeaderFile diff --git a/opencascade/Aspect_TypeOfDeflection.hxx b/opencascade/Aspect_TypeOfDeflection.hxx index 1a4edd0c4..2e3143b5f 100644 --- a/opencascade/Aspect_TypeOfDeflection.hxx +++ b/opencascade/Aspect_TypeOfDeflection.hxx @@ -17,7 +17,7 @@ #define _Aspect_TypeOfDeflection_HeaderFile //! Defines if the maximal chordial deflection used when -//! drawing an object is absolute or relative to the size +//! drawing an object is absolute or relative to the size //! of the object. enum Aspect_TypeOfDeflection { diff --git a/opencascade/Aspect_TypeOfStyleText.hxx b/opencascade/Aspect_TypeOfStyleText.hxx index f4901dd8e..e56208b25 100644 --- a/opencascade/Aspect_TypeOfStyleText.hxx +++ b/opencascade/Aspect_TypeOfStyleText.hxx @@ -18,10 +18,12 @@ //! Define the style of the text. //! -//! TOST_NORMAL Default text. The text is displayed like any other graphic object. +//! TOST_NORMAL +//! Default text. The text is displayed like any other graphic object. //! This text can be hidden by another object that is nearest from the //! point of view. -//! TOST_ANNOTATION The text is always visible. The texte is displayed +//! TOST_ANNOTATION +//! The text is always visible. The text is displayed //! over the other object according to the priority. enum Aspect_TypeOfStyleText { diff --git a/opencascade/Aspect_VKeySet.hxx b/opencascade/Aspect_VKeySet.hxx index eceeb1cae..53939cfc3 100644 --- a/opencascade/Aspect_VKeySet.hxx +++ b/opencascade/Aspect_VKeySet.hxx @@ -18,9 +18,10 @@ #include #include -#include #include +#include + //! Structure defining key state. class Aspect_VKeySet : public Standard_Transient { @@ -32,42 +33,42 @@ public: //! Return active modifiers. Aspect_VKeyFlags Modifiers() const { - Standard_Mutex::Sentry aLock(myLock); + std::shared_lock aLock(myLock); return myModifiers; } //! Return timestamp of press event. double DownTime(Aspect_VKey theKey) const { - Standard_Mutex::Sentry aLock(myLock); + std::shared_lock aLock(myLock); return myKeys[theKey].TimeDown; } //! Return timestamp of release event. double TimeUp(Aspect_VKey theKey) const { - Standard_Mutex::Sentry aLock(myLock); + std::shared_lock aLock(myLock); return myKeys[theKey].TimeUp; } //! Return TRUE if key is in Free state. bool IsFreeKey(Aspect_VKey theKey) const { - Standard_Mutex::Sentry aLock(myLock); + std::shared_lock aLock(myLock); return myKeys[theKey].KStatus == KeyStatus_Free; } //! Return TRUE if key is in Pressed state. bool IsKeyDown(Aspect_VKey theKey) const { - Standard_Mutex::Sentry aLock(myLock); + std::shared_lock aLock(myLock); return myKeys[theKey].KStatus == KeyStatus_Pressed; } //! Return mutex for thread-safe updates. //! All operations in class implicitly locks this mutex, //! so this method could be used only for batch processing of keys. - Standard_Mutex& Mutex() { return myLock; } + std::shared_mutex& Mutex() { return myLock; } public: //! Reset the key state into unpressed state. @@ -111,6 +112,13 @@ public: double& theDuration, double& thePressure); +private: + //! Press key without locking (assumes lock is already held). + void KeyDown_Unlocked(Aspect_VKey theKey, double theTime, double thePressure); + + //! Release key without locking (assumes lock is already held). + void KeyUp_Unlocked(Aspect_VKey theKey, double theTime); + private: //! Key state. enum KeyStatus @@ -147,7 +155,7 @@ private: private: NCollection_Array1 myKeys; //!< keys state - mutable Standard_Mutex myLock; //!< mutex for thread-safe updates + mutable std::shared_mutex myLock; //!< mutex for thread-safe updates Aspect_VKeyFlags myModifiers; //!< active modifiers }; diff --git a/opencascade/Aspect_Window.hxx b/opencascade/Aspect_Window.hxx index 7f8096e08..2ceb3eeda 100644 --- a/opencascade/Aspect_Window.hxx +++ b/opencascade/Aspect_Window.hxx @@ -24,7 +24,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -32,37 +33,35 @@ class Aspect_DisplayConnection; -DEFINE_STANDARD_HANDLE(Aspect_Window, Standard_Transient) - //! Defines a window. class Aspect_Window : public Standard_Transient { DEFINE_STANDARD_RTTIEXT(Aspect_Window, Standard_Transient) public: //! Returns True if the window is virtual - Standard_EXPORT Standard_Boolean IsVirtual() const; + Standard_EXPORT bool IsVirtual() const; //! Setup the virtual state - Standard_EXPORT void SetVirtual(const Standard_Boolean theVirtual); + Standard_EXPORT void SetVirtual(const bool theVirtual); //! Returns window top-left corner. - Graphic3d_Vec2i TopLeft() const + NCollection_Vec2 TopLeft() const { - Graphic3d_Vec2i aTopLeft, aBotRight; + NCollection_Vec2 aTopLeft, aBotRight; Position(aTopLeft.x(), aTopLeft.y(), aBotRight.x(), aBotRight.y()); return aTopLeft; } //! Returns window dimensions. - Graphic3d_Vec2i Dimensions() const + NCollection_Vec2 Dimensions() const { - Graphic3d_Vec2i aSize; + NCollection_Vec2 aSize; Size(aSize.x(), aSize.y()); return aSize; } //! Returns connection to Display or NULL. - const Handle(Aspect_DisplayConnection)& DisplayConnection() const { return myDisplay; } + const occ::handle& DisplayConnection() const { return myDisplay; } //! Returns the window background. Standard_EXPORT Aspect_Background Background() const; @@ -90,7 +89,7 @@ public: public: //! Returns True if the window is opened //! and False if the window is closed. - Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0; + Standard_EXPORT virtual bool IsMapped() const = 0; //! Opens the window . Standard_EXPORT virtual void Map() const = 0; @@ -103,20 +102,17 @@ public: //! Apply the mapping change to the window . //! and returns TRUE if the window is mapped at screen. - Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0; + Standard_EXPORT virtual bool DoMapping() const = 0; //! Returns The Window RATIO equal to the physical //! WIDTH/HEIGHT dimensions - Standard_EXPORT virtual Standard_Real Ratio() const = 0; + Standard_EXPORT virtual double Ratio() const = 0; //! Returns The Window POSITION in PIXEL - Standard_EXPORT virtual void Position(Standard_Integer& X1, - Standard_Integer& Y1, - Standard_Integer& X2, - Standard_Integer& Y2) const = 0; + Standard_EXPORT virtual void Position(int& X1, int& Y1, int& X2, int& Y2) const = 0; //! Returns The Window SIZE in PIXEL - Standard_EXPORT virtual void Size(Standard_Integer& Width, Standard_Integer& Height) const = 0; + Standard_EXPORT virtual void Size(int& Width, int& Height) const = 0; //! Returns native Window handle (HWND on Windows, Window with Xlib, and so on) Standard_EXPORT virtual Aspect_Drawable NativeHandle() const = 0; @@ -138,38 +134,43 @@ public: //! Optional display argument should be passed when called from non-GUI thread //! on platforms implementing thread-unsafe connections to display. //! NULL can be passed instead otherwise. - virtual void InvalidateContent(const Handle(Aspect_DisplayConnection)& theDisp) { (void)theDisp; } + virtual void InvalidateContent(const occ::handle& theDisp) + { + (void)theDisp; + } public: //! Return device pixel ratio (logical to backing store scale factor). - virtual Standard_Real DevicePixelRatio() const { return 1.0; } + virtual double DevicePixelRatio() const { return 1.0; } //! Convert point from logical units into backing store units. - virtual Graphic3d_Vec2d ConvertPointToBacking(const Graphic3d_Vec2d& thePnt) const + virtual NCollection_Vec2 ConvertPointToBacking( + const NCollection_Vec2& thePnt) const { return thePnt * DevicePixelRatio(); } //! Convert point from backing store units to logical units. - virtual Graphic3d_Vec2d ConvertPointFromBacking(const Graphic3d_Vec2d& thePnt) const + virtual NCollection_Vec2 ConvertPointFromBacking( + const NCollection_Vec2& thePnt) const { return thePnt / DevicePixelRatio(); } public: //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; protected: //! Initializes the data of a Window. Standard_EXPORT Aspect_Window(); protected: - Handle(Aspect_DisplayConnection) myDisplay; //!< Display connection - Aspect_Background MyBackground; - Aspect_GradientBackground MyGradientBackground; - Aspect_FillMethod MyBackgroundFillMethod; - Standard_Boolean MyIsVirtual; + occ::handle myDisplay; //!< Display connection + Aspect_Background MyBackground; + Aspect_GradientBackground MyGradientBackground; + Aspect_FillMethod MyBackgroundFillMethod; + bool MyIsVirtual; }; #endif // _Aspect_Window_HeaderFile diff --git a/opencascade/Aspect_WindowDefinitionError.hxx b/opencascade/Aspect_WindowDefinitionError.hxx index 48598082d..dd927371a 100644 --- a/opencascade/Aspect_WindowDefinitionError.hxx +++ b/opencascade/Aspect_WindowDefinitionError.hxx @@ -16,14 +16,10 @@ #ifndef _Aspect_WindowDefinitionError_HeaderFile #define _Aspect_WindowDefinitionError_HeaderFile -#include #include #include #include -class Aspect_WindowDefinitionError; -DEFINE_STANDARD_HANDLE(Aspect_WindowDefinitionError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_WindowDefinitionError #define Aspect_WindowDefinitionError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_WindowError.hxx b/opencascade/Aspect_WindowError.hxx index aa9bb9343..edb8f0095 100644 --- a/opencascade/Aspect_WindowError.hxx +++ b/opencascade/Aspect_WindowError.hxx @@ -16,14 +16,10 @@ #ifndef _Aspect_WindowError_HeaderFile #define _Aspect_WindowError_HeaderFile -#include #include #include #include -class Aspect_WindowError; -DEFINE_STANDARD_HANDLE(Aspect_WindowError, Standard_OutOfRange) - #if !defined No_Exception && !defined No_Aspect_WindowError #define Aspect_WindowError_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/Aspect_WindowInputListener.hxx b/opencascade/Aspect_WindowInputListener.hxx index 5bb9e24c6..18e205b4c 100644 --- a/opencascade/Aspect_WindowInputListener.hxx +++ b/opencascade/Aspect_WindowInputListener.hxx @@ -15,8 +15,13 @@ #define _Aspect_WindowInputListener_HeaderFile #include -#include -#include +#include +#include +#include +#include +#include +#include +#include struct Aspect_ScrollDelta; class WNT_HIDSpaceMouse; @@ -24,8 +29,6 @@ class WNT_HIDSpaceMouse; //! Defines a listener for window input events. class Aspect_WindowInputListener { -public: - /// DEFINE_STANDARD_ALLOC public: //! Destructor. Standard_EXPORT virtual ~Aspect_WindowInputListener(); @@ -91,10 +94,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if window content should be redrawn - virtual bool UpdateMouseButtons(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButtons, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) = 0; + virtual bool UpdateMouseButtons(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButtons, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) = 0; //! Handle mouse cursor movement event. //! This method is expected to be called from UI thread. @@ -105,10 +108,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if window content should be redrawn - virtual bool UpdateMousePosition(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButtons, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) = 0; + virtual bool UpdateMousePosition(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButtons, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) = 0; //! Handle mouse button press event. //! This method is expected to be called from UI thread. @@ -119,10 +122,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if window content should be redrawn - bool PressMouseButton(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButton, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) + bool PressMouseButton(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButton, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) { return UpdateMouseButtons(thePoint, myMousePressed | theButton, theModifiers, theIsEmulated); } @@ -136,10 +139,10 @@ public: //! @name mouse input //! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse //! but emulated from non-precise input like touch on screen //! @return TRUE if window content should be redrawn - bool ReleaseMouseButton(const Graphic3d_Vec2i& thePoint, - Aspect_VKeyMouse theButton, - Aspect_VKeyFlags theModifiers, - bool theIsEmulated) + bool ReleaseMouseButton(const NCollection_Vec2& thePoint, + Aspect_VKeyMouse theButton, + Aspect_VKeyFlags theModifiers, + bool theIsEmulated) { Aspect_VKeyMouse aButtons = myMousePressed & (~theButton); return UpdateMouseButtons(thePoint, aButtons, theModifiers, theIsEmulated); @@ -152,38 +155,41 @@ public: //! @name mouse input Aspect_VKeyFlags LastMouseFlags() const { return myMouseModifiers; } //! Return last mouse position. - const Graphic3d_Vec2i& LastMousePosition() const { return myMousePositionLast; } + const NCollection_Vec2& LastMousePosition() const { return myMousePositionLast; } public: //! @name multi-touch input //! Return TRUE if touches map is not empty. bool HasTouchPoints() const { return !myTouchPoints.IsEmpty(); } //! Return map of active touches. - const Aspect_TouchMap& TouchPoints() const { return myTouchPoints; } + const NCollection_IndexedDataMap& TouchPoints() const + { + return myTouchPoints; + } //! Add touch point with the given ID. //! This method is expected to be called from UI thread. //! @param theId touch unique identifier //! @param thePnt touch coordinates //! @param theClearBefore if TRUE previously registered touches will be removed - Standard_EXPORT virtual void AddTouchPoint(Standard_Size theId, - const Graphic3d_Vec2d& thePnt, - Standard_Boolean theClearBefore = false); + Standard_EXPORT virtual void AddTouchPoint(size_t theId, + const NCollection_Vec2& thePnt, + bool theClearBefore = false); //! Remove touch point with the given ID. //! This method is expected to be called from UI thread. //! @param theId touch unique identifier //! @param theClearSelectPnts if TRUE will initiate clearing of selection points //! @return TRUE if point has been removed - Standard_EXPORT virtual bool RemoveTouchPoint(Standard_Size theId, - Standard_Boolean theClearSelectPnts = false); + Standard_EXPORT virtual bool RemoveTouchPoint(size_t theId, bool theClearSelectPnts = false); //! Update touch point with the given ID. //! If point with specified ID was not registered before, it will be added. //! This method is expected to be called from UI thread. //! @param theId touch unique identifier //! @param thePnt touch coordinates - Standard_EXPORT virtual void UpdateTouchPoint(Standard_Size theId, const Graphic3d_Vec2d& thePnt); + Standard_EXPORT virtual void UpdateTouchPoint(size_t theId, + const NCollection_Vec2& thePnt); public: //! @name 3d mouse input //! Return acceleration ratio for translation event; 2.0 by default. @@ -238,13 +244,13 @@ protected: protected: //! @name keyboard input variables Aspect_VKeySet myKeys; //!< keyboard state -protected: //! @name mouse input variables - Graphic3d_Vec2i myMousePositionLast; //!< last mouse position - Aspect_VKeyMouse myMousePressed; //!< active mouse buttons - Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event +protected: //! @name mouse input variables + NCollection_Vec2 myMousePositionLast; //!< last mouse position + Aspect_VKeyMouse myMousePressed; //!< active mouse buttons + Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event protected: - Aspect_TouchMap myTouchPoints; //!< map of active touches + NCollection_IndexedDataMap myTouchPoints; //!< map of active touches protected: //! @name 3d mouse input variables bool my3dMouseButtonState[32]; //!< cached button state diff --git a/opencascade/Aspect_XRAction.hxx b/opencascade/Aspect_XRAction.hxx index d6adfbb4e..ceaeed447 100644 --- a/opencascade/Aspect_XRAction.hxx +++ b/opencascade/Aspect_XRAction.hxx @@ -55,7 +55,5 @@ protected: }; //! Map of actions with action Id as a key. -typedef NCollection_IndexedDataMap - Aspect_XRActionMap; #endif // _Aspect_XRAction_HeaderFile diff --git a/opencascade/Aspect_XRActionSet.hxx b/opencascade/Aspect_XRActionSet.hxx index d854dfb61..736b24e2c 100644 --- a/opencascade/Aspect_XRActionSet.hxx +++ b/opencascade/Aspect_XRActionSet.hxx @@ -31,13 +31,17 @@ public: void SetRawHandle(uint64_t theHande) { myRawHandle = theHande; } //! Add action. - void AddAction(const Handle(Aspect_XRAction)& theAction) + void AddAction(const occ::handle& theAction) { myActions.Add(theAction->Id(), theAction); } //! Return map of actions. - const Aspect_XRActionMap& Actions() const { return myActions; } + const NCollection_IndexedDataMap>& Actions() + const + { + return myActions; + } //! Main constructor. Aspect_XRActionSet(const TCollection_AsciiString& theId) @@ -49,10 +53,8 @@ public: protected: TCollection_AsciiString myId; //!< action set id uint64_t myRawHandle; //!< action set handle - Aspect_XRActionMap myActions; //!< map of actions + NCollection_IndexedDataMap> + myActions; //!< map of actions }; -typedef NCollection_IndexedDataMap - Aspect_XRActionSetMap; - #endif // _Aspect_XRActionSet_HeaderFile diff --git a/opencascade/Aspect_XRSession.hxx b/opencascade/Aspect_XRSession.hxx index db208742a..f241ef9c5 100644 --- a/opencascade/Aspect_XRSession.hxx +++ b/opencascade/Aspect_XRSession.hxx @@ -98,23 +98,23 @@ public: Aspect_Eye theEye) = 0; //! Return unit scale factor defined as scale factor for m (meters); 1.0 by default. - Standard_Real UnitFactor() const { return myUnitFactor; } + double UnitFactor() const { return myUnitFactor; } //! Set unit scale factor. - void SetUnitFactor(Standard_Real theFactor) { myUnitFactor = theFactor; } + void SetUnitFactor(double theFactor) { myUnitFactor = theFactor; } //! Return aspect ratio. - Standard_Real Aspect() const { return myAspect; } + double Aspect() const { return myAspect; } //! Return field of view. - Standard_Real FieldOfView() const { return myFieldOfView; } + double FieldOfView() const { return myFieldOfView; } //! Return Intra-ocular Distance (IOD); also known as Interpupillary Distance (IPD). //! Defined in meters by default (@sa UnitFactor()). - Standard_Real IOD() const { return myIod; } + double IOD() const { return myIod; } //! Return display frequency or 0 if unknown. - Standard_ShortReal DisplayFrequency() const { return myDispFreq; } + float DisplayFrequency() const { return myDispFreq; } //! Return projection frustum. //! @sa HasProjectionFrustums(). @@ -133,35 +133,35 @@ public: //! Return left hand orientation. gp_Trsf LeftHandPose() const { - const Standard_Integer aDevice = NamedTrackedDevice(Aspect_XRTrackedDeviceRole_LeftHand); + const int aDevice = NamedTrackedDevice(Aspect_XRTrackedDeviceRole_LeftHand); return aDevice != -1 ? myTrackedPoses[aDevice].Orientation : gp_Trsf(); } //! Return right hand orientation. gp_Trsf RightHandPose() const { - const Standard_Integer aDevice = NamedTrackedDevice(Aspect_XRTrackedDeviceRole_RightHand); + const int aDevice = NamedTrackedDevice(Aspect_XRTrackedDeviceRole_RightHand); return aDevice != -1 ? myTrackedPoses[aDevice].Orientation : gp_Trsf(); } //! Return number of tracked poses array. - const Aspect_TrackedDevicePoseArray& TrackedPoses() const { return myTrackedPoses; } - - //! Return TRUE if device orientation is defined. - bool HasTrackedPose(Standard_Integer theDevice) const + const NCollection_Array1& TrackedPoses() const { - return myTrackedPoses[theDevice].IsValidPose; + return myTrackedPoses; } + //! Return TRUE if device orientation is defined. + bool HasTrackedPose(int theDevice) const { return myTrackedPoses[theDevice].IsValidPose; } + //! Return index of tracked device of known role, or -1 if undefined. - virtual Standard_Integer NamedTrackedDevice(Aspect_XRTrackedDeviceRole theDevice) const = 0; + virtual int NamedTrackedDevice(Aspect_XRTrackedDeviceRole theDevice) const = 0; //! Load model for displaying device. //! @param[in] theDevice device index //! @param[out] theTexture texture source //! @return model triangulation or NULL if not found - Handle(Graphic3d_ArrayOfTriangles) LoadRenderModel(Standard_Integer theDevice, - Handle(Image_Texture)& theTexture) + occ::handle LoadRenderModel(int theDevice, + occ::handle& theTexture) { return loadRenderModel(theDevice, true, theTexture); } @@ -171,9 +171,9 @@ public: //! @param[in] theToApplyUnitFactor flag to apply unit scale factor //! @param[out] theTexture texture source //! @return model triangulation or NULL if not found - Handle(Graphic3d_ArrayOfTriangles) LoadRenderModel(Standard_Integer theDevice, - Standard_Boolean theToApplyUnitFactor, - Handle(Image_Texture)& theTexture) + occ::handle LoadRenderModel(int theDevice, + bool theToApplyUnitFactor, + occ::handle& theTexture) { return loadRenderModel(theDevice, theToApplyUnitFactor, theTexture); } @@ -181,25 +181,25 @@ public: //! Fetch data for digital input action (like button). //! @param[in] theAction action of Aspect_XRActionType_InputDigital type virtual Aspect_XRDigitalActionData GetDigitalActionData( - const Handle(Aspect_XRAction)& theAction) const = 0; + const occ::handle& theAction) const = 0; //! Fetch data for digital input action (like axis). //! @param[in] theAction action of Aspect_XRActionType_InputAnalog type virtual Aspect_XRAnalogActionData GetAnalogActionData( - const Handle(Aspect_XRAction)& theAction) const = 0; + const occ::handle& theAction) const = 0; //! Fetch data for pose input action (like fingertip position). //! The returned values will match the values returned by the last call to WaitPoses(). //! @param[in] theAction action of Aspect_XRActionType_InputPose type virtual Aspect_XRPoseActionData GetPoseActionDataForNextFrame( - const Handle(Aspect_XRAction)& theAction) const = 0; + const occ::handle& theAction) const = 0; //! Trigger vibration. - Standard_EXPORT void TriggerHapticVibrationAction(const Handle(Aspect_XRAction)& theAction, - const Aspect_XRHapticActionData& theParams); + Standard_EXPORT void TriggerHapticVibrationAction(const occ::handle& theAction, + const Aspect_XRHapticActionData& theParams); //! Abort vibration. - Standard_EXPORT void AbortHapticVibrationAction(const Handle(Aspect_XRAction)& theAction); + Standard_EXPORT void AbortHapticVibrationAction(const occ::handle& theAction); //! Return tracking origin. TrackingUniverseOrigin TrackingOrigin() const { return myTrackOrigin; } @@ -208,10 +208,10 @@ public: virtual void SetTrackingOrigin(TrackingUniverseOrigin theOrigin) { myTrackOrigin = theOrigin; } //! Return generic action for specific hand or NULL if undefined. - const Handle(Aspect_XRAction)& GenericAction(Aspect_XRTrackedDeviceRole theDevice, - Aspect_XRGenericAction theAction) const + const occ::handle& GenericAction(Aspect_XRTrackedDeviceRole theDevice, + Aspect_XRGenericAction theAction) const { - const NCollection_Array1& anActions = myRoleActions[theDevice]; + const NCollection_Array1>& anActions = myRoleActions[theDevice]; return anActions[theAction]; } @@ -237,31 +237,32 @@ protected: //! @param[in] theToApplyUnitFactor flag to apply unit scale factor //! @param[out] theTexture texture source //! @return model triangulation or NULL if not found - virtual Handle(Graphic3d_ArrayOfTriangles) loadRenderModel(Standard_Integer theDevice, - Standard_Boolean theToApplyUnitFactor, - Handle(Image_Texture)& theTexture) = 0; + virtual occ::handle loadRenderModel( + int theDevice, + bool theToApplyUnitFactor, + occ::handle& theTexture) = 0; //! Trigger vibration. - virtual void triggerHapticVibrationAction(const Handle(Aspect_XRAction)& theAction, - const Aspect_XRHapticActionData& theParams) = 0; + virtual void triggerHapticVibrationAction(const occ::handle& theAction, + const Aspect_XRHapticActionData& theParams) = 0; protected: - NCollection_Array1 + NCollection_Array1> // clang-format off myRoleActions[Aspect_XRTrackedDeviceRole_NB]; //!< generic actions - Aspect_XRActionSetMap myActionSets; //!< actions sets + NCollection_IndexedDataMap> myActionSets; //!< actions sets TrackingUniverseOrigin myTrackOrigin; //!< tracking origin - Aspect_TrackedDevicePoseArray myTrackedPoses; //!< array of tracked poses + NCollection_Array1 myTrackedPoses; //!< array of tracked poses gp_Trsf myHeadPose; //!< head orientation NCollection_Vec2 myRendSize; //!< viewport Width x Height for rendering into VR Aspect_FrustumLRBT myFrustumL; //!< left eye projection frustum Aspect_FrustumLRBT myFrustumR; //!< right eye projection frustum - Standard_Real myUnitFactor; //!< unit scale factor defined as scale factor for m (meters) + double myUnitFactor; //!< unit scale factor defined as scale factor for m (meters) // clang-format on - Standard_Real myAspect; //!< aspect ratio - Standard_Real myFieldOfView; //!< field of view - Standard_Real myIod; //!< intra-ocular distance in meters - Standard_ShortReal myDispFreq; //!< display frequency + double myAspect; //!< aspect ratio + double myFieldOfView; //!< field of view + double myIod; //!< intra-ocular distance in meters + float myDispFreq; //!< display frequency }; #endif // _Aspect_XRSession_HeaderFile diff --git a/opencascade/BOPAlgo_Algo.hxx b/opencascade/BOPAlgo_Algo.hxx index b77ae5c9b..46a9f484b 100644 --- a/opencascade/BOPAlgo_Algo.hxx +++ b/opencascade/BOPAlgo_Algo.hxx @@ -22,13 +22,13 @@ #include #include #include -#include +#include #include class BOPAlgo_PISteps; -//! The class provides the root interface for the algorithms in Boolean Component.
+//! The class provides the root interface for the algorithms in Boolean Component. class BOPAlgo_Algo : public BOPAlgo_Options { public: @@ -42,9 +42,9 @@ public: protected: //! Default constructor Standard_EXPORT BOPAlgo_Algo(); - Standard_EXPORT virtual ~BOPAlgo_Algo(); + Standard_EXPORT ~BOPAlgo_Algo() override; - Standard_EXPORT BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_Algo(const occ::handle& theAllocator); //! Checks input data Standard_EXPORT virtual void CheckData(); @@ -55,21 +55,20 @@ protected: protected: //! @name Analyzing operations to fill progress indicator //! Analyze progress steps of the whole operation. //! @param theWhole - sum of progress of all operations. - //! @oaram theSteps - steps of the operations supported by PI + //! @param theSteps - steps of the operations supported by PI //! //! To use this method, one has to override the following methods: //! * fillPIConstants - method filling values for constant operations. //! * fillPISteps - method filling steps for the rest of operations. - Standard_EXPORT void analyzeProgress(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const; + Standard_EXPORT void analyzeProgress(const double theWhole, BOPAlgo_PISteps& theSteps) const; //! Fills the values for constant operations - the operations having constant relative running //! time. //! @param theWhole - sum of all operations supported by PI, i.e. the value to normalize the steps //! to, if necessary. //! @param theSteps - steps of the operations supported by PI - Standard_EXPORT virtual void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const; + Standard_EXPORT virtual void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const; //! Fills the values for the operations dependent on the inputs. //! Filled values may not be normalized to represent percentage of total running time. @@ -99,7 +98,7 @@ public: private: //! Disable the range enabled method - virtual void Perform(const Message_ProgressRange& /*theRange*/ = Message_ProgressRange()) {}; + void Perform(const Message_ProgressRange& /*theRange*/ = Message_ProgressRange()) override {}; protected: Message_ProgressRange myProgressRange; @@ -111,20 +110,20 @@ class BOPAlgo_PISteps { public: //! Constructor - BOPAlgo_PISteps(const Standard_Integer theNbOp) + BOPAlgo_PISteps(const int theNbOp) : mySteps(0, theNbOp - 1) { mySteps.Init(0); } //! Returns the steps - const TColStd_Array1OfReal& Steps() const { return mySteps; } + const NCollection_Array1& Steps() const { return mySteps; } //! Returns modifiable steps - TColStd_Array1OfReal& ChangeSteps() { return mySteps; } + NCollection_Array1& ChangeSteps() { return mySteps; } //! Assign the value theStep to theOperation - void SetStep(const Standard_Integer theOperation, const Standard_Real theStep) + void SetStep(const int theOperation, const double theStep) { if (theOperation >= mySteps.Lower() && theOperation <= mySteps.Upper()) { @@ -133,7 +132,7 @@ public: } //! Returns the step assigned to the operation - Standard_Real GetStep(const Standard_Integer theOperation) + double GetStep(const int theOperation) { if (theOperation < mySteps.Lower() || theOperation > mySteps.Upper()) { @@ -143,7 +142,7 @@ public: } protected: - TColStd_Array1OfReal mySteps; + NCollection_Array1 mySteps; }; #endif // _BOPAlgo_Algo_HeaderFile diff --git a/opencascade/BOPAlgo_ArgumentAnalyzer.hxx b/opencascade/BOPAlgo_ArgumentAnalyzer.hxx index 4ef2ca5b2..831630310 100644 --- a/opencascade/BOPAlgo_ArgumentAnalyzer.hxx +++ b/opencascade/BOPAlgo_ArgumentAnalyzer.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include //! check the validity of argument(s) for Boolean Operations @@ -34,7 +34,7 @@ public: //! empty constructor Standard_EXPORT BOPAlgo_ArgumentAnalyzer(); - Standard_EXPORT virtual ~BOPAlgo_ArgumentAnalyzer(); + Standard_EXPORT ~BOPAlgo_ArgumentAnalyzer() override; //! sets object shape Standard_EXPORT void SetShape1(const TopoDS_Shape& TheShape); @@ -52,52 +52,53 @@ public: Standard_EXPORT BOPAlgo_Operation& OperationType(); //! returns ref - Standard_EXPORT Standard_Boolean& StopOnFirstFaulty(); + Standard_EXPORT bool& StopOnFirstFaulty(); //! Returns (modifiable) mode //! that means checking types of shapes. - Standard_Boolean& ArgumentTypeMode(); + bool& ArgumentTypeMode(); //! Returns (modifiable) mode that means //! checking of self-intersection of shapes. - Standard_Boolean& SelfInterMode(); + bool& SelfInterMode(); //! Returns (modifiable) mode that means //! checking of small edges. - Standard_Boolean& SmallEdgeMode(); + bool& SmallEdgeMode(); //! Returns (modifiable) mode that means //! checking of possibility to split or rebuild faces. - Standard_Boolean& RebuildFaceMode(); + bool& RebuildFaceMode(); //! Returns (modifiable) mode that means //! checking of tangency between subshapes. - Standard_Boolean& TangentMode(); + bool& TangentMode(); //! Returns (modifiable) mode that means //! checking of problem of merging vertices. - Standard_Boolean& MergeVertexMode(); + bool& MergeVertexMode(); //! Returns (modifiable) mode that means //! checking of problem of merging edges. - Standard_Boolean& MergeEdgeMode(); + bool& MergeEdgeMode(); //! Returns (modifiable) mode that means //! checking of problem of continuity of the shape. - Standard_Boolean& ContinuityMode(); + bool& ContinuityMode(); //! Returns (modifiable) mode that means //! checking of problem of invalid curve on surface. - Standard_Boolean& CurveOnSurfaceMode(); + bool& CurveOnSurfaceMode(); //! performs analysis - Standard_EXPORT void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()); + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! result of test - Standard_EXPORT Standard_Boolean HasFaulty() const; + Standard_EXPORT bool HasFaulty() const; //! returns a result of test - Standard_EXPORT const BOPAlgo_ListOfCheckResult& GetCheckResult() const; + Standard_EXPORT const NCollection_List& GetCheckResult() const; protected: //! Prepares data; @@ -124,22 +125,22 @@ protected: Standard_EXPORT void TestCurveOnSurface(); private: - TopoDS_Shape myShape1; - TopoDS_Shape myShape2; - Standard_Boolean myStopOnFirst; - BOPAlgo_Operation myOperation; - Standard_Boolean myArgumentTypeMode; - Standard_Boolean mySelfInterMode; - Standard_Boolean mySmallEdgeMode; - Standard_Boolean myRebuildFaceMode; - Standard_Boolean myTangentMode; - Standard_Boolean myMergeVertexMode; - Standard_Boolean myMergeEdgeMode; - Standard_Boolean myContinuityMode; - Standard_Boolean myCurveOnSurfaceMode; - Standard_Boolean myEmpty1; - Standard_Boolean myEmpty2; - BOPAlgo_ListOfCheckResult myResult; + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; + bool myStopOnFirst; + BOPAlgo_Operation myOperation; + bool myArgumentTypeMode; + bool mySelfInterMode; + bool mySmallEdgeMode; + bool myRebuildFaceMode; + bool myTangentMode; + bool myMergeVertexMode; + bool myMergeEdgeMode; + bool myContinuityMode; + bool myCurveOnSurfaceMode; + bool myEmpty1; + bool myEmpty2; + NCollection_List myResult; }; #include diff --git a/opencascade/BOPAlgo_ArgumentAnalyzer.lxx b/opencascade/BOPAlgo_ArgumentAnalyzer.lxx index 7005d6f28..100847c35 100644 --- a/opencascade/BOPAlgo_ArgumentAnalyzer.lxx +++ b/opencascade/BOPAlgo_ArgumentAnalyzer.lxx @@ -11,52 +11,52 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::ArgumentTypeMode() +inline bool& BOPAlgo_ArgumentAnalyzer::ArgumentTypeMode() { return myArgumentTypeMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::SelfInterMode() +inline bool& BOPAlgo_ArgumentAnalyzer::SelfInterMode() { return mySelfInterMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::SmallEdgeMode() +inline bool& BOPAlgo_ArgumentAnalyzer::SmallEdgeMode() { return mySmallEdgeMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::RebuildFaceMode() +inline bool& BOPAlgo_ArgumentAnalyzer::RebuildFaceMode() { return myRebuildFaceMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::TangentMode() +inline bool& BOPAlgo_ArgumentAnalyzer::TangentMode() { return myTangentMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::MergeVertexMode() +inline bool& BOPAlgo_ArgumentAnalyzer::MergeVertexMode() { return myMergeVertexMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::MergeEdgeMode() +inline bool& BOPAlgo_ArgumentAnalyzer::MergeEdgeMode() { return myMergeEdgeMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::ContinuityMode() +inline bool& BOPAlgo_ArgumentAnalyzer::ContinuityMode() { return myContinuityMode; } -inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode() +inline bool& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode() { return myCurveOnSurfaceMode; } -// inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::MergeFaceMode() +// inline bool& BOPAlgo_ArgumentAnalyzer::MergeFaceMode() // { // return myMergeFaceMode; // } diff --git a/opencascade/BOPAlgo_BOP.hxx b/opencascade/BOPAlgo_BOP.hxx index f0f9f617f..261c828f4 100644 --- a/opencascade/BOPAlgo_BOP.hxx +++ b/opencascade/BOPAlgo_BOP.hxx @@ -28,25 +28,25 @@ class BOPAlgo_PaveFiller; //! //! The class represents the Building part of the Boolean Operations -//! algorithm.
+//! algorithm. //! The arguments of the algorithms are divided in two groups - *Objects* -//! and *Tools*.
+//! and *Tools*. //! The algorithm builds the splits of the given arguments using the intersection -//! results and combines the result of Boolean Operation of given type:
-//! - *FUSE* - union of two groups of objects;
-//! - *COMMON* - intersection of two groups of objects;
-//! - *CUT* - subtraction of one group from the other.
+//! results and combines the result of Boolean Operation of given type: +//! - *FUSE* - union of two groups of objects; +//! - *COMMON* - intersection of two groups of objects; +//! - *CUT* - subtraction of one group from the other. //! -//! The rules for the arguments and type of the operation are the following:
-//! - For Boolean operation *FUSE* all arguments should have equal dimensions;
+//! The rules for the arguments and type of the operation are the following: +//! - For Boolean operation *FUSE* all arguments should have equal dimensions; //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be -//! less than the maximal dimension of *Objects*;
-//! - For Boolean operation *COMMON* the arguments can have any dimension.
+//! less than the maximal dimension of *Objects*; +//! - For Boolean operation *COMMON* the arguments can have any dimension. //! //! The class is a General Fuse based algorithm. Thus, all options //! of the General Fuse algorithm such as Fuzzy mode, safe processing mode, //! parallel processing mode, gluing mode and history support are also -//! available in this algorithm.
+//! available in this algorithm. //! //! Additionally to the Warnings of the parent class the algorithm returns //! the following warnings: @@ -67,30 +67,29 @@ public: //! Empty constructor Standard_EXPORT BOPAlgo_BOP(); - Standard_EXPORT virtual ~BOPAlgo_BOP(); + Standard_EXPORT ~BOPAlgo_BOP() override; - Standard_EXPORT BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_BOP(const occ::handle& theAllocator); //! Clears internal fields and arguments - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; Standard_EXPORT void SetOperation(const BOPAlgo_Operation theOperation); Standard_EXPORT BOPAlgo_Operation Operation() const; - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; protected: - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Performs calculations using prepared Filler //! object - Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF, - const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformInternal1(const BOPAlgo_PaveFiller& thePF, + const Message_ProgressRange& theRange) override; - Standard_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType) Standard_OVERRIDE; + Standard_EXPORT void BuildResult(const TopAbs_ShapeEnum theType) override; Standard_EXPORT void BuildShape(const Message_ProgressRange& theRange); @@ -98,16 +97,16 @@ protected: Standard_EXPORT void BuildSolid(const Message_ProgressRange& theRange); - //! Treatment of the cases with empty shapes.
+ //! Treatment of the cases with empty shapes. //! It returns TRUE if there is nothing to do, i.e. //! all shapes in one of the groups are empty shapes. - Standard_EXPORT Standard_Boolean TreatEmptyShape(); + Standard_EXPORT bool TreatEmptyShape(); //! Checks if the arguments of Boolean Operation on solids //! contain any open solids, for which the building of the splits //! has failed. In case of positive check, run different procedure //! for building the result shape. - Standard_EXPORT virtual Standard_Boolean CheckArgsForOpenSolid(); + Standard_EXPORT virtual bool CheckArgsForOpenSolid(); protected: //! Extend list of operations to be supported by the Progress Indicator @@ -118,12 +117,12 @@ protected: }; //! Fill PI steps - Standard_EXPORT virtual void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const override; protected: BOPAlgo_Operation myOperation; - Standard_Integer myDims[2]; + int myDims[2]; TopoDS_Shape myRC; }; diff --git a/opencascade/BOPAlgo_Builder.hxx b/opencascade/BOPAlgo_Builder.hxx index 1bec334a7..0f2cb9a0d 100644 --- a/opencascade/BOPAlgo_Builder.hxx +++ b/opencascade/BOPAlgo_Builder.hxx @@ -30,10 +30,11 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include class IntTools_Context; class TopoDS_Shape; @@ -42,16 +43,16 @@ class TopoDS_Shape; //! The class is a General Fuse algorithm - base algorithm for the //! algorithms in the Boolean Component. Its main purpose is to build //! the split parts of the argument shapes from which the result of -//! the operations is combined.
+//! the operations is combined. //! The result of the General Fuse algorithm itself is a compound -//! containing all split parts of the arguments.
+//! containing all split parts of the arguments. //! //! Additionally to the options of the base classes, the algorithm has -//! the following options:
+//! the following options: //! - *Safe processing mode* - allows to avoid modification of the input -//! shapes during the operation (by default it is off);
+//! shapes during the operation (by default it is off); //! - *Gluing options* - allows to speed up the calculation of the intersections -//! on the special cases, in which some sub-shapes are coinciding.
+//! on the special cases, in which some sub-shapes are coinciding. //! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids //! for inverted status (holes in the space). The default value is TRUE, //! i.e. the check is performed. Setting this flag to FALSE for inverted @@ -78,12 +79,12 @@ public: //! Empty constructor. Standard_EXPORT BOPAlgo_Builder(); - Standard_EXPORT virtual ~BOPAlgo_Builder(); + Standard_EXPORT ~BOPAlgo_Builder() override; - Standard_EXPORT BOPAlgo_Builder(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_Builder(const occ::handle& theAllocator); //! Clears the content of the algorithm. - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; //! Returns the PaveFiller, algorithm for sub-shapes intersection. BOPAlgo_PPaveFiller PPaveFiller() { return myPaveFiller; } @@ -92,17 +93,17 @@ public: BOPDS_PDS PDS() { return myDS; } //! Returns the Context, tool for cashing heavy algorithms. - Handle(IntTools_Context) Context() const { return myContext; } + occ::handle Context() const { return myContext; } public: //! @name Arguments //! Adds the argument to the operation. Standard_EXPORT virtual void AddArgument(const TopoDS_Shape& theShape); //! Sets the list of arguments for the operation. - Standard_EXPORT virtual void SetArguments(const TopTools_ListOfShape& theLS); + Standard_EXPORT virtual void SetArguments(const NCollection_List& theLS); //! Returns the list of arguments. - const TopTools_ListOfShape& Arguments() const { return myArguments; } + const NCollection_List& Arguments() const { return myArguments; } public: //! @name Options //! Sets the flag that defines the mode of treatment. @@ -111,12 +112,12 @@ public: //! @name Options //! This flag is taken into account if internal PaveFiller is used only. //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller //! is in force. - void SetNonDestructive(const Standard_Boolean theFlag) { myNonDestructive = theFlag; } + void SetNonDestructive(const bool theFlag) { myNonDestructive = theFlag; } //! Returns the flag that defines the mode of treatment. //! In non-destructive mode the argument shapes are not modified. Instead //! a copy of a sub-shape is created in the result if it is needed to be updated. - Standard_Boolean NonDestructive() const { return myNonDestructive; } + bool NonDestructive() const { return myNonDestructive; } //! Sets the glue option for the algorithm void SetGlue(const BOPAlgo_GlueEnum theGlue) { myGlue = theGlue; } @@ -125,17 +126,17 @@ public: //! @name Options BOPAlgo_GlueEnum Glue() const { return myGlue; } //! Enables/Disables the check of the input solids for inverted status - void SetCheckInverted(const Standard_Boolean theCheck) { myCheckInverted = theCheck; } + void SetCheckInverted(const bool theCheck) { myCheckInverted = theCheck; } //! Returns the flag defining whether the check for input solids on inverted status //! should be performed or not. - Standard_Boolean CheckInverted() const { return myCheckInverted; } + bool CheckInverted() const { return myCheckInverted; } public: //! @name Performing the operation //! Performs the operation. //! The intersection will be performed also. - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Performs the operation with the prepared filler. //! The intersection will not be performed in this case. @@ -183,12 +184,12 @@ public: //! @name BOPs on open solids //! @param theTools - The group of Tools for BOP; //! @param theToolsState - State for tools faces to pass into result; //! @param theReport - The alternative report to avoid pollution of the main one. - Standard_EXPORT virtual void BuildBOP(const TopTools_ListOfShape& theObjects, - const TopAbs_State theObjState, - const TopTools_ListOfShape& theTools, - const TopAbs_State theToolsState, - const Message_ProgressRange& theRange, - Handle(Message_Report) theReport = NULL); + Standard_EXPORT virtual void BuildBOP(const NCollection_List& theObjects, + const TopAbs_State theObjState, + const NCollection_List& theTools, + const TopAbs_State theToolsState, + const Message_ProgressRange& theRange, + occ::handle theReport = nullptr); //! Builds the result of Boolean operation of given type //! basing on the result of Builder operation (GF or any other). @@ -210,11 +211,11 @@ public: //! @name BOPs on open solids //! @param theOperation - The BOP type; //! @param theRange - The parameter to progressIndicator //! @param theReport - The alternative report to avoid pollution of the global one. - void BuildBOP(const TopTools_ListOfShape& theObjects, - const TopTools_ListOfShape& theTools, - const BOPAlgo_Operation theOperation, - const Message_ProgressRange& theRange, - Handle(Message_Report) theReport = NULL) + void BuildBOP(const NCollection_List& theObjects, + const NCollection_List& theTools, + const BOPAlgo_Operation theOperation, + const Message_ProgressRange& theRange, + occ::handle theReport = nullptr) { TopAbs_State anObjState, aToolsState; switch (theOperation) @@ -269,23 +270,36 @@ protected: //! @name History methods //! The General Fuse operation does not perform any other modification than splitting the input //! shapes basing on their intersection information. This information is contained in myImages //! map. Thus, here the method returns only splits (if any) contained in this map. - Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS); + Standard_EXPORT virtual const NCollection_List* LocModified( + const TopoDS_Shape& theS); //! Returns the list of shapes generated from the shape theS. //! Similarly to *LocModified* must be redefined for specific operations, //! obtaining Generated elements differently. - Standard_EXPORT virtual const TopTools_ListOfShape& LocGenerated(const TopoDS_Shape& theS); + Standard_EXPORT virtual const NCollection_List& LocGenerated( + const TopoDS_Shape& theS); public: //! @name Images/Origins //! Returns the map of images. - const TopTools_DataMapOfShapeListOfShape& Images() const { return myImages; } + const NCollection_DataMap, TopTools_ShapeMapHasher>& + Images() const + { + return myImages; + } //! Returns the map of origins. - const TopTools_DataMapOfShapeListOfShape& Origins() const { return myOrigins; } + const NCollection_DataMap, TopTools_ShapeMapHasher>& + Origins() const + { + return myOrigins; + } //! Returns the map of Same Domain (SD) shapes - coinciding shapes //! from different arguments. - const TopTools_DataMapOfShapeShape& ShapesSD() const { return myShapesSD; } + const NCollection_DataMap& ShapesSD() const + { + return myShapesSD; + } protected: //! @name Analyze progress of the operation //! List of operations to be supported by the Progress Indicator @@ -311,46 +325,46 @@ protected: //! @name Analyze progress of the operation public: NbShapes() { - for (Standard_Integer i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { myNbShapesArr[i] = 0; } } - Standard_Integer NbVertices() const { return myNbShapesArr[0]; } + int NbVertices() const { return myNbShapesArr[0]; } - Standard_Integer NbEdges() const { return myNbShapesArr[1]; } + int NbEdges() const { return myNbShapesArr[1]; } - Standard_Integer NbWires() const { return myNbShapesArr[2]; } + int NbWires() const { return myNbShapesArr[2]; } - Standard_Integer NbFaces() const { return myNbShapesArr[3]; } + int NbFaces() const { return myNbShapesArr[3]; } - Standard_Integer NbShells() const { return myNbShapesArr[4]; } + int NbShells() const { return myNbShapesArr[4]; } - Standard_Integer NbSolids() const { return myNbShapesArr[5]; } + int NbSolids() const { return myNbShapesArr[5]; } - Standard_Integer NbCompsolids() const { return myNbShapesArr[6]; } + int NbCompsolids() const { return myNbShapesArr[6]; } - Standard_Integer NbCompounds() const { return myNbShapesArr[7]; } + int NbCompounds() const { return myNbShapesArr[7]; } - Standard_Integer& NbVertices() { return myNbShapesArr[0]; } + int& NbVertices() { return myNbShapesArr[0]; } - Standard_Integer& NbEdges() { return myNbShapesArr[1]; } + int& NbEdges() { return myNbShapesArr[1]; } - Standard_Integer& NbWires() { return myNbShapesArr[2]; } + int& NbWires() { return myNbShapesArr[2]; } - Standard_Integer& NbFaces() { return myNbShapesArr[3]; } + int& NbFaces() { return myNbShapesArr[3]; } - Standard_Integer& NbShells() { return myNbShapesArr[4]; } + int& NbShells() { return myNbShapesArr[4]; } - Standard_Integer& NbSolids() { return myNbShapesArr[5]; } + int& NbSolids() { return myNbShapesArr[5]; } - Standard_Integer& NbCompsolids() { return myNbShapesArr[6]; } + int& NbCompsolids() { return myNbShapesArr[6]; } - Standard_Integer& NbCompounds() { return myNbShapesArr[7]; } + int& NbCompounds() { return myNbShapesArr[7]; } private: - Standard_Integer myNbShapesArr[8]; + int myNbShapesArr[8]; }; protected: @@ -358,11 +372,11 @@ protected: Standard_EXPORT NbShapes getNbShapes() const; //! Filling steps for constant operations - Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const override; //! Filling steps for all other operations - Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const override; protected: //! @name Methods for building the result //! Performs the building of the result. @@ -383,7 +397,7 @@ protected: //! @name Methods for building the result protected: //! @name Checking input arguments //! Checks the input data. - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Checks if the intersection algorithm has Errors/Warnings. Standard_EXPORT void CheckFiller(); @@ -440,18 +454,20 @@ protected: //! @name Fill Images of SOLIDS //! Builds the draft solid by rebuilding the shells of the solid //! with the splits of faces. - Standard_EXPORT void BuildDraftSolid(const TopoDS_Shape& theSolid, - TopoDS_Shape& theDraftSolid, - TopTools_ListOfShape& theLIF); + Standard_EXPORT void BuildDraftSolid(const TopoDS_Shape& theSolid, + TopoDS_Shape& theDraftSolid, + NCollection_List& theLIF); //! Finds faces located inside each solid. - Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids, - const Message_ProgressRange& theRange); + Standard_EXPORT virtual void FillIn3DParts( + NCollection_DataMap& theDraftSolids, + const Message_ProgressRange& theRange); //! Builds the splits of the solids using their draft versions //! and faces located inside. - Standard_EXPORT void BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids, - const Message_ProgressRange& theRange); + Standard_EXPORT void BuildSplitSolids( + NCollection_DataMap& theDraftSolids, + const Message_ProgressRange& theRange); //! Classifies the vertices and edges from the arguments relatively //! splits of solids and makes them INTERNAL for solids. @@ -462,7 +478,9 @@ protected: //! @name Fill Images of COMPOUNDS Standard_EXPORT void FillImagesCompounds(const Message_ProgressRange& theRange); //! Builds the image of the given compound. - Standard_EXPORT void FillImagesCompound(const TopoDS_Shape& theS, TopTools_MapOfShape& theMF); + Standard_EXPORT void FillImagesCompound( + const TopoDS_Shape& theS, + NCollection_Map& theMF); protected: //! @name Post treatment //! Post treatment of the result of the operation. @@ -470,21 +488,21 @@ protected: //! @name Post treatment //! and updates the tolerances to make them valid. Standard_EXPORT virtual void PostTreat(const Message_ProgressRange& theRange); -protected: //! @name Fields - TopTools_ListOfShape myArguments; //!< Arguments of the operation +protected: //! @name Fields + NCollection_List myArguments; //!< Arguments of the operation // clang-format off - TopTools_MapOfShape myMapFence; //!< Fence map providing the uniqueness of the shapes in the list of arguments + NCollection_Map myMapFence; //!< Fence map providing the uniqueness of the shapes in the list of arguments BOPAlgo_PPaveFiller myPaveFiller; //!< Pave Filler - algorithm for sub-shapes intersection BOPDS_PDS myDS; //!< Data Structure - holder of intersection information - Handle(IntTools_Context) myContext; //!< Context - tool for cashing heavy algorithms such as Projectors and Classifiers - Standard_Integer myEntryPoint; //!< EntryPoint - controls the deletion of the PaveFiller, which could live longer than the Builder - TopTools_DataMapOfShapeListOfShape myImages; //!< Images - map of Images of the sub-shapes of arguments - TopTools_DataMapOfShapeShape myShapesSD; //!< ShapesSD - map of SD Shapes - TopTools_DataMapOfShapeListOfShape myOrigins; //!< Origins - map of Origins, back map of Images - TopTools_DataMapOfShapeListOfShape myInParts; //!< InParts - map of own and acquired IN faces of the arguments solids - Standard_Boolean myNonDestructive; //!< Safe processing option allows avoiding modification of the input shapes + occ::handle myContext; //!< Context - tool for cashing heavy algorithms such as Projectors and Classifiers + int myEntryPoint; //!< EntryPoint - controls the deletion of the PaveFiller, which could live longer than the Builder + NCollection_DataMap, TopTools_ShapeMapHasher> myImages; //!< Images - map of Images of the sub-shapes of arguments + NCollection_DataMap myShapesSD; //!< ShapesSD - map of SD Shapes + NCollection_DataMap, TopTools_ShapeMapHasher> myOrigins; //!< Origins - map of Origins, back map of Images + NCollection_DataMap, TopTools_ShapeMapHasher> myInParts; //!< InParts - map of own and acquired IN faces of the arguments solids + bool myNonDestructive; //!< Safe processing option allows avoiding modification of the input shapes BOPAlgo_GlueEnum myGlue; //!< Gluing option allows speeding up the intersection of the input shapes - Standard_Boolean myCheckInverted; //!< Check inverted option allows disabling the check of input solids on inverted status + bool myCheckInverted; //!< Check inverted option allows disabling the check of input solids on inverted status // clang-format on }; diff --git a/opencascade/BOPAlgo_BuilderArea.hxx b/opencascade/BOPAlgo_BuilderArea.hxx index e1194ea39..8757b2764 100644 --- a/opencascade/BOPAlgo_BuilderArea.hxx +++ b/opencascade/BOPAlgo_BuilderArea.hxx @@ -24,8 +24,9 @@ #include #include -#include -#include +#include +#include +#include class IntTools_Context; //! The root class for algorithms to build @@ -36,35 +37,35 @@ public: DEFINE_STANDARD_ALLOC //! Sets the context for the algorithms - void SetContext(const Handle(IntTools_Context)& theContext) { myContext = theContext; } + void SetContext(const occ::handle& theContext) { myContext = theContext; } //! Returns the input shapes - const TopTools_ListOfShape& Shapes() const { return myShapes; } + const NCollection_List& Shapes() const { return myShapes; } //! Sets the shapes for building areas - void SetShapes(const TopTools_ListOfShape& theLS) { myShapes = theLS; } + void SetShapes(const NCollection_List& theLS) { myShapes = theLS; } //! Returns the found loops - const TopTools_ListOfShape& Loops() const { return myLoops; } + const NCollection_List& Loops() const { return myLoops; } //! Returns the found areas - const TopTools_ListOfShape& Areas() const { return myAreas; } + const NCollection_List& Areas() const { return myAreas; } //! Defines the preventing of addition of internal parts into result. //! The default value is FALSE, i.e. the internal parts are added into result. - void SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal) + void SetAvoidInternalShapes(const bool theAvoidInternal) { myAvoidInternalShapes = theAvoidInternal; } //! Returns the AvoidInternalShapes flag - Standard_Boolean IsAvoidInternalShapes() const { return myAvoidInternalShapes; } + bool IsAvoidInternalShapes() const { return myAvoidInternalShapes; } protected: Standard_EXPORT BOPAlgo_BuilderArea(); - Standard_EXPORT virtual ~BOPAlgo_BuilderArea(); + Standard_EXPORT ~BOPAlgo_BuilderArea() override; - Standard_EXPORT BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_BuilderArea(const occ::handle& theAllocator); virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange) = 0; @@ -74,15 +75,13 @@ protected: virtual void PerformInternalShapes(const Message_ProgressRange& theRange) = 0; - Handle(IntTools_Context) myContext; - TopTools_ListOfShape myShapes; - TopTools_ListOfShape myLoops; - TopTools_ListOfShape myLoopsInternal; - TopTools_ListOfShape myAreas; - TopTools_IndexedMapOfOrientedShape myShapesToAvoid; - Standard_Boolean myAvoidInternalShapes; - -private: + occ::handle myContext; + NCollection_List myShapes; + NCollection_List myLoops; + NCollection_List myLoopsInternal; + NCollection_List myAreas; + NCollection_IndexedMap myShapesToAvoid; + bool myAvoidInternalShapes; }; #endif // _BOPAlgo_BuilderArea_HeaderFile diff --git a/opencascade/BOPAlgo_BuilderFace.hxx b/opencascade/BOPAlgo_BuilderFace.hxx index 54a953871..8a7eac1b3 100644 --- a/opencascade/BOPAlgo_BuilderFace.hxx +++ b/opencascade/BOPAlgo_BuilderFace.hxx @@ -39,9 +39,9 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT BOPAlgo_BuilderFace(); - Standard_EXPORT virtual ~BOPAlgo_BuilderFace(); + Standard_EXPORT ~BOPAlgo_BuilderFace() override; - Standard_EXPORT BOPAlgo_BuilderFace(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_BuilderFace(const occ::handle& theAllocator); //! Sets the face generatix Standard_EXPORT void SetFace(const TopoDS_Face& theFace); @@ -50,8 +50,8 @@ public: Standard_EXPORT const TopoDS_Face& Face() const; //! Performs the algorithm - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; Standard_EXPORT TopAbs_Orientation Orientation() const; @@ -59,26 +59,22 @@ protected: //! Collect the edges that //! a) are internal //! b) are the same and have different orientation - Standard_EXPORT virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformShapesToAvoid(const Message_ProgressRange& theRange) override; //! Build draft wires //! a)myLoops - draft wires that consist of //! boundary edges //! b)myLoopsInternal - draft wires that contains //! inner edges - Standard_EXPORT virtual void PerformLoops(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformLoops(const Message_ProgressRange& theRange) override; //! Build draft faces that contains boundary edges - Standard_EXPORT virtual void PerformAreas(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformAreas(const Message_ProgressRange& theRange) override; //! Build finalized faces with internals - Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformInternalShapes(const Message_ProgressRange& theRange) override; - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; protected: TopoDS_Face myFace; diff --git a/opencascade/BOPAlgo_BuilderShape.hxx b/opencascade/BOPAlgo_BuilderShape.hxx index 8e8de7f69..39c26cedd 100644 --- a/opencascade/BOPAlgo_BuilderShape.hxx +++ b/opencascade/BOPAlgo_BuilderShape.hxx @@ -27,8 +27,9 @@ #include #include -#include -#include +#include +#include +#include class TopoDS_Shape; //! Root class for algorithms that has shape as result. @@ -48,7 +49,7 @@ public: //! @name Getting the result public: //! @name History methods //! Returns the list of shapes Modified from the shape theS. - const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) + const NCollection_List& Modified(const TopoDS_Shape& theS) { if (myFillHistory && myHistory) return myHistory->Modified(theS); @@ -57,7 +58,7 @@ public: //! @name History methods } //! Returns the list of shapes Generated from the shape theS. - const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) + const NCollection_List& Generated(const TopoDS_Shape& theS) { if (myFillHistory && myHistory) return myHistory->Generated(theS); @@ -68,31 +69,28 @@ public: //! @name History methods //! Returns true if the shape theS has been deleted. //! In this case the shape will have no Modified elements, //! but can have Generated elements. - Standard_Boolean IsDeleted(const TopoDS_Shape& theS) + bool IsDeleted(const TopoDS_Shape& theS) { - return (myFillHistory && myHistory ? myHistory->IsRemoved(theS) : Standard_False); + return (myFillHistory && myHistory ? myHistory->IsRemoved(theS) : false); } //! Returns true if any of the input shapes has been modified during operation. - Standard_Boolean HasModified() const + bool HasModified() const { - return (myFillHistory && myHistory ? myHistory->HasModified() : Standard_False); + return (myFillHistory && myHistory ? myHistory->HasModified() : false); } //! Returns true if any of the input shapes has generated shapes during operation. - Standard_Boolean HasGenerated() const + bool HasGenerated() const { - return (myFillHistory && myHistory ? myHistory->HasGenerated() : Standard_False); + return (myFillHistory && myHistory ? myHistory->HasGenerated() : false); } //! Returns true if any of the input shapes has been deleted during operation. - Standard_Boolean HasDeleted() const - { - return (myFillHistory && myHistory ? myHistory->HasRemoved() : Standard_False); - } + bool HasDeleted() const { return (myFillHistory && myHistory ? myHistory->HasRemoved() : false); } //! History Tool - Handle(BRepTools_History) History() + occ::handle History() { if (myFillHistory) { @@ -108,34 +106,33 @@ public: //! @name History methods // If the History has not been requested to be filled, return the NULL // explicitly as the History may be partially filled for the algorithm's // internal needs. - return NULL; + return nullptr; } public: //! @name Enabling/Disabling the history collection. //! Allows disabling the history collection - void SetToFillHistory(const Standard_Boolean theHistFlag) { myFillHistory = theHistFlag; } + void SetToFillHistory(const bool theHistFlag) { myFillHistory = theHistFlag; } //! Returns flag of history availability - Standard_Boolean HasHistory() const { return myFillHistory; } + bool HasHistory() const { return myFillHistory; } protected: //! @name Constructors //! Empty constructor BOPAlgo_BuilderShape() - : BOPAlgo_Algo(), - myFillHistory(Standard_True) + : myFillHistory(true) { } //! Constructor with allocator - BOPAlgo_BuilderShape(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPAlgo_BuilderShape(const occ::handle& theAllocator) : BOPAlgo_Algo(theAllocator), - myFillHistory(Standard_True) + myFillHistory(true) { } protected: //! @name Clearing //! Clears the content of the algorithm. - virtual void Clear() Standard_OVERRIDE + void Clear() override { BOPAlgo_Algo::Clear(); myHistory.Nullify(); @@ -145,11 +142,12 @@ protected: //! @name Clearing protected: //! @name Fields TopoDS_Shape myShape; //!< Result of the operation - TopTools_ListOfShape myHistShapes; //!< Storer for the history shapes - TopTools_MapOfShape myMapShape; //!< cached map of all arguments shapes + NCollection_List myHistShapes; //!< Storer for the history shapes + NCollection_Map + myMapShape; //!< cached map of all arguments shapes - Standard_Boolean myFillHistory; //!< Controls the history filling - Handle(BRepTools_History) myHistory; //!< History tool + bool myFillHistory; //!< Controls the history filling + occ::handle myHistory; //!< History tool }; #endif // _BOPAlgo_BuilderShape_HeaderFile diff --git a/opencascade/BOPAlgo_BuilderSolid.hxx b/opencascade/BOPAlgo_BuilderSolid.hxx index 2a5b0ce3b..d85bff7b2 100644 --- a/opencascade/BOPAlgo_BuilderSolid.hxx +++ b/opencascade/BOPAlgo_BuilderSolid.hxx @@ -24,7 +24,10 @@ #include #include -#include +#include +#include +#include +#include //! Solid Builder is the algorithm for building solids from set of faces. //! The given faces should be non-intersecting, i.e. all coinciding parts @@ -54,8 +57,8 @@ //! //! Example of usage of the algorithm: //! ~~~~ -//! const TopTools_ListOfShape& aFaces = ...; // Faces to build the solids -//! Standard_Boolean isAvoidInternals = ...; // Flag which defines whether to create the +//! const NCollection_List& aFaces = ...; // Faces to build the solids +//! bool isAvoidInternals = ...; // Flag which defines whether to create the //! internal shells or not BOPAlgo_BuilderSolid aBS; // Solid Builder tool //! aBS.SetShapes(aFaces); // Set the faces //! aBS.SetAvoidInternalShapes(isAvoidInternals); // Set the AvoidInternalShapesFlag @@ -74,7 +77,7 @@ //! aBS.DumpWarnings(aSStream); //! } //! -//! const TopTools_ListOfShape& aSolids = aBS.Areas(); // Obtaining the result solids +//! const NCollection_List& aSolids = aBS.Areas(); // Obtaining the result solids //! ~~~~ //! class BOPAlgo_BuilderSolid : public BOPAlgo_BuilderArea @@ -85,20 +88,23 @@ public: public: //! @name Constructors //! Empty constructor Standard_EXPORT BOPAlgo_BuilderSolid(); - Standard_EXPORT virtual ~BOPAlgo_BuilderSolid(); + Standard_EXPORT ~BOPAlgo_BuilderSolid() override; //! Constructor with allocator - Standard_EXPORT BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_BuilderSolid(const occ::handle& theAllocator); public: //! @name Performing the operation //! Performs the construction of the solids from the given faces - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; public: //! @name Getting the bounding boxes of the created solids //! For classification purposes the algorithm builds the bounding boxes //! for all created solids. This method returns the data map of solid - box pairs. - const TopTools_DataMapOfShapeBox& GetBoxesMap() const { return myBoxes; } + const NCollection_DataMap& GetBoxesMap() const + { + return myBoxes; + } protected: //! @name Protected methods performing the operation //! Collect the faces: @@ -106,30 +112,27 @@ protected: //! @name Protected methods performing the operation //! - that are alone but given twice with different orientation. //! These faces will be put into the map *myShapesToAvoid* and will be //! avoided in shells construction, but will be classified later on. - Standard_EXPORT virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformShapesToAvoid(const Message_ProgressRange& theRange) override; //! Build all possible closed shells from the given faces. //! The method fills the following maps: //! - myLoops - Created closed shells; //! - myLoopsInternal - The shells created from unused faces. - Standard_EXPORT virtual void PerformLoops(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformLoops(const Message_ProgressRange& theRange) override; //! Classifies the created shells on the Holes and Growths. //! Creates the solids from the Growths shells. //! Puts the Hole shells into the closest Growths solids. - Standard_EXPORT virtual void PerformAreas(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformAreas(const Message_ProgressRange& theRange) override; //! Classifies the unused faces relatively the created solids. //! Puts the classified faces into the closest solids as internal shells. //! Warns the user about unclassified faces if any. - Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformInternalShapes(const Message_ProgressRange& theRange) override; private: - TopTools_DataMapOfShapeBox myBoxes; // Boxes of the produced solids + NCollection_DataMap + myBoxes; // Boxes of the produced solids }; #endif // _BOPAlgo_BuilderSolid_HeaderFile diff --git a/opencascade/BOPAlgo_CellsBuilder.hxx b/opencascade/BOPAlgo_CellsBuilder.hxx index d706b496c..7261cb43a 100644 --- a/opencascade/BOPAlgo_CellsBuilder.hxx +++ b/opencascade/BOPAlgo_CellsBuilder.hxx @@ -21,11 +21,11 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //! The algorithm is based on the General Fuse algorithm (GFA). //! The result of GFA is all split parts of the Arguments. @@ -100,11 +100,11 @@ //! 1. API //! @code //! BOPAlgo_CellsBuilder aCBuilder; -//! TopTools_ListOfShape aLS = ...; // arguments +//! NCollection_List aLS = ...; // arguments //! // parallel or single mode (the default value is FALSE) //! bool toRunParallel = false; //! // fuzzy option (default value is 0) -//! Standard_Real aTol = 0.0; +//! double aTol = 0.0; //! // //! aCBuilder.SetArguments (aLS); //! aCBuilder.SetRunParallel (toRunParallel); @@ -120,14 +120,15 @@ //! // all split parts //! const TopoDS_Shape& aRes = aCBuilder.GetAllParts(); //! // -//! 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 +//! NCollection_List aLSToTake = ...; // parts of these arguments will be taken into +//! result NCollection_List aLSToAvoid = ...; // parts of these arguments will not be +//! taken into result //! // //! // defines the material common for the cells, //! // i.e. the boundaries between cells with the same material will be removed. //! // By default it is set to 0. //! // Thus, to remove some boundary the value of this variable should not be equal to 0. -//! Standard_Integer iMaterial = ...; +//! int iMaterial = ...; //! // defines whether to update the result right now or not //! bool toUpdate = ...; //! // adding to result @@ -171,51 +172,50 @@ public: Standard_EXPORT BOPAlgo_CellsBuilder(); - Standard_EXPORT BOPAlgo_CellsBuilder(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_CellsBuilder(const occ::handle& theAllocator); - Standard_EXPORT virtual ~BOPAlgo_CellsBuilder(); + Standard_EXPORT ~BOPAlgo_CellsBuilder() override; //! Redefined method Clear - clears the contents. - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; - //! Adding the parts to result.
- //! The parts are defined by two lists of shapes:
- //! defines the arguments which parts should be taken into result;
- //! defines the arguments which parts should not be taken into result;
+ //! Adding the parts to result. + //! The parts are defined by two lists of shapes: + //! defines the arguments which parts should be taken into result; + //! defines the arguments which parts should not be taken into result; //! To be taken into result the part must be IN for all shapes from the list - //! and must be OUT of all shapes from the list .
+ //! and must be OUT of all shapes from the list . //! //! To remove internal boundaries between any cells in the result //! variable should be used. The boundaries between - //! cells with the same material will be removed. Default value is 0.
- //! Thus, to remove any boundary the value of this variable should not be equal to 0.
+ //! cells with the same material will be removed. Default value is 0. + //! Thus, to remove any boundary the value of this variable should not be equal to 0. //! parameter defines whether to remove boundaries now or not. - Standard_EXPORT void AddToResult(const TopTools_ListOfShape& theLSToTake, - const TopTools_ListOfShape& theLSToAvoid, - const Standard_Integer theMaterial = 0, - const Standard_Boolean theUpdate = Standard_False); + Standard_EXPORT void AddToResult(const NCollection_List& theLSToTake, + const NCollection_List& theLSToAvoid, + const int theMaterial = 0, + const bool theUpdate = false); - //! Add all split parts to result.
- //! defines the removal of internal boundaries;
+ //! Add all split parts to result. + //! defines the removal of internal boundaries; //! parameter defines whether to remove boundaries now or not. - Standard_EXPORT void AddAllToResult(const Standard_Integer theMaterial = 0, - const Standard_Boolean theUpdate = Standard_False); + Standard_EXPORT void AddAllToResult(const int theMaterial = 0, const bool theUpdate = false); - //! Removing the parts from result.
- //! The parts are defined by two lists of shapes:
- //! defines the arguments which parts should be removed from result;
- //! defines the arguments which parts should not be removed from result.
+ //! Removing the parts from result. + //! The parts are defined by two lists of shapes: + //! defines the arguments which parts should be removed from result; + //! defines the arguments which parts should not be removed from result. //! To be removed from the result the part must be IN for all shapes from the list //! and must be OUT of all shapes from the list . - Standard_EXPORT void RemoveFromResult(const TopTools_ListOfShape& theLSToTake, - const TopTools_ListOfShape& theLSToAvoid); + Standard_EXPORT void RemoveFromResult(const NCollection_List& theLSToTake, + const NCollection_List& theLSToAvoid); //! Remove all parts from result. Standard_EXPORT void RemoveAllFromResult(); - //! Removes internal boundaries between cells with the same material.
+ //! Removes internal boundaries between cells with the same material. //! If the result contains the cells with same material but of different dimension - //! the removal of internal boundaries between these cells will not be performed.
+ //! the removal of internal boundaries between these cells will not be performed. //! In case of some errors during the removal the method will set the appropriate warning //! status - use GetReport() to access them. Standard_EXPORT void RemoveInternalBoundaries(); @@ -229,37 +229,37 @@ public: protected: //! Prepare information for history support taking into account //! local modification map of unified elements - myMapModified. - Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List* LocModified( + const TopoDS_Shape& theS) override; //! Redefined method PerformInternal1 - makes all split parts, //! nullifies the result , and index all parts. - Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF, - const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformInternal1(const BOPAlgo_PaveFiller& thePF, + const Message_ProgressRange& theRange) override; //! Indexes the parts for quick access to the arguments. Standard_EXPORT void IndexParts(); //! Looking for the parts defined by two lists. - Standard_EXPORT void FindParts(const TopTools_ListOfShape& theLSToTake, - const TopTools_ListOfShape& theLSToAvoid, - TopTools_ListOfShape& theParts); + Standard_EXPORT void FindParts(const NCollection_List& theLSToTake, + const NCollection_List& theLSToAvoid, + NCollection_List& theParts); - //! Removes internal boundaries between cells with the same material.
+ //! Removes internal boundaries between cells with the same material. //! Returns TRUE if any internal boundaries have been removed. - Standard_EXPORT Standard_Boolean - RemoveInternals(const TopTools_ListOfShape& theLS, - TopTools_ListOfShape& theLSNew, - const TopTools_MapOfShape& theMapKeepBnd = TopTools_MapOfShape()); + Standard_EXPORT bool RemoveInternals( + const NCollection_List& theLS, + NCollection_List& theLSNew, + const NCollection_Map& theMapKeepBnd = + NCollection_Map()); // fields TopoDS_Shape myAllParts; //!< All split parts of the arguments // clang-format off - TopTools_IndexedDataMapOfShapeListOfShape myIndex; //!< Connection map from all splits parts to the argument shapes from which they were created - TopTools_DataMapOfIntegerListOfShape myMaterials; //!< Map of assigned materials (material -> list of shape) - TopTools_DataMapOfShapeInteger myShapeMaterial; //!< Map of assigned materials (shape -> material) - TopTools_DataMapOfShapeShape myMapModified; //!< Local modification map to track unification of the splits + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> myIndex; //!< Connection map from all splits parts to the argument shapes from which they were created + NCollection_DataMap> myMaterials; //!< Map of assigned materials (material -> list of shape) + NCollection_DataMap myShapeMaterial; //!< Map of assigned materials (shape -> material) + NCollection_DataMap myMapModified; //!< Local modification map to track unification of the splits // clang-format on }; diff --git a/opencascade/BOPAlgo_CheckResult.hxx b/opencascade/BOPAlgo_CheckResult.hxx index aa57e1bc5..853017825 100644 --- a/opencascade/BOPAlgo_CheckResult.hxx +++ b/opencascade/BOPAlgo_CheckResult.hxx @@ -22,7 +22,7 @@ #include #include -#include +#include //! contains information about faulty shapes and faulty types //! can't be processed by Boolean Operations @@ -53,10 +53,10 @@ public: Standard_EXPORT const TopoDS_Shape& GetShape2() const; //! returns list of faulty shapes for object - Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes1() const; + Standard_EXPORT const NCollection_List& GetFaultyShapes1() const; //! returns list of faulty shapes for tool - Standard_EXPORT const TopTools_ListOfShape& GetFaultyShapes2() const; + Standard_EXPORT const NCollection_List& GetFaultyShapes2() const; //! set status of faulty Standard_EXPORT void SetCheckStatus(const BOPAlgo_CheckStatus TheStatus); @@ -65,40 +65,39 @@ public: Standard_EXPORT BOPAlgo_CheckStatus GetCheckStatus() const; //! Sets max distance for the first shape - Standard_EXPORT void SetMaxDistance1(const Standard_Real theDist); + Standard_EXPORT void SetMaxDistance1(const double theDist); //! Sets max distance for the second shape - Standard_EXPORT void SetMaxDistance2(const Standard_Real theDist); + Standard_EXPORT void SetMaxDistance2(const double theDist); //! Sets the parameter for the first shape - Standard_EXPORT void SetMaxParameter1(const Standard_Real thePar); + Standard_EXPORT void SetMaxParameter1(const double thePar); //! Sets the parameter for the second shape - Standard_EXPORT void SetMaxParameter2(const Standard_Real thePar); + Standard_EXPORT void SetMaxParameter2(const double thePar); //! Returns the distance for the first shape - Standard_EXPORT Standard_Real GetMaxDistance1() const; + Standard_EXPORT double GetMaxDistance1() const; //! Returns the distance for the second shape - Standard_EXPORT Standard_Real GetMaxDistance2() const; + Standard_EXPORT double GetMaxDistance2() const; //! Returns the parameter for the fircst shape - Standard_EXPORT Standard_Real GetMaxParameter1() const; + Standard_EXPORT double GetMaxParameter1() const; //! Returns the parameter for the second shape - Standard_EXPORT Standard_Real GetMaxParameter2() const; + Standard_EXPORT double GetMaxParameter2() const; -protected: private: - TopoDS_Shape myShape1; - TopoDS_Shape myShape2; - BOPAlgo_CheckStatus myStatus; - TopTools_ListOfShape myFaulty1; - TopTools_ListOfShape myFaulty2; - Standard_Real myMaxDist1; - Standard_Real myMaxDist2; - Standard_Real myMaxPar1; - Standard_Real myMaxPar2; + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; + BOPAlgo_CheckStatus myStatus; + NCollection_List myFaulty1; + NCollection_List myFaulty2; + double myMaxDist1; + double myMaxDist2; + double myMaxPar1; + double myMaxPar2; }; #endif // _BOPAlgo_CheckResult_HeaderFile diff --git a/opencascade/BOPAlgo_CheckerSI.hxx b/opencascade/BOPAlgo_CheckerSI.hxx index 97becc041..f7d0f467e 100644 --- a/opencascade/BOPAlgo_CheckerSI.hxx +++ b/opencascade/BOPAlgo_CheckerSI.hxx @@ -39,27 +39,27 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT BOPAlgo_CheckerSI(); - Standard_EXPORT virtual ~BOPAlgo_CheckerSI(); - - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; - - //! Sets the level of checking shape on self-interference.
- //! It defines which interferences will be checked:
- //! 0 - only V/V;
- //! 1 - V/V and V/E;
- //! 2 - V/V, V/E and E/E;
- //! 3 - V/V, V/E, E/E and V/F;
- //! 4 - V/V, V/E, E/E, V/F and E/F;
- //! 5 - V/V, V/E, E/E, V/F, E/F and F/F;
- //! 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;
- //! 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;
- //! 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;
+ Standard_EXPORT ~BOPAlgo_CheckerSI() override; + + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; + + //! Sets the level of checking shape on self-interference. + //! It defines which interferences will be checked: + //! 0 - only V/V; + //! 1 - V/V and V/E; + //! 2 - V/V, V/E and E/E; + //! 3 - V/V, V/E, E/E and V/F; + //! 4 - V/V, V/E, E/E, V/F and E/F; + //! 5 - V/V, V/E, E/E, V/F, E/F and F/F; + //! 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S; + //! 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S; + //! 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S; //! 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value) - Standard_EXPORT void SetLevelOfCheck(const Standard_Integer theLevel); + Standard_EXPORT void SetLevelOfCheck(const int theLevel); protected: - Standard_EXPORT virtual void Init(const Message_ProgressRange& theRange) Standard_OVERRIDE; + Standard_EXPORT void Init(const Message_ProgressRange& theRange) override; //! Treats the intersection results Standard_EXPORT void PostTreat(); @@ -84,9 +84,7 @@ protected: Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS, const Message_ProgressRange& theRange); - Standard_Integer myLevelOfCheck; - -private: + int myLevelOfCheck; }; #endif // _BOPAlgo_CheckerSI_HeaderFile diff --git a/opencascade/BOPAlgo_GlueEnum.hxx b/opencascade/BOPAlgo_GlueEnum.hxx index b9b2019bb..72a288d0e 100644 --- a/opencascade/BOPAlgo_GlueEnum.hxx +++ b/opencascade/BOPAlgo_GlueEnum.hxx @@ -17,41 +17,41 @@ //! The Enumeration describes an additional option for the algorithms //! in the Boolean Component such as General Fuse, Boolean operations, -//! Section, Maker Volume, Splitter and Cells Builder algorithms.
+//! Section, Maker Volume, Splitter and Cells Builder algorithms. //! //! The Gluing options have been designed to speed up the computation //! of the interference among arguments of the operations on special cases, //! in which the arguments may be overlapping but do not have real intersections -//! between their sub-shapes.
+//! between their sub-shapes. //! //! This option cannot be used on the shapes having real intersections, //! like intersection vertex between edges, or intersection vertex between -//! edge and a face or intersection line between faces.
+//! edge and a face or intersection line between faces. //! -//! There are two possibilities of overlapping shapes:
+//! There are two possibilities of overlapping shapes: //! 1. The shapes can be partially coinciding - the faces do not have //! intersection curves, but overlapping. The faces of such arguments will -//! be split during the operation;
+//! be split during the operation; //! 2. The shapes can be fully coinciding - there should be no partial //! overlapping of the faces, thus no intersection of type EDGE/FACE at all. -//! In such cases the faces will not be split during the operation.
+//! In such cases the faces will not be split during the operation. //! //! Even though there are no real intersections on such cases without Gluing options the algorithm -//! will still intersect the sub-shapes of the arguments with interfering bounding boxes.
+//! will still intersect the sub-shapes of the arguments with interfering bounding boxes. //! //! The performance improvement in gluing mode is achieved by excluding -//! the most time consuming computations according to the given Gluing parameter:
-//! 1. Computation of FACE/FACE intersections for partial coincidence;
+//! the most time consuming computations according to the given Gluing parameter: +//! 1. Computation of FACE/FACE intersections for partial coincidence; //! 2. And computation of VERTEX/FACE, EDGE/FACE and FACE/FACE intersections for full -//! coincidence.
+//! coincidence. //! //! By setting the Gluing option for the operation user should guarantee //! that the arguments are really coinciding. The algorithms do not check this itself. -//! Setting inappropriate option for the operation is likely to lead to incorrect result.
+//! Setting inappropriate option for the operation is likely to lead to incorrect result. //! -//! There are following items in the enumeration:
-//! **BOPAlgo_GlueOff** - default value for the algorithms, Gluing is switched off;
-//! **BOPAlgo_GlueShift** - Glue option for shapes with partial coincidence;
+//! There are following items in the enumeration: +//! **BOPAlgo_GlueOff** - default value for the algorithms, Gluing is switched off; +//! **BOPAlgo_GlueShift** - Glue option for shapes with partial coincidence; //! **BOPAlgo_GlueFull** - Glue option for shapes with full coincidence. //! enum BOPAlgo_GlueEnum diff --git a/opencascade/BOPAlgo_ListOfCheckResult.hxx b/opencascade/BOPAlgo_ListOfCheckResult.hxx index a1310678d..cbb55a326 100644 --- a/opencascade/BOPAlgo_ListOfCheckResult.hxx +++ b/opencascade/BOPAlgo_ListOfCheckResult.hxx @@ -1,4 +1,4 @@ -// Copyright (c) 20010-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -11,12 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPAlgo_ListOfCheckResult_HeaderFile -#define BOPAlgo_ListOfCheckResult_HeaderFile +//! @file BOPAlgo_ListOfCheckResult.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPAlgo_ListOfCheckResult_hxx +#define _BOPAlgo_ListOfCheckResult_hxx + +#include #include +Standard_HEADER_DEPRECATED( + "BOPAlgo_ListOfCheckResult.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BOPAlgo_ListOfCheckResult is deprecated, use NCollection_List directly") typedef NCollection_List BOPAlgo_ListOfCheckResult; -typedef BOPAlgo_ListOfCheckResult::Iterator BOPAlgo_ListIteratorOfListOfCheckResult; +Standard_DEPRECATED("BOPAlgo_ListIteratorOfListOfCheckResult is deprecated, use " + "NCollection_List::Iterator directly") +typedef NCollection_List::Iterator BOPAlgo_ListIteratorOfListOfCheckResult; -#endif +#endif // _BOPAlgo_ListOfCheckResult_hxx diff --git a/opencascade/BOPAlgo_MakeConnected.hxx b/opencascade/BOPAlgo_MakeConnected.hxx index f87e92526..cf46fc537 100644 --- a/opencascade/BOPAlgo_MakeConnected.hxx +++ b/opencascade/BOPAlgo_MakeConnected.hxx @@ -77,8 +77,8 @@ //! //! Here is the example of usage of the algorithm: //! ~~~~ -//! 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 @@ -107,8 +107,8 @@ //! 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 @@ -136,21 +136,20 @@ public: public: //! @name Constructor //! Empty constructor BOPAlgo_MakeConnected() - : BOPAlgo_Options() - { - } + + = default; public: //! @name Setters for the shapes to make connected //! Sets the shape for making them connected. //! @param[in] theArgs The arguments for the operation. - void SetArguments(const TopTools_ListOfShape& theArgs) { myArguments = theArgs; } + void SetArguments(const NCollection_List& theArgs) { myArguments = theArgs; } //! Adds the shape to the arguments. //! @param[in] theS One of the argument shapes. void AddArgument(const TopoDS_Shape& theS) { myArguments.Append(theS); } //! Returns the list of arguments of the operation. - const TopTools_ListOfShape& Arguments() const { return myArguments; } + const NCollection_List& Arguments() const { return myArguments; } public: //! @name Performing the operations //! Performs the operation, i.e. makes the input shapes connected. @@ -168,8 +167,7 @@ public: //! @name Shape periodicity & repetition //! @param[in] theDirectionID The direction's ID (0 for X, 1 for Y, 2 for Z); //! @param[in] theTimes Requested number of repetitions (sign of the value defines //! the side of the repetition direction (positive or negative)). - Standard_EXPORT void RepeatShape(const Standard_Integer theDirectionID, - const Standard_Integer theTimes); + Standard_EXPORT void RepeatShape(const int theDirectionID, const int theTimes); //! Clears the repetitions performed on the periodic shape, //! keeping the shape periodic. @@ -182,37 +180,37 @@ public: //! @name Material transitions //! Returns the original shapes which images contain the //! the given shape with FORWARD orientation. //! @param[in] theS The shape for which the materials are necessary. - const TopTools_ListOfShape& MaterialsOnPositiveSide(const TopoDS_Shape& theS) + const NCollection_List& MaterialsOnPositiveSide(const TopoDS_Shape& theS) { - const TopTools_ListOfShape* pLM = myMaterials.Seek(theS.Oriented(TopAbs_FORWARD)); + const NCollection_List* pLM = myMaterials.Seek(theS.Oriented(TopAbs_FORWARD)); return (pLM ? *pLM : EmptyList()); } //! Returns the original shapes which images contain the //! the given shape with REVERSED orientation. //! @param[in] theS The shape for which the materials are necessary. - const TopTools_ListOfShape& MaterialsOnNegativeSide(const TopoDS_Shape& theS) + const NCollection_List& MaterialsOnNegativeSide(const TopoDS_Shape& theS) { - const TopTools_ListOfShape* pLM = myMaterials.Seek(theS.Oriented(TopAbs_REVERSED)); + const NCollection_List* pLM = myMaterials.Seek(theS.Oriented(TopAbs_REVERSED)); return (pLM ? *pLM : EmptyList()); } public: //! @name History methods //! Returns the history of operations - const Handle(BRepTools_History)& History() const { return myHistory; } + const occ::handle& History() const { return myHistory; } //! Returns the list of shapes modified from the given shape. //! @param[in] theS The shape for which the modified shapes are necessary. - const TopTools_ListOfShape& GetModified(const TopoDS_Shape& theS) + const NCollection_List& GetModified(const TopoDS_Shape& theS) { return (myHistory.IsNull() ? EmptyList() : myHistory->Modified(theS)); } //! Returns the list of original shapes from which the current shape has been created. //! @param[in] theS The shape for which the origins are necessary. - const TopTools_ListOfShape& GetOrigins(const TopoDS_Shape& theS) + const NCollection_List& GetOrigins(const TopoDS_Shape& theS) { - const TopTools_ListOfShape* pLOr = myOrigins.Seek(theS); + const NCollection_List* pLOr = myOrigins.Seek(theS); return (pLOr ? *pLOr : EmptyList()); } @@ -225,7 +223,7 @@ public: //! @name Getting the result shapes public: //! @name Clearing the contents of the algorithm from previous runs //! Clears the contents of the algorithm. - void Clear() + void Clear() override { BOPAlgo_Options::Clear(); myArguments.Clear(); @@ -263,31 +261,34 @@ protected: //! @name Protected methods performing the operation private: //! Returns an empty list. - const TopTools_ListOfShape& EmptyList() + const NCollection_List& EmptyList() { - static const TopTools_ListOfShape anEmptyList; + static const NCollection_List anEmptyList; return anEmptyList; } protected: //! @name Fields // Inputs - TopTools_ListOfShape myArguments; //!< Input shapes for making them connected - TopTools_IndexedMapOfShape myAllInputsMap; //!< Map of all BRep sub-elements of the input shapes + NCollection_List myArguments; //!< Input shapes for making them connected + NCollection_IndexedMap + myAllInputsMap; //!< Map of all BRep sub-elements of the input shapes // Tools BOPAlgo_MakePeriodic myPeriodicityMaker; //!< Tool for making the shape periodic // Results NCollection_DataMap - myMaterials; //!< Map of the materials associations - //! for the border elements - TopTools_DataMapOfShapeListOfShape myOrigins; //!< Map of origins - //! (allows tracking the shape's ancestors) - - Handle(BRepTools_History) myGlueHistory; //!< Gluing History - Handle(BRepTools_History) myHistory; //!< Final History of shapes modifications - //! (including making the shape periodic and repetitions) + NCollection_List> + myMaterials; //!< Map of the materials associations + //! for the border elements + NCollection_DataMap, TopTools_ShapeMapHasher> + myOrigins; //!< Map of origins + //! (allows tracking the shape's ancestors) + + occ::handle myGlueHistory; //!< Gluing History + occ::handle + myHistory; //!< Final History of shapes modifications + //! (including making the shape periodic and repetitions) TopoDS_Shape myGlued; //!< The resulting connected (glued) shape TopoDS_Shape myShape; //!< The resulting shape diff --git a/opencascade/BOPAlgo_MakePeriodic.hxx b/opencascade/BOPAlgo_MakePeriodic.hxx index 5a34101d8..a4159a5a4 100644 --- a/opencascade/BOPAlgo_MakePeriodic.hxx +++ b/opencascade/BOPAlgo_MakePeriodic.hxx @@ -24,7 +24,8 @@ #include #include #include -#include +#include +#include //! BOPAlgo_MakePeriodic is the tool for making an arbitrary shape periodic //! in 3D space in specified directions. @@ -84,14 +85,14 @@ //! Example of usage of the algorithm: //! ~~~~ //! 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 +//! 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 @@ -128,11 +129,7 @@ public: public: //! @name Constructor //! Empty constructor - BOPAlgo_MakePeriodic() - : BOPAlgo_Options() - { - myRepeatPeriod[0] = myRepeatPeriod[1] = myRepeatPeriod[2] = 0.0; - } + BOPAlgo_MakePeriodic() { myRepeatPeriod[0] = myRepeatPeriod[1] = myRepeatPeriod[2] = 0.0; } public: //! @name Setting the shape to make it periodic //! Sets the shape to make it periodic. @@ -148,22 +145,22 @@ public: //! @name Definition of the structure to keep all periodicity parameters //! Returns all previously set parameters to default values void Clear() { - myPeriodic[0] = myPeriodic[1] = myPeriodic[2] = Standard_False; + myPeriodic[0] = myPeriodic[1] = myPeriodic[2] = false; myPeriod[0] = myPeriod[1] = myPeriod[2] = 0.0; - myIsTrimmed[0] = myIsTrimmed[1] = myIsTrimmed[2] = Standard_True; + myIsTrimmed[0] = myIsTrimmed[1] = myIsTrimmed[2] = true; myPeriodFirst[0] = myPeriodFirst[1] = myPeriodFirst[2] = 0.0; } - Standard_Boolean myPeriodic[3]; //!< Array of flags defining whether the shape should be - //! periodic in XYZ directions - Standard_Real myPeriod[3]; //!< Array of XYZ period values. Defining the period for any - //! direction the corresponding flag for that direction in - //! myPeriodic should be set to true - // clang-format off - Standard_Boolean myIsTrimmed[3]; //!< Array of flags defining whether the input shape has to be + bool myPeriodic[3]; //!< Array of flags defining whether the shape should be + //! periodic in XYZ directions + double myPeriod[3]; //!< Array of XYZ period values. Defining the period for any + //! direction the corresponding flag for that direction in + //! myPeriodic should be set to true + // clang-format off + bool myIsTrimmed[3]; //!< Array of flags defining whether the input shape has to be //! trimmed to fit the required period in the required direction - Standard_Real myPeriodFirst[3]; //!< Array of start parameters of the XYZ periods: required for trimming - // clang-format on + double myPeriodFirst[3]; //!< Array of start parameters of the XYZ periods: required for trimming + // clang-format on }; public: //! @name Setters/Getters for periodicity parameters structure @@ -185,27 +182,27 @@ public: //! @name Methods for setting/getting periodicity info using ID as a dir //! @param[in] theDirectionID The direction's ID; //! @param[in] theIsPeriodic Flag defining periodicity in given direction; //! @param[in] thePeriod Required period in given direction. - void MakePeriodic(const Standard_Integer theDirectionID, - const Standard_Boolean theIsPeriodic, - const Standard_Real thePeriod = 0.0) + void MakePeriodic(const int theDirectionID, + const bool theIsPeriodic, + const double thePeriod = 0.0) { - Standard_Integer id = ToDirectionID(theDirectionID); + int id = ToDirectionID(theDirectionID); myPeriodicityParams.myPeriodic[id] = theIsPeriodic; myPeriodicityParams.myPeriod[id] = theIsPeriodic ? thePeriod : 0.0; } //! Returns the info about Periodicity of the shape in specified direction. //! @param[in] theDirectionID The direction's ID. - Standard_Boolean IsPeriodic(const Standard_Integer theDirectionID) const + bool IsPeriodic(const int theDirectionID) const { return myPeriodicityParams.myPeriodic[ToDirectionID(theDirectionID)]; } //! Returns the Period of the shape in specified direction. //! @param[in] theDirectionID The direction's ID. - Standard_Real Period(const Standard_Integer theDirectionID) const + double Period(const int theDirectionID) const { - Standard_Integer id = ToDirectionID(theDirectionID); + int id = ToDirectionID(theDirectionID); return myPeriodicityParams.myPeriodic[id] ? myPeriodicityParams.myPeriod[id] : 0.0; } @@ -213,44 +210,44 @@ public: //! @name Named methods for setting/getting info about shape's periodici //! Sets the flag to make the shape periodic in X direction. //! @param[in] theIsPeriodic Flag defining periodicity in X direction; //! @param[in] thePeriod Required period in X direction. - void MakeXPeriodic(const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod = 0.0) + void MakeXPeriodic(const bool theIsPeriodic, const double thePeriod = 0.0) { MakePeriodic(0, theIsPeriodic, thePeriod); } //! Returns the info about periodicity of the shape in X direction. - Standard_Boolean IsXPeriodic() const { return IsPeriodic(0); } + bool IsXPeriodic() const { return IsPeriodic(0); } //! Returns the XPeriod of the shape - Standard_Real XPeriod() const { return Period(0); } + double XPeriod() const { return Period(0); } //! Sets the flag to make the shape periodic in Y direction. //! @param[in] theIsPeriodic Flag defining periodicity in Y direction; //! @param[in] thePeriod Required period in Y direction. - void MakeYPeriodic(const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod = 0.0) + void MakeYPeriodic(const bool theIsPeriodic, const double thePeriod = 0.0) { MakePeriodic(1, theIsPeriodic, thePeriod); } //! Returns the info about periodicity of the shape in Y direction. - Standard_Boolean IsYPeriodic() const { return IsPeriodic(1); } + bool IsYPeriodic() const { return IsPeriodic(1); } //! Returns the YPeriod of the shape. - Standard_Real YPeriod() const { return Period(1); } + double YPeriod() const { return Period(1); } //! Sets the flag to make the shape periodic in Z direction. //! @param[in] theIsPeriodic Flag defining periodicity in Z direction; //! @param[in] thePeriod Required period in Z direction. - void MakeZPeriodic(const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod = 0.0) + void MakeZPeriodic(const bool theIsPeriodic, const double thePeriod = 0.0) { MakePeriodic(2, theIsPeriodic, thePeriod); } //! Returns the info about periodicity of the shape in Z direction. - Standard_Boolean IsZPeriodic() const { return IsPeriodic(2); } + bool IsZPeriodic() const { return IsPeriodic(2); } //! Returns the ZPeriod of the shape. - Standard_Real ZPeriod() const { return Period(2); } + double ZPeriod() const { return Period(2); } public: //! @name Methods for setting/getting trimming info taking Direction ID as a parameter //! Defines whether the input shape is already trimmed in specified direction @@ -269,11 +266,9 @@ public: //! @name Methods for setting/getting trimming info taking Direction ID //! @param[in] theDirectionID The direction's ID; //! @param[in] theIsTrimmed The flag defining trimming of the shape in given direction; //! @param[in] theFirst The first periodic parameter in the given direction. - void SetTrimmed(const Standard_Integer theDirectionID, - const Standard_Boolean theIsTrimmed, - const Standard_Real theFirst = 0.0) + void SetTrimmed(const int theDirectionID, const bool theIsTrimmed, const double theFirst = 0.0) { - Standard_Integer id = ToDirectionID(theDirectionID); + int id = ToDirectionID(theDirectionID); if (IsPeriodic(id)) { myPeriodicityParams.myIsTrimmed[id] = theIsTrimmed; @@ -283,16 +278,16 @@ public: //! @name Methods for setting/getting trimming info taking Direction ID //! Returns whether the input shape was trimmed in the specified direction. //! @param[in] theDirectionID The direction's ID. - Standard_Boolean IsInputTrimmed(const Standard_Integer theDirectionID) const + bool IsInputTrimmed(const int theDirectionID) const { return myPeriodicityParams.myIsTrimmed[ToDirectionID(theDirectionID)]; } //! Returns the first periodic parameter in the specified direction. //! @param[in] theDirectionID The direction's ID. - Standard_Real PeriodFirst(const Standard_Integer theDirectionID) const + double PeriodFirst(const int theDirectionID) const { - Standard_Integer id = ToDirectionID(theDirectionID); + int id = ToDirectionID(theDirectionID); return !myPeriodicityParams.myIsTrimmed[id] ? myPeriodicityParams.myPeriodFirst[id] : 0.0; } @@ -307,16 +302,16 @@ public: //! @name Named methods for setting/getting trimming info //! @param[in] theIsTrimmed Flag defining whether the shape is already trimmed //! in X direction to fit the X period; //! @param[in] theFirst The first X periodic parameter. - void SetXTrimmed(const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst = 0.0) + void SetXTrimmed(const bool theIsTrimmed, const bool theFirst = 0.0) { SetTrimmed(0, theIsTrimmed, theFirst); } //! Returns whether the input shape was already trimmed for X period. - Standard_Boolean IsInputXTrimmed() const { return IsInputTrimmed(0); } + bool IsInputXTrimmed() const { return IsInputTrimmed(0); } //! Returns the first parameter for the X period. - Standard_Real XPeriodFirst() const { return PeriodFirst(0); } + double XPeriodFirst() const { return PeriodFirst(0); } //! Defines whether the input shape is already trimmed in Y direction //! to fit the Y period. If the shape is not trimmed it is required @@ -328,16 +323,16 @@ public: //! @name Named methods for setting/getting trimming info //! @param[in] theIsTrimmed Flag defining whether the shape is already trimmed //! in Y direction to fit the Y period; //! @param[in] theFirst The first Y periodic parameter. - void SetYTrimmed(const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst = 0.0) + void SetYTrimmed(const bool theIsTrimmed, const bool theFirst = 0.0) { SetTrimmed(1, theIsTrimmed, theFirst); } //! Returns whether the input shape was already trimmed for Y period. - Standard_Boolean IsInputYTrimmed() const { return IsInputTrimmed(1); } + bool IsInputYTrimmed() const { return IsInputTrimmed(1); } //! Returns the first parameter for the Y period. - Standard_Real YPeriodFirst() const { return PeriodFirst(1); } + double YPeriodFirst() const { return PeriodFirst(1); } //! Defines whether the input shape is already trimmed in Z direction //! to fit the Z period. If the shape is not trimmed it is required @@ -349,16 +344,16 @@ public: //! @name Named methods for setting/getting trimming info //! @param[in] theIsTrimmed Flag defining whether the shape is already trimmed //! in Z direction to fit the Z period; //! @param[in] theFirst The first Z periodic parameter. - void SetZTrimmed(const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst = 0.0) + void SetZTrimmed(const bool theIsTrimmed, const bool theFirst = 0.0) { SetTrimmed(2, theIsTrimmed, theFirst); } //! Returns whether the input shape was already trimmed for Z period. - Standard_Boolean IsInputZTrimmed() const { return IsInputTrimmed(2); } + bool IsInputZTrimmed() const { return IsInputTrimmed(2); } //! Returns the first parameter for the Z period. - Standard_Real ZPeriodFirst() const { return PeriodFirst(2); } + double ZPeriodFirst() const { return PeriodFirst(2); } public: //! @name Performing the operation //! Makes the shape periodic in necessary directions @@ -373,8 +368,7 @@ public: //! @name Using the algorithm to repeat the shape //! //! @param[in] theDirectionID The direction's ID; //! @param[in] theTimes Requested number of repetitions. - Standard_EXPORT const TopoDS_Shape& RepeatShape(const Standard_Integer theDirectionID, - const Standard_Integer theTimes); + Standard_EXPORT const TopoDS_Shape& RepeatShape(const int theDirectionID, const int theTimes); //! Repeats the shape in X direction specified number of times. //! Negative value of times means that the repetition should be @@ -382,7 +376,7 @@ public: //! @name Using the algorithm to repeat the shape //! Makes the repeated shape a base for following repetitions. //! //! @param[in] theTimes Requested number of repetitions. - const TopoDS_Shape& XRepeat(const Standard_Integer theTimes) { return RepeatShape(0, theTimes); } + const TopoDS_Shape& XRepeat(const int theTimes) { return RepeatShape(0, theTimes); } //! Repeats the shape in Y direction specified number of times. //! Negative value of times means that the repetition should be @@ -390,7 +384,7 @@ public: //! @name Using the algorithm to repeat the shape //! Makes the repeated shape a base for following repetitions. //! //! @param[in] theTimes Requested number of repetitions. - const TopoDS_Shape& YRepeat(const Standard_Integer theTimes) { return RepeatShape(1, theTimes); } + const TopoDS_Shape& YRepeat(const int theTimes) { return RepeatShape(1, theTimes); } //! Repeats the shape in Z direction specified number of times. //! Negative value of times means that the repetition should be @@ -398,7 +392,7 @@ public: //! @name Using the algorithm to repeat the shape //! Makes the repeated shape a base for following repetitions. //! //! @param[in] theTimes Requested number of repetitions. - const TopoDS_Shape& ZRepeat(const Standard_Integer theTimes) { return RepeatShape(2, theTimes); } + const TopoDS_Shape& ZRepeat(const int theTimes) { return RepeatShape(2, theTimes); } public: //! @name Starting the repetitions over //! Returns the repeated shape @@ -429,21 +423,21 @@ public: //! @name Getting the identical shapes //! Returns empty list in case the shape has no twin. //! //! @param[in] theS Shape to get the twins for. - const TopTools_ListOfShape& GetTwins(const TopoDS_Shape& theS) const + const NCollection_List& GetTwins(const TopoDS_Shape& theS) const { - static TopTools_ListOfShape empty; - const TopTools_ListOfShape* aTwins = + static NCollection_List empty; + const NCollection_List* aTwins = myRepeatedTwins.IsEmpty() ? myTwins.Seek(theS) : myRepeatedTwins.Seek(theS); return (aTwins ? *aTwins : empty); } public: //! @name Getting the History of the algorithm //! Returns the History of the algorithm - const Handle(BRepTools_History)& History() const { return myHistory; } + const occ::handle& History() const { return myHistory; } public: //! @name Clearing the algorithm from previous runs //! Clears the algorithm from previous runs - void Clear() + void Clear() override { BOPAlgo_Options::Clear(); myPeriodicityParams.Clear(); @@ -458,10 +452,7 @@ public: //! @name Clearing the algorithm from previous runs public: //! @name Conversion of the integer to ID of periodic direction //! Converts the integer to ID of periodic direction - static Standard_Integer ToDirectionID(const Standard_Integer theDirectionID) - { - return Abs(theDirectionID % 3); - } + static int ToDirectionID(const int theDirectionID) { return std::abs(theDirectionID % 3); } protected: //! @name Protected methods performing the operation //! Checks the validity of input data @@ -491,9 +482,10 @@ protected: //! @name Protected methods performing the operation //! for coinciding parts. //! @param[out] theSplitShapeHistory The history of shape split //! @param[out] theSplitToolsHistory The history of tools modifications during the split - Standard_EXPORT void SplitShape(const TopTools_ListOfShape& theTools, - Handle(BRepTools_History) theSplitShapeHistory = NULL, - Handle(BRepTools_History) theSplitToolsHistory = NULL); + Standard_EXPORT void SplitShape( + const NCollection_List& theTools, + const occ::handle& theSplitShapeHistory = nullptr, + const occ::handle& theSplitToolsHistory = nullptr); //! Updates the map of twins after periodic shape repetition. //! @param[in] theTranslationHistory The history of translation of the periodic shape. @@ -508,23 +500,24 @@ protected: //! @name Fields PeriodicityParams myPeriodicityParams; //!< Periodicity parameters // Results - TopoDS_Shape myShape; //!< Resulting periodic shape (base for repetitions) - TopoDS_Shape myRepeatedShape; //!< Resulting shape after making repetitions of the base - Standard_Real myRepeatPeriod[3]; //!< XYZ repeat period - // clang-format off - TopTools_DataMapOfShapeListOfShape myRepeatedTwins; //!< Map of associations of the identical sub-shapes + TopoDS_Shape myShape; //!< Resulting periodic shape (base for repetitions) + TopoDS_Shape myRepeatedShape; //!< Resulting shape after making repetitions of the base + double myRepeatPeriod[3]; //!< XYZ repeat period + // clang-format off + NCollection_DataMap, TopTools_ShapeMapHasher> myRepeatedTwins; //!< Map of associations of the identical sub-shapes //! after repetition of the periodic shape - // clang-format on + // clang-format on // Twins - TopTools_DataMapOfShapeListOfShape myTwins; //!< Map of associations of the identical sub-shapes - //! located on the opposite sides of the shape + NCollection_DataMap, TopTools_ShapeMapHasher> + myTwins; //!< Map of associations of the identical sub-shapes + //! located on the opposite sides of the shape // History - Handle(BRepTools_History) mySplitHistory; //!< Split history - history of shapes modification - //! after the split for making the shape periodic - Handle(BRepTools_History) myHistory; //!< Final history of shapes modifications - //! (to include the history of shape repetition) + occ::handle mySplitHistory; //!< Split history - history of shapes modification + //! after the split for making the shape periodic + occ::handle myHistory; //!< Final history of shapes modifications + //! (to include the history of shape repetition) }; #endif // _BOPAlgo_MakePeriodic_HeaderFile diff --git a/opencascade/BOPAlgo_MakerVolume.hxx b/opencascade/BOPAlgo_MakerVolume.hxx index 8db8b7530..d2293c65e 100644 --- a/opencascade/BOPAlgo_MakerVolume.hxx +++ b/opencascade/BOPAlgo_MakerVolume.hxx @@ -23,8 +23,10 @@ #include #include #include -#include -#include +#include +#include +#include +#include class BOPAlgo_PaveFiller; //! The algorithm is to build solids from set of shapes. @@ -110,70 +112,71 @@ public: //! Empty constructor. BOPAlgo_MakerVolume(); - virtual ~BOPAlgo_MakerVolume(); + ~BOPAlgo_MakerVolume() override; //! Empty constructor. - BOPAlgo_MakerVolume(const Handle(NCollection_BaseAllocator)& theAllocator); + BOPAlgo_MakerVolume(const occ::handle& theAllocator); //! Clears the data. - virtual void Clear() Standard_OVERRIDE; + void Clear() override; //! Sets the flag myIntersect: //! if is TRUE the shapes from will be intersected. //! if is FALSE no intersection will be done. - void SetIntersect(const Standard_Boolean bIntersect); + void SetIntersect(const bool bIntersect); //! Returns the flag . - Standard_Boolean IsIntersect() const; + bool IsIntersect() const; //! Returns the solid box . const TopoDS_Solid& Box() const; //! Returns the processed faces . - const TopTools_ListOfShape& Faces() const; + const NCollection_List& Faces() const; //! Defines the preventing of addition of internal for solid parts into the result. //! By default the internal parts are added into result. - void SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal) + void SetAvoidInternalShapes(const bool theAvoidInternal) { myAvoidInternalShapes = theAvoidInternal; } //! Returns the AvoidInternalShapes flag - Standard_Boolean IsAvoidInternalShapes() const { return myAvoidInternalShapes; } + bool IsAvoidInternalShapes() const { return myAvoidInternalShapes; } //! Performs the operation. - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; protected: //! Checks the data. - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Performs the operation. - Standard_EXPORT virtual void PerformInternal1( + Standard_EXPORT void PerformInternal1( const BOPAlgo_PaveFiller& thePF, - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Collects all faces. Standard_EXPORT void CollectFaces(); //! Makes solid box. - Standard_EXPORT void MakeBox(TopTools_MapOfShape& theBoxFaces); + Standard_EXPORT void MakeBox(NCollection_Map& theBoxFaces); //! Builds solids. - Standard_EXPORT void BuildSolids(TopTools_ListOfShape& theLSR, - const Message_ProgressRange& theRange); + Standard_EXPORT void BuildSolids(NCollection_List& theLSR, + const Message_ProgressRange& theRange); //! Removes the covering box. - Standard_EXPORT void RemoveBox(TopTools_ListOfShape& theLSR, - const TopTools_MapOfShape& theBoxFaces); + Standard_EXPORT void RemoveBox( + NCollection_List& theLSR, + const NCollection_Map& theBoxFaces); //! Fills the solids with internal shapes. - Standard_EXPORT void FillInternalShapes(const TopTools_ListOfShape& theLSR); + Standard_EXPORT void FillInternalShapes(const NCollection_List& theLSR); //! Builds the result. - Standard_EXPORT void BuildShape(const TopTools_ListOfShape& theLSR); + Standard_EXPORT void BuildShape(const NCollection_List& theLSR); protected: //! List of operations to be supported by the Progress Indicator. @@ -191,16 +194,14 @@ protected: }; //! Analyze progress steps - Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const override; protected: - Standard_Boolean myIntersect; - Bnd_Box myBBox; - TopoDS_Solid mySBox; - TopTools_ListOfShape myFaces; - Standard_Boolean myAvoidInternalShapes; - -private: + bool myIntersect; + Bnd_Box myBBox; + TopoDS_Solid mySBox; + NCollection_List myFaces; + bool myAvoidInternalShapes; }; #include diff --git a/opencascade/BOPAlgo_MakerVolume.lxx b/opencascade/BOPAlgo_MakerVolume.lxx index 5bc5e806b..2ad44e7ba 100644 --- a/opencascade/BOPAlgo_MakerVolume.lxx +++ b/opencascade/BOPAlgo_MakerVolume.lxx @@ -12,84 +12,67 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BOPAlgo_MakerVolume -// purpose : -//======================================================================= +//================================================================================================= + inline BOPAlgo_MakerVolume::BOPAlgo_MakerVolume() - : BOPAlgo_Builder(), - myIntersect(Standard_True), - myAvoidInternalShapes(Standard_False) + : myIntersect(true), + myAvoidInternalShapes(false) { } -//======================================================================= -// function : BOPAlgo_MakerVolume -// purpose : -//======================================================================= +//================================================================================================= + inline BOPAlgo_MakerVolume::BOPAlgo_MakerVolume( - const Handle(NCollection_BaseAllocator)& theAllocator) + const occ::handle& theAllocator) : BOPAlgo_Builder(theAllocator), - myIntersect(Standard_True), - myAvoidInternalShapes(Standard_False) + myIntersect(true), + myAvoidInternalShapes(false) { } -//======================================================================= -// function : ~BOPAlgo_MakerVolume -// purpose : -//======================================================================= +//================================================================================================= + inline BOPAlgo_MakerVolume::~BOPAlgo_MakerVolume() { Clear(); } -//======================================================================= -// function : Clear -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPAlgo_MakerVolume::Clear() { BOPAlgo_Builder::Clear(); - myIntersect = Standard_True; + myIntersect = true; myBBox = Bnd_Box(); mySBox.Nullify(); myFaces.Clear(); - myAvoidInternalShapes = Standard_False; + myAvoidInternalShapes = false; } -//======================================================================= -// function : SetIntersect -// purpose : -//======================================================================= -inline void BOPAlgo_MakerVolume::SetIntersect(const Standard_Boolean bIntersect) +//================================================================================================= + +inline void BOPAlgo_MakerVolume::SetIntersect(const bool bIntersect) { myIntersect = bIntersect; } -//======================================================================= -// function : IsIntersect -// purpose : -//======================================================================= -inline Standard_Boolean BOPAlgo_MakerVolume::IsIntersect() const +//================================================================================================= + +inline bool BOPAlgo_MakerVolume::IsIntersect() const { return myIntersect; } -//======================================================================= -// function : Box -// purpose : -//======================================================================= +//================================================================================================= + inline const TopoDS_Solid& BOPAlgo_MakerVolume::Box() const { return mySBox; } -//======================================================================= -// function : Faces -// purpose : -//======================================================================= -inline const TopTools_ListOfShape& BOPAlgo_MakerVolume::Faces() const +//================================================================================================= + +inline const NCollection_List& BOPAlgo_MakerVolume::Faces() const { return myFaces; } diff --git a/opencascade/BOPAlgo_Options.hxx b/opencascade/BOPAlgo_Options.hxx index f2bf8cf25..a028acca1 100644 --- a/opencascade/BOPAlgo_Options.hxx +++ b/opencascade/BOPAlgo_Options.hxx @@ -42,13 +42,13 @@ public: Standard_EXPORT BOPAlgo_Options(); //! Constructor with allocator - Standard_EXPORT BOPAlgo_Options(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_Options(const occ::handle& theAllocator); //! Destructor Standard_EXPORT virtual ~BOPAlgo_Options(); //! Returns allocator - const Handle(NCollection_BaseAllocator)& Allocator() const { return myAllocator; } + const occ::handle& Allocator() const { return myAllocator; } //! Clears all warnings and errors, and any data cached by the algorithm. //! User defined options are not cleared. @@ -58,37 +58,37 @@ public: //!@name Error reporting mechanism //! Adds the alert as error (fail) - void AddError(const Handle(Message_Alert)& theAlert) + void AddError(const occ::handle& theAlert) { myReport->AddAlert(Message_Fail, theAlert); } //! Adds the alert as warning - void AddWarning(const Handle(Message_Alert)& theAlert) + void AddWarning(const occ::handle& theAlert) { myReport->AddAlert(Message_Warning, theAlert); } //! Returns true if algorithm has failed - Standard_Boolean HasErrors() const { return !myReport->GetAlerts(Message_Fail).IsEmpty(); } + bool HasErrors() const { return !myReport->GetAlerts(Message_Fail).IsEmpty(); } //! Returns true if algorithm has generated error of specified type - Standard_Boolean HasError(const Handle(Standard_Type)& theType) const + bool HasError(const occ::handle& theType) const { return myReport->HasAlert(theType, Message_Fail); } //! Returns true if algorithm has generated some warning alerts - Standard_Boolean HasWarnings() const { return !myReport->GetAlerts(Message_Warning).IsEmpty(); } + bool HasWarnings() const { return !myReport->GetAlerts(Message_Warning).IsEmpty(); } //! Returns true if algorithm has generated warning of specified type - Standard_Boolean HasWarning(const Handle(Standard_Type)& theType) const + bool HasWarning(const occ::handle& theType) const { return myReport->HasAlert(theType, Message_Warning); } //! Returns report collecting all errors and warnings - const Handle(Message_Report)& GetReport() const { return myReport; } + const occ::handle& GetReport() const { return myReport; } //! Dumps the error status into the given stream Standard_EXPORT void DumpErrors(Standard_OStream& theOS) const; @@ -103,48 +103,48 @@ public: //!@name Parallel processing mode //! Gets the global parallel mode - Standard_EXPORT static Standard_Boolean GetParallelMode(); + Standard_EXPORT static bool GetParallelMode(); //! Sets the global parallel mode - Standard_EXPORT static void SetParallelMode(const Standard_Boolean theNewMode); + Standard_EXPORT static void SetParallelMode(const bool theNewMode); //! Set the flag of parallel processing //! if is true the parallel processing is switched on //! if is false the parallel processing is switched off - void SetRunParallel(const Standard_Boolean theFlag) { myRunParallel = theFlag; } + void SetRunParallel(const bool theFlag) { myRunParallel = theFlag; } //! Returns the flag of parallel processing - Standard_Boolean RunParallel() const { return myRunParallel; } + bool RunParallel() const { return myRunParallel; } public: //!@name Fuzzy tolerance //! Sets the additional tolerance - Standard_EXPORT void SetFuzzyValue(const Standard_Real theFuzz); + Standard_EXPORT void SetFuzzyValue(const double theFuzz); //! Returns the additional tolerance - Standard_Real FuzzyValue() const { return myFuzzyValue; } + double FuzzyValue() const { return myFuzzyValue; } public: //!@name Usage of Oriented Bounding boxes //! Enables/Disables the usage of OBB - void SetUseOBB(const Standard_Boolean theUseOBB) { myUseOBB = theUseOBB; } + void SetUseOBB(const bool theUseOBB) { myUseOBB = theUseOBB; } //! Returns the flag defining usage of OBB - Standard_Boolean UseOBB() const { return myUseOBB; } + bool UseOBB() const { return myUseOBB; } protected: //! Adds error to the report if the break signal was caught. Returns true in this case, false //! otherwise. - Standard_EXPORT Standard_Boolean UserBreak(const Message_ProgressScope& thePS); + Standard_EXPORT bool UserBreak(const Message_ProgressScope& thePS); protected: - Handle(NCollection_BaseAllocator) myAllocator; - Handle(Message_Report) myReport; - Standard_Boolean myRunParallel; - Standard_Real myFuzzyValue; - Standard_Boolean myUseOBB; + occ::handle myAllocator; + occ::handle myReport; + bool myRunParallel; + double myFuzzyValue; + bool myUseOBB; }; #endif // _BOPAlgo_Options_HeaderFile diff --git a/opencascade/BOPAlgo_PaveFiller.hxx b/opencascade/BOPAlgo_PaveFiller.hxx index e2590cc19..c26466e58 100644 --- a/opencascade/BOPAlgo_PaveFiller.hxx +++ b/opencascade/BOPAlgo_PaveFiller.hxx @@ -25,32 +25,30 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include +#include #include -#include +#include #include #include -#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include + +#include + class IntTools_Context; class BOPDS_PaveBlock; class gp_Pnt; @@ -61,27 +59,27 @@ class TopoDS_Face; //! //! The class represents the Intersection phase of the -//! Boolean Operations algorithm.
+//! Boolean Operations algorithm. //! It performs the pairwise intersection of the sub-shapes of -//! the arguments in the following order:
-//! 1. Vertex/Vertex;
-//! 2. Vertex/Edge;
-//! 3. Edge/Edge;
-//! 4. Vertex/Face;
-//! 5. Edge/Face;
-//! 6. Face/Face.
+//! the arguments in the following order: +//! 1. Vertex/Vertex; +//! 2. Vertex/Edge; +//! 3. Edge/Edge; +//! 4. Vertex/Face; +//! 5. Edge/Face; +//! 6. Face/Face. //! //! The results of intersection are stored into the Data Structure -//! of the algorithm.
+//! of the algorithm. //! //! Additionally to the options provided by the parent class, -//! the algorithm has the following options:
+//! the algorithm has the following options: //! - *Section attributes* - allows to customize the intersection of the faces -//! (avoid approximation or building 2d curves);
+//! (avoid approximation or building 2d curves); //! - *Safe processing mode* - allows to avoid modification of the input -//! shapes during the operation (by default it is off);
+//! shapes during the operation (by default it is off); //! - *Gluing options* - allows to speed up the calculation on the special -//! cases, in which some sub-shapes are coincide.
+//! cases, in which some sub-shapes are coincide. //! //! The algorithm returns the following Warning statuses: //! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering @@ -101,9 +99,9 @@ class TopoDS_Face; //! //! The algorithm returns the following Error alerts: //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to -//! perform the operation;
-//! - *BOPAlgo_AlertIntersectionFailed* - in case some unexpected error occurred;
-//! - *BOPAlgo_AlertNullInputShapes* - in case some of the arguments are null shapes.
+//! perform the operation; +//! - *BOPAlgo_AlertIntersectionFailed* - in case some unexpected error occurred; +//! - *BOPAlgo_AlertNullInputShapes* - in case some of the arguments are null shapes. //! class BOPAlgo_PaveFiller : public BOPAlgo_Algo { @@ -112,9 +110,9 @@ public: Standard_EXPORT BOPAlgo_PaveFiller(); - Standard_EXPORT virtual ~BOPAlgo_PaveFiller(); + Standard_EXPORT ~BOPAlgo_PaveFiller() override; - Standard_EXPORT BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_PaveFiller(const occ::handle& theAllocator); Standard_EXPORT const BOPDS_DS& DS(); @@ -123,30 +121,33 @@ public: Standard_EXPORT const BOPDS_PIterator& Iterator(); //! Sets the arguments for operation - void SetArguments(const TopTools_ListOfShape& theLS) { myArguments = theLS; } + void SetArguments(const NCollection_List& theLS) { myArguments = theLS; } + + //! Sets the arguments for operation (move semantics) + void SetArguments(NCollection_List&& theLS) { myArguments = std::move(theLS); } //! Adds the argument for operation void AddArgument(const TopoDS_Shape& theShape) { myArguments.Append(theShape); } //! Returns the list of arguments - const TopTools_ListOfShape& Arguments() const { return myArguments; } + const NCollection_List& Arguments() const { return myArguments; } - Standard_EXPORT const Handle(IntTools_Context)& Context(); + Standard_EXPORT const occ::handle& Context(); Standard_EXPORT void SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr); //! Sets the flag that defines the mode of treatment. //! In non-destructive mode the argument shapes are not modified. Instead //! a copy of a sub-shape is created in the result if it is needed to be updated. - Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag); + Standard_EXPORT void SetNonDestructive(const bool theFlag); //! Returns the flag that defines the mode of treatment. //! In non-destructive mode the argument shapes are not modified. Instead //! a copy of a sub-shape is created in the result if it is needed to be updated. - Standard_EXPORT Standard_Boolean NonDestructive() const; + Standard_EXPORT bool NonDestructive() const; - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Sets the glue option for the algorithm Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue); @@ -155,31 +156,32 @@ public: Standard_EXPORT BOPAlgo_GlueEnum Glue() const; //! Sets the flag to avoid building of p-curves of edges on faces - void SetAvoidBuildPCurve(const Standard_Boolean theValue) { myAvoidBuildPCurve = theValue; } + void SetAvoidBuildPCurve(const bool theValue) { myAvoidBuildPCurve = theValue; } //! Returns the flag to avoid building of p-curves of edges on faces - Standard_Boolean IsAvoidBuildPCurve() const { return myAvoidBuildPCurve; } + bool IsAvoidBuildPCurve() const { return myAvoidBuildPCurve; } protected: - typedef NCollection_DataMap BOPAlgo_DataMapOfPaveBlockBndBox; + typedef NCollection_DataMap, Bnd_Box> + BOPAlgo_DataMapOfPaveBlockBndBox; - typedef NCollection_DataMap + typedef NCollection_DataMap, NCollection_List> BOPAlgo_DataMapOfPaveBlockListOfInteger; - typedef NCollection_DataMap + typedef NCollection_DataMap>> BOPAlgo_DataMapOfIntegerMapOfPaveBlock; //! Sets non-destructive mode automatically if an argument //! contains a locked sub-shape (see TopoDS_Shape::Locked()). Standard_EXPORT void SetNonDestructive(); - Standard_EXPORT void SetIsPrimary(const Standard_Boolean theFlag); + Standard_EXPORT void SetIsPrimary(const bool theFlag); - Standard_EXPORT Standard_Boolean IsPrimary() const; + Standard_EXPORT bool IsPrimary() const; Standard_EXPORT virtual void PerformInternal(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; Standard_EXPORT virtual void Init(const Message_ProgressRange& theRange); @@ -190,20 +192,22 @@ protected: Standard_EXPORT virtual void PerformVE(const Message_ProgressRange& theRange); //! Performs the intersection of the vertices with edges. - Standard_EXPORT void IntersectVE(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theVEPairs, - const Message_ProgressRange& theRange, - const Standard_Boolean bAddInterfs = Standard_True); + Standard_EXPORT void IntersectVE( + const NCollection_IndexedDataMap, NCollection_List>& + theVEPairs, + const Message_ProgressRange& theRange, + const bool bAddInterfs = true); - //! Splits the Pave Blocks of the given edges with the extra paves.
+ //! Splits the Pave Blocks of the given edges with the extra paves. //! The method also builds the shrunk data for the new pave blocks and //! in case there is no valid range on the pave block, the vertices of - //! this pave block will be united making SD vertex.
+ //! this pave block will be united making SD vertex. //! Parameter defines whether this interference will be added - //! into common table of interferences or not.
+ //! into common table of interferences or not. //! If some of the Pave Blocks are forming the Common Blocks, the splits //! of the Pave Blocks will also form a Common Block. - Standard_EXPORT void SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges, - const Standard_Boolean theAddInterfs); + Standard_EXPORT void SplitPaveBlocks(const NCollection_Map& theMEdges, + const bool theAddInterfs); Standard_EXPORT virtual void PerformVF(const Message_ProgressRange& theRange); @@ -215,8 +219,9 @@ protected: Standard_EXPORT void TreatVerticesEE(); - Standard_EXPORT void MakeSDVerticesFF(const TColStd_DataMapOfIntegerListOfInteger& aDMVLV, - TColStd_DataMapOfIntegerInteger& theDMNewSD); + Standard_EXPORT void MakeSDVerticesFF( + const NCollection_DataMap>& aDMVLV, + NCollection_DataMap& theDMNewSD); Standard_EXPORT void MakeSplitEdges(const Message_ProgressRange& theRange); @@ -224,12 +229,12 @@ protected: Standard_EXPORT void MakePCurves(const Message_ProgressRange& theRange); - Standard_EXPORT Standard_Integer MakeSDVertices(const TColStd_ListOfInteger& theVertIndices, - const Standard_Boolean theAddInterfs = 1); + Standard_EXPORT int MakeSDVertices(const NCollection_List& theVertIndices, + const bool theAddInterfs = true); Standard_EXPORT void ProcessDE(const Message_ProgressRange& theRange); - Standard_EXPORT void FillShrunkData(Handle(BOPDS_PaveBlock)& thePB); + Standard_EXPORT void FillShrunkData(occ::handle& thePB); Standard_EXPORT void FillShrunkData(const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2); @@ -237,40 +242,41 @@ protected: //! Analyzes the results of computation of the valid range for the //! pave block and in case of error adds the warning status, otherwise //! saves the valid range in the pave block. - Standard_EXPORT void AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB, - const IntTools_ShrunkRange& theSR); + Standard_EXPORT void AnalyzeShrunkData(const occ::handle& thePB, + const IntTools_ShrunkRange& theSR); //! Performs intersection of new vertices, obtained in E/E and E/F intersections Standard_EXPORT void PerformNewVertices( - BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, - const Handle(NCollection_BaseAllocator)& theAllocator, - const Message_ProgressRange& theRange, - const Standard_Boolean theIsEEIntersection = Standard_True); + NCollection_IndexedDataMap& + theMVCPB, + const occ::handle& theAllocator, + const Message_ProgressRange& theRange, + const bool theIsEEIntersection = true); - Standard_EXPORT Standard_Boolean CheckFacePaves(const TopoDS_Vertex& theVnew, - const TColStd_MapOfInteger& theMIF); + Standard_EXPORT bool CheckFacePaves(const TopoDS_Vertex& theVnew, + const NCollection_Map& theMIF); - Standard_EXPORT static Standard_Boolean CheckFacePaves(const Standard_Integer theN, - const TColStd_MapOfInteger& theMIFOn, - const TColStd_MapOfInteger& theMIFIn); + Standard_EXPORT static bool CheckFacePaves(const int theN, + const NCollection_Map& theMIFOn, + const NCollection_Map& theMIFIn); - Standard_EXPORT Standard_Boolean IsExistingVertex(const gp_Pnt& theP, - const Standard_Real theTol, - const TColStd_MapOfInteger& theMVOn) const; + Standard_EXPORT bool IsExistingVertex(const gp_Pnt& theP, + const double theTol, + const NCollection_Map& theMVOn) const; //! Checks and puts paves from on the curve . //! At that, common (from theMVCommon) and not common vertices //! are processed differently. - Standard_EXPORT void PutPavesOnCurve(const TColStd_MapOfInteger& theMVOnIn, - const TColStd_MapOfInteger& theMVCommon, - BOPDS_Curve& theNC, - const TColStd_MapOfInteger& theMI, - const TColStd_MapOfInteger& theMVEF, - TColStd_DataMapOfIntegerReal& theMVTol, - TColStd_DataMapOfIntegerListOfInteger& theDMVLV); + Standard_EXPORT void PutPavesOnCurve(const NCollection_Map& theMVOnIn, + const NCollection_Map& theMVCommon, + BOPDS_Curve& theNC, + const NCollection_Map& theMI, + const NCollection_Map& theMVEF, + NCollection_DataMap& theMVTol, + NCollection_DataMap>& theDMVLV); - Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC, - TColStd_DataMapOfIntegerReal& theMVTol); + Standard_EXPORT void FilterPavesOnCurves(const NCollection_DynamicArray& theVNC, + NCollection_DataMap& theMVTol); //! Depending on the parameter aType it checks whether //! the vertex nV was created in EE or EF intersections. @@ -280,209 +286,221 @@ protected: //! 1 - checks only EE; //! 2 - checks only EF; //! other - checks both types of intersections. - Standard_EXPORT Standard_Boolean ExtendedTolerance(const Standard_Integer nV, - const TColStd_MapOfInteger& aMI, - Standard_Real& aTolVExt, - const Standard_Integer aType = 0); + Standard_EXPORT bool ExtendedTolerance(const int nV, + const NCollection_Map& aMI, + double& aTolVExt, + const int aType = 0); Standard_EXPORT void PutBoundPaveOnCurve(const TopoDS_Face& theF1, const TopoDS_Face& theF2, BOPDS_Curve& theNC, - TColStd_ListOfInteger& theLBV); + NCollection_List& theLBV); //! Checks if the given pave block (created on section curve) //! coincides with any of the pave blocks of the faces //! created the section curve. - Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const Handle(BOPDS_PaveBlock)& thePB, - const BOPDS_Curve& theNC, - const Standard_Real theTolR3D, - const BOPDS_IndexedMapOfPaveBlock& theMPB, - BOPTools_BoxTree& thePBTree, - const BOPDS_MapOfPaveBlock& theMPBCommon, - Handle(BOPDS_PaveBlock)& thePBOut, - Standard_Real& theTolNew); + Standard_EXPORT bool IsExistingPaveBlock( + const occ::handle& thePB, + const BOPDS_Curve& theNC, + const double theTolR3D, + const NCollection_IndexedMap>& theMPB, + BOPTools_BoxTree& thePBTree, + const NCollection_Map>& theMPBCommon, + occ::handle& thePBOut, + double& theTolNew); //! Checks if the given pave block (created on section curve) //! coincides with any of the edges shared between the faces //! created the section curve. - Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const Handle(BOPDS_PaveBlock)& thePB, - const BOPDS_Curve& theNC, - const TColStd_ListOfInteger& theLSE, - Standard_Integer& theNEOut, - Standard_Real& theTolNew); + Standard_EXPORT bool IsExistingPaveBlock(const occ::handle& thePB, + const BOPDS_Curve& theNC, + const NCollection_List& theLSE, + int& theNEOut, + double& theTolNew); //! Treatment of section edges. - Standard_EXPORT void PostTreatFF(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, - BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges, - TColStd_DataMapOfIntegerInteger& theDMNewSD, - const BOPDS_IndexedMapOfPaveBlock& theMicroPB, - const TopTools_IndexedMapOfShape& theVertsOnRejectedPB, - const Handle(NCollection_BaseAllocator)& theAllocator, - const Message_ProgressRange& theRange); - - Standard_EXPORT void FindPaveBlocks(const Standard_Integer theV, - const Standard_Integer theF, - BOPDS_ListOfPaveBlock& theLPB); - - Standard_EXPORT void FillPaves(const Standard_Integer theV, - const Standard_Integer theE, - const Standard_Integer theF, - const BOPDS_ListOfPaveBlock& theLPB, - const Handle(BOPDS_PaveBlock)& thePB); - - Standard_EXPORT void MakeSplitEdge(const Standard_Integer theV, const Standard_Integer theF); - - Standard_EXPORT void GetEFPnts(const Standard_Integer nF1, - const Standard_Integer nF2, - IntSurf_ListOfPntOn2S& aListOfPnts); + Standard_EXPORT void PostTreatFF( + NCollection_IndexedDataMap& + theMSCPB, + NCollection_DataMap, + NCollection_List>>& theDMExEdges, + NCollection_DataMap& theDMNewSD, + const NCollection_IndexedMap>& theMicroPB, + const NCollection_IndexedMap& theVertsOnRejectedPB, + const occ::handle& theAllocator, + const Message_ProgressRange& theRange); + + Standard_EXPORT void FindPaveBlocks(const int theV, + const int theF, + NCollection_List>& theLPB); + + Standard_EXPORT void FillPaves(const int theV, + const int theE, + const int theF, + const NCollection_List>& theLPB, + const occ::handle& thePB); + + Standard_EXPORT void MakeSplitEdge(const int theV, const int theF); + + Standard_EXPORT void GetEFPnts(const int nF1, + const int nF2, + NCollection_List& aListOfPnts); //! Checks and puts paves created in EF intersections on the curve . - Standard_EXPORT void PutEFPavesOnCurve(const BOPDS_VectorOfCurve& theVC, - const Standard_Integer theIndex, - const TColStd_MapOfInteger& theMI, - const TColStd_MapOfInteger& theMVEF, - TColStd_DataMapOfIntegerReal& theMVTol, - TColStd_DataMapOfIntegerListOfInteger& aDMVLV); + Standard_EXPORT void PutEFPavesOnCurve(const NCollection_DynamicArray& theVC, + const int theIndex, + const NCollection_Map& theMI, + const NCollection_Map& theMVEF, + NCollection_DataMap& theMVTol, + NCollection_DataMap>& aDMVLV); //! Puts stick paves on the curve - Standard_EXPORT void PutStickPavesOnCurve(const TopoDS_Face& aF1, - const TopoDS_Face& aF2, - const TColStd_MapOfInteger& theMI, - const BOPDS_VectorOfCurve& theVC, - const Standard_Integer theIndex, - const TColStd_MapOfInteger& theMVStick, - TColStd_DataMapOfIntegerReal& theMVTol, - TColStd_DataMapOfIntegerListOfInteger& aDMVLV); + Standard_EXPORT void PutStickPavesOnCurve( + const TopoDS_Face& aF1, + const TopoDS_Face& aF2, + const NCollection_Map& theMI, + const NCollection_DynamicArray& theVC, + const int theIndex, + const NCollection_Map& theMVStick, + NCollection_DataMap& theMVTol, + NCollection_DataMap>& aDMVLV); //! Collects indices of vertices created in all intersections between //! two faces ( and ) to the map . //! Also, it collects indices of EF vertices to the map //! and indices of all subshapes of these two faces to the map. - Standard_EXPORT void GetStickVertices(const Standard_Integer nF1, - const Standard_Integer nF2, - TColStd_MapOfInteger& theMVStick, - TColStd_MapOfInteger& theMVEF, - TColStd_MapOfInteger& theMI); + Standard_EXPORT void GetStickVertices(const int nF1, + const int nF2, + NCollection_Map& theMVStick, + NCollection_Map& theMVEF, + NCollection_Map& theMI); //! Collects index nF and indices of all subshapes of the shape with index //! to the map . - Standard_EXPORT void GetFullShapeMap(const Standard_Integer nF, TColStd_MapOfInteger& theMI); + Standard_EXPORT void GetFullShapeMap(const int nF, NCollection_Map& theMI); //! Removes indices of vertices that are already on the //! curve from the map . //! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods. - Standard_EXPORT void RemoveUsedVertices(const BOPDS_VectorOfCurve& theVC, - TColStd_MapOfInteger& theMV); + Standard_EXPORT void RemoveUsedVertices(const NCollection_DynamicArray& theVC, + NCollection_Map& theMV); //! Puts the pave nV on the curve theNC. //! Parameter aType defines whether to check the pave with //! extended tolerance: //! 0 - do not perform the check; //! other - perform the check (aType goes to ExtendedTolerance). - Standard_EXPORT void PutPaveOnCurve(const Standard_Integer nV, - const Standard_Real theTolR3D, - const BOPDS_Curve& theNC, - const TColStd_MapOfInteger& theMI, - TColStd_DataMapOfIntegerReal& theMVTol, - TColStd_DataMapOfIntegerListOfInteger& aDMVLV, - const Standard_Integer aType = 0); + Standard_EXPORT void PutPaveOnCurve(const int nV, + const double theTolR3D, + const BOPDS_Curve& theNC, + const NCollection_Map& theMI, + NCollection_DataMap& theMVTol, + NCollection_DataMap>& aDMVLV, + const int aType = 0); //! Adds the existing edges for intersection with section edges //! by checking the possible intersection with the faces comparing //! pre-saved E-F distances with new tolerances. Standard_EXPORT void ProcessExistingPaveBlocks( - const Standard_Integer theInt, - const Standard_Integer theCur, - const Standard_Integer nF1, - const Standard_Integer nF2, - const TopoDS_Edge& theES, - const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, - BOPTools_BoxTree& thePBTree, - BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, - TopTools_DataMapOfShapeInteger& theMVI, - BOPDS_ListOfPaveBlock& theLPBC, - BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap, - BOPDS_MapOfPaveBlock& theMPB); + const int theInt, + const int theCur, + const int nF1, + const int nF2, + const TopoDS_Edge& theES, + const NCollection_IndexedMap>& theMPBOnIn, + BOPTools_BoxTree& thePBTree, + NCollection_IndexedDataMap& + theMSCPB, + NCollection_DataMap& theMVI, + NCollection_List>& theLPBC, + BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap, + NCollection_Map>& theMPB); //! Adds the existing edges from the map which interfere //! with the vertices from map to the post treatment of section edges. Standard_EXPORT void ProcessExistingPaveBlocks( - const Standard_Integer theInt, - const Standard_Integer nF1, - const Standard_Integer nF2, - const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, - BOPTools_BoxTree& thePBTree, - const TColStd_DataMapOfIntegerListOfInteger& theDMBV, - BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, - TopTools_DataMapOfShapeInteger& theMVI, - BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap, - BOPDS_MapOfPaveBlock& theMPB); + const int theInt, + const int nF1, + const int nF2, + const NCollection_IndexedMap>& theMPBOnIn, + BOPTools_BoxTree& thePBTree, + const NCollection_DataMap>& theDMBV, + NCollection_IndexedDataMap& + theMSCPB, + NCollection_DataMap& theMVI, + BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap, + NCollection_Map>& theMPB); //! Replaces existing pave block with new pave blocks . //! The list contains images of which were created in //! the post treatment of section edges. //! Tries to project the new edges on the faces contained in the . Standard_EXPORT void UpdateExistingPaveBlocks( - const Handle(BOPDS_PaveBlock)& thePB, - BOPDS_ListOfPaveBlock& theLPB, - const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); + const occ::handle& thePB, + NCollection_List>& theLPB, + const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); //! Treatment of vertices that were created in EE intersections. Standard_EXPORT void TreatNewVertices( - const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, - TopTools_IndexedDataMapOfShapeListOfShape& theImages); + const NCollection_IndexedDataMap& theMVCPB, + NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theImages); //! Put paves on the curve in case when //! is closed 3D-curve Standard_EXPORT void PutClosingPaveOnCurve(BOPDS_Curve& aNC); //! Keeps data for post treatment - Standard_EXPORT void PreparePostTreatFF(const Standard_Integer aInt, - const Standard_Integer aCur, - const Handle(BOPDS_PaveBlock)& aPB, - BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, - TopTools_DataMapOfShapeInteger& aMVI, - BOPDS_ListOfPaveBlock& aLPB); + Standard_EXPORT void PreparePostTreatFF( + const int aInt, + const int aCur, + const occ::handle& aPB, + NCollection_IndexedDataMap& + aMSCPB, + NCollection_DataMap& aMVI, + NCollection_List>& aLPB); //! Updates the information about faces - Standard_EXPORT void UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME, - const TColStd_DataMapOfIntegerInteger& theDMV, - const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); + Standard_EXPORT void UpdateFaceInfo( + NCollection_DataMap, + NCollection_List>>& theDME, + const NCollection_DataMap& theDMV, + const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap); //! Updates tolerance of vertex with index //! to make it interfere with edge. //! Returns TRUE if intersection happened. - Standard_EXPORT Standard_Boolean ForceInterfVE(const Standard_Integer nV, - Handle(BOPDS_PaveBlock)& aPB, - TColStd_MapOfInteger& theMEdges); + Standard_EXPORT bool ForceInterfVE(const int nV, + occ::handle& aPB, + NCollection_Map& theMEdges); //! Updates tolerance of vertex with index //! to make it interfere with face with index - Standard_EXPORT Standard_Boolean ForceInterfVF(const Standard_Integer nV, - const Standard_Integer nF); + Standard_EXPORT bool ForceInterfVF(const int nV, const int nF); //! Checks if there are any common or intersecting sub shapes //! between two planar faces. - Standard_EXPORT Standard_Boolean CheckPlanes(const Standard_Integer nF1, - const Standard_Integer nF2) const; + Standard_EXPORT bool CheckPlanes(const int nF1, const int nF2) const; //! Creates new edge from the edge nE with vertices nV1 and nV2 //! and returns the index of that new edge in the DS. - Standard_EXPORT Standard_Integer SplitEdge(const Standard_Integer nE, - const Standard_Integer nV1, - const Standard_Real aT1, - const Standard_Integer nV2, - const Standard_Real aT2); + Standard_EXPORT int SplitEdge(const int nE, + const int nV1, + const double aT1, + const int nV2, + const double aT2); //! Updates pave blocks which have the paves with indices contained //! in the map . - Standard_EXPORT void UpdatePaveBlocks(const TColStd_DataMapOfIntegerInteger& aDMNewSD); + Standard_EXPORT void UpdatePaveBlocks(const NCollection_DataMap& aDMNewSD); //! Updates tolerance vertex nV due to V/E interference. //! It always creates new vertex if nV is from arguments. //! @return DS index of updated vertex. - Standard_EXPORT Standard_Integer UpdateVertex(const Standard_Integer nV, - const Standard_Real aTolNew); + Standard_EXPORT int UpdateVertex(const int nV, const double aTolNew); Standard_EXPORT void UpdatePaveBlocksWithSDVertices(); @@ -492,25 +510,25 @@ protected: Standard_EXPORT void UpdateInterfsWithSDVertices(); - Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV, - const BOPDS_Curve& theNC, - const Standard_Real theTolR3D); + Standard_EXPORT bool EstimatePaveOnCurve(const int nV, + const BOPDS_Curve& theNC, + const double theTolR3D); - Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE, const Standard_Real aTolNew); + Standard_EXPORT void UpdateEdgeTolerance(const int nE, const double aTolNew); - Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger& theEdges); + Standard_EXPORT void RemovePaveBlocks(const NCollection_Map& theEdges); Standard_EXPORT void CorrectToleranceOfSE(); //! Reduce the intersection range using the common ranges of //! Edge/Edge interferences to avoid creation of close //! intersection vertices - Standard_EXPORT void ReduceIntersectionRange(const Standard_Integer theV1, - const Standard_Integer theV2, - const Standard_Integer theE, - const Standard_Integer theF, - Standard_Real& theTS1, - Standard_Real& theTS2); + Standard_EXPORT void ReduceIntersectionRange(const int theV1, + const int theV2, + const int theE, + const int theF, + double& theTS1, + double& theTS2); //! Gets the bounding box for the given Pave Block. //! If Pave Block has shrunk data it will be used to get the box, @@ -521,14 +539,14 @@ protected: //! it will be saved in the map . //! Returns FALSE in case the PB's range is less than the //! Precision::PConfusion(), otherwise returns TRUE. - Standard_EXPORT Standard_Boolean GetPBBox(const TopoDS_Edge& theE, - const Handle(BOPDS_PaveBlock)& thePB, - BOPAlgo_DataMapOfPaveBlockBndBox& thePBBox, - Standard_Real& theFirst, - Standard_Real& theLast, - Standard_Real& theSFirst, - Standard_Real& theSLast, - Bnd_Box& theBox); + Standard_EXPORT bool GetPBBox(const TopoDS_Edge& theE, + const occ::handle& thePB, + BOPAlgo_DataMapOfPaveBlockBndBox& thePBBox, + double& theFirst, + double& theLast, + double& theSFirst, + double& theSLast, + Bnd_Box& theBox); //! Treatment of the possible common zones, not detected by the //! Face/Face intersection algorithm, by intersection of each section edge @@ -539,12 +557,12 @@ protected: Standard_EXPORT void PutSEInOtherFaces(const Message_ProgressRange& theRange); //! Analyzes the results of interferences of sub-shapes of the shapes - //! looking for self-interfering entities by the following rules:
- //! 1. The Faces of the same shape considered interfering in case they:
- //! - Interfere with the other shapes in the same place (in the same vertex) or;
+ //! looking for self-interfering entities by the following rules: + //! 1. The Faces of the same shape considered interfering in case they: + //! - Interfere with the other shapes in the same place (in the same vertex) or; //! - Included in the same common block. //! 2. The Faces of the same shape considered interfering in case they - //! share the IN or SECTION edges.
+ //! share the IN or SECTION edges. //! In case self-interference is found the warning is added. Standard_EXPORT void CheckSelfInterference(); @@ -568,9 +586,10 @@ protected: //! Performs intersection of given pave blocks //! with all faces from arguments. - Standard_EXPORT void ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB, - const Message_ProgressRange& theRange, - const Standard_Boolean theAddInterf); + Standard_EXPORT void ForceInterfEF( + const NCollection_IndexedMap>& theMPB, + const Message_ProgressRange& theRange, + const bool theAddInterf); //! When all section edges are created and no increase of the tolerance //! of vertices put on the section edges is expected, make sure that @@ -585,8 +604,9 @@ protected: //! been put on other section edges with greater tolerance, which has caused //! increase of the tolerance value of the vertices. Standard_EXPORT void RemoveMicroSectionEdges( - BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, - BOPDS_IndexedMapOfPaveBlock& theMicroPB); + NCollection_IndexedDataMap& + theMSCPB, + NCollection_IndexedMap>& theMicroPB); //! Check all edges on the micro status and remove the positive ones Standard_EXPORT void RemoveMicroEdges(); @@ -594,13 +614,13 @@ protected: //! Auxiliary structure to hold the edge distance to the face struct EdgeRangeDistance { - Standard_Real First; - Standard_Real Last; - Standard_Real Distance; + double First; + double Last; + double Distance; - EdgeRangeDistance(const Standard_Real theFirst = 0.0, - const Standard_Real theLast = 0.0, - const Standard_Real theDistance = RealLast()) + EdgeRangeDistance(const double theFirst = 0.0, + const double theLast = 0.0, + const double theDistance = RealLast()) : First(theFirst), Last(theLast), Distance(theDistance) @@ -610,26 +630,26 @@ protected: protected: //! Analyzing Progress steps //! Filling steps for constant operations - Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const override; //! Filling steps for all other operations - Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const override; protected: //! Fields - TopTools_ListOfShape myArguments; - BOPDS_PDS myDS; - BOPDS_PIterator myIterator; - Handle(IntTools_Context) myContext; - BOPAlgo_SectionAttribute mySectionAttribute; - Standard_Boolean myNonDestructive; - Standard_Boolean myIsPrimary; - Standard_Boolean myAvoidBuildPCurve; - BOPAlgo_GlueEnum myGlue; + NCollection_List myArguments; + BOPDS_PDS myDS; + BOPDS_PIterator myIterator; + occ::handle myContext; + BOPAlgo_SectionAttribute mySectionAttribute; + bool myNonDestructive; + bool myIsPrimary; + bool myAvoidBuildPCurve; + BOPAlgo_GlueEnum myGlue; // clang-format off BOPAlgo_DataMapOfIntegerMapOfPaveBlock myFPBDone; //!< Fence map of intersected faces and pave blocks - TColStd_MapOfInteger myIncreasedSS; //!< Sub-shapes with increased tolerance during the operation - TColStd_MapOfInteger myVertsToAvoidExtension; //!< Vertices located close to E/E or E/F intersection points + NCollection_Map myIncreasedSS; //!< Sub-shapes with increased tolerance during the operation + NCollection_Map myVertsToAvoidExtension; //!< Vertices located close to E/E or E/F intersection points //! which has already been extended to cover the real intersection //! points, and should not be extended any longer to be put //! on a section curve. diff --git a/opencascade/BOPAlgo_RemoveFeatures.hxx b/opencascade/BOPAlgo_RemoveFeatures.hxx index ff8476a54..f3931bd7f 100644 --- a/opencascade/BOPAlgo_RemoveFeatures.hxx +++ b/opencascade/BOPAlgo_RemoveFeatures.hxx @@ -22,10 +22,11 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include //! The RemoveFeatures algorithm is intended for reconstruction of //! the shape by removal of the unwanted parts from it. These parts can @@ -116,9 +117,9 @@ //! Here is the example of usage of the algorithm: //! ~~~~ //! TopoDS_Shape aSolid = ...; // Input shape to remove the features from -//! TopTools_ListOfShape aFaces = ...; // Faces to remove from the shape -//! Standard_Boolean bRunParallel = ...; // Parallel processing mode -//! Standard_Boolean isHistoryNeeded = ...; // History support +//! NCollection_List aFaces = ...; // Faces to remove from the shape +//! bool bRunParallel = ...; // Parallel processing mode +//! bool isHistoryNeeded = ...; // History support //! //! BOPAlgo_RemoveFeatures aRF; // Feature removal algorithm //! aRF.SetShape(aSolid); // Set the shape @@ -152,9 +153,8 @@ public: public: //! @name Constructors //! Empty constructor BOPAlgo_RemoveFeatures() - : BOPAlgo_BuilderShape() - { - } + + = default; public: //! @name Setting input data for the algorithm //! Sets the shape for processing. @@ -171,26 +171,26 @@ public: //! @name Setting input data for the algorithm //! Adds the faces to remove from the input shape. //! @param[in] theFaces The list of shapes to extract the faces for removal. - void AddFacesToRemove(const TopTools_ListOfShape& theFaces) + void AddFacesToRemove(const NCollection_List& theFaces) { - TopTools_ListIteratorOfListOfShape it(theFaces); + NCollection_List::Iterator it(theFaces); for (; it.More(); it.Next()) myFacesToRemove.Append(it.Value()); } //! Returns the list of faces which have been requested for removal //! from the input shape. - const TopTools_ListOfShape& FacesToRemove() const { return myFacesToRemove; } + const NCollection_List& FacesToRemove() const { return myFacesToRemove; } public: //! @name Performing the operation //! Performs the operation - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; public: //! @name Clearing the contents of the algorithm //! Clears the contents of the algorithm from previous run, //! allowing reusing it for following removals. - virtual void Clear() Standard_OVERRIDE + void Clear() override { BOPAlgo_BuilderShape::Clear(); myInputShape.Nullify(); @@ -206,7 +206,7 @@ protected: //! @name Protected methods performing the removal //! If the input shape is not a solid, the method looks for the solids //! in and uses only them. All other shapes are simply removed. //! If no solids were found, the Error of unsupported type is returned. - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Prepares the faces to remove: //! - Gets only faces contained in the input solids; @@ -227,14 +227,17 @@ protected: //! @name Protected methods performing the removal //! @param[in] theAdjFacesHistory The history of the adjacent faces reconstruction; //! @param[in] theSolidsHistoryNeeded Defines whether the history of solids //! modifications should be tracked or not. - Standard_EXPORT void RemoveFeature(const TopoDS_Shape& theFeature, - const TopTools_IndexedMapOfShape& theSolids, - const TopTools_MapOfShape& theFeatureFacesMap, - const Standard_Boolean theHasAdjacentFaces, - const TopTools_IndexedDataMapOfShapeListOfShape& theAdjFaces, - const Handle(BRepTools_History)& theAdjFacesHistory, - const Standard_Boolean theSolidsHistoryNeeded, - const Message_ProgressRange& theRange); + Standard_EXPORT void RemoveFeature( + const TopoDS_Shape& theFeature, + const NCollection_IndexedMap& theSolids, + const NCollection_Map& theFeatureFacesMap, + const bool theHasAdjacentFaces, + const NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theAdjFaces, + const occ::handle& theAdjFacesHistory, + const bool theSolidsHistoryNeeded, + const Message_ProgressRange& theRange); //! Updates history with the removed features Standard_EXPORT void UpdateHistory(const Message_ProgressRange& theRange); @@ -247,18 +250,19 @@ protected: //! @name Protected methods performing the removal Standard_EXPORT void PostTreat(); //! Filling steps for constant operations - Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const override; protected: //! @name Fields // Inputs - TopoDS_Shape myInputShape; //!< Input shape - TopTools_ListOfShape myFacesToRemove; //!< Faces to remove + TopoDS_Shape myInputShape; //!< Input shape + NCollection_List myFacesToRemove; //!< Faces to remove // Intermediate - TopTools_ListOfShape myFeatures; //!< List of not connected features to remove - //! (each feature is a compound of faces) - TopTools_IndexedMapOfShape myInputsMap; //!< Map of all sub-shapes of the input shape + NCollection_List myFeatures; //!< List of not connected features to remove + //! (each feature is a compound of faces) + NCollection_IndexedMap + myInputsMap; //!< Map of all sub-shapes of the input shape }; #endif // _BOPAlgo_RemoveFeatures_HeaderFile diff --git a/opencascade/BOPAlgo_Section.hxx b/opencascade/BOPAlgo_Section.hxx index 0e962606b..e6bd8a43e 100644 --- a/opencascade/BOPAlgo_Section.hxx +++ b/opencascade/BOPAlgo_Section.hxx @@ -37,22 +37,21 @@ public: //! Empty constructor Standard_EXPORT BOPAlgo_Section(); - Standard_EXPORT virtual ~BOPAlgo_Section(); + Standard_EXPORT ~BOPAlgo_Section() override; //! Constructor with allocator - Standard_EXPORT BOPAlgo_Section(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_Section(const occ::handle& theAllocator); protected: //! Checks the data before performing the operation - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Combine the result of section operation Standard_EXPORT virtual void BuildSection(const Message_ProgressRange& theRange); //! Performs calculations using prepared Filler object - Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF, - const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void PerformInternal1(const BOPAlgo_PaveFiller& thePF, + const Message_ProgressRange& theRange) override; protected: //! List of operations to be supported by the Progress Indicator. @@ -69,11 +68,11 @@ protected: }; //! Filling steps for constant operations - Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, - BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPIConstants(const double theWhole, + BOPAlgo_PISteps& theSteps) const override; //! Filling steps for all other operations - Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const override; }; #endif // _BOPAlgo_Section_HeaderFile diff --git a/opencascade/BOPAlgo_SectionAttribute.hxx b/opencascade/BOPAlgo_SectionAttribute.hxx index 6e7fe922d..4a3e2a448 100644 --- a/opencascade/BOPAlgo_SectionAttribute.hxx +++ b/opencascade/BOPAlgo_SectionAttribute.hxx @@ -23,16 +23,16 @@ class BOPAlgo_SectionAttribute public: //! Default constructor BOPAlgo_SectionAttribute() - : myApproximation(Standard_True), - myPCurve1(Standard_True), - myPCurve2(Standard_True) + : myApproximation(true), + myPCurve1(true), + myPCurve2(true) { } //! Constructor - BOPAlgo_SectionAttribute(const Standard_Boolean theAproximation, - const Standard_Boolean thePCurveOnS1, - const Standard_Boolean thePCurveOnS2) + BOPAlgo_SectionAttribute(const bool theAproximation, + const bool thePCurveOnS1, + const bool thePCurveOnS2) : myApproximation(theAproximation), myPCurve1(thePCurveOnS1), myPCurve2(thePCurveOnS2) @@ -40,28 +40,27 @@ public: } //! Sets the Approximation flag - void Approximation(const Standard_Boolean theApprox) { myApproximation = theApprox; } + void Approximation(const bool theApprox) { myApproximation = theApprox; } //! Sets the PCurveOnS1 flag - void PCurveOnS1(const Standard_Boolean thePCurveOnS1) { myPCurve1 = thePCurveOnS1; } + void PCurveOnS1(const bool thePCurveOnS1) { myPCurve1 = thePCurveOnS1; } //! Sets the PCurveOnS2 flag - void PCurveOnS2(const Standard_Boolean thePCurveOnS2) { myPCurve2 = thePCurveOnS2; } + void PCurveOnS2(const bool thePCurveOnS2) { myPCurve2 = thePCurveOnS2; } //! Returns the Approximation flag - Standard_Boolean Approximation() const { return myApproximation; } + bool Approximation() const { return myApproximation; } //! Returns the PCurveOnS1 flag - Standard_Boolean PCurveOnS1() const { return myPCurve1; } + bool PCurveOnS1() const { return myPCurve1; } //! Returns the PCurveOnS2 flag - Standard_Boolean PCurveOnS2() const { return myPCurve2; } + bool PCurveOnS2() const { return myPCurve2; } -protected: private: - Standard_Boolean myApproximation; - Standard_Boolean myPCurve1; - Standard_Boolean myPCurve2; + bool myApproximation; + bool myPCurve1; + bool myPCurve2; }; #endif // _BOPAlgo_SectionAttribute_HeaderFile diff --git a/opencascade/BOPAlgo_ShellSplitter.hxx b/opencascade/BOPAlgo_ShellSplitter.hxx index 3642f1e92..1c075a554 100644 --- a/opencascade/BOPAlgo_ShellSplitter.hxx +++ b/opencascade/BOPAlgo_ShellSplitter.hxx @@ -19,11 +19,11 @@ #include #include -#include -#include +#include #include +#include #include -#include +#include class TopoDS_Shape; //! The class provides the splitting of the set of connected faces @@ -35,34 +35,32 @@ public: //! empty constructor Standard_EXPORT BOPAlgo_ShellSplitter(); - Standard_EXPORT virtual ~BOPAlgo_ShellSplitter(); + Standard_EXPORT ~BOPAlgo_ShellSplitter() override; //! constructor - Standard_EXPORT BOPAlgo_ShellSplitter(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_ShellSplitter(const occ::handle& theAllocator); //! adds a face to process Standard_EXPORT void AddStartElement(const TopoDS_Shape& theS); //! return the faces to process - Standard_EXPORT const TopTools_ListOfShape& StartElements() const; + Standard_EXPORT const NCollection_List& StartElements() const; //! performs the algorithm - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! returns the loops - Standard_EXPORT const TopTools_ListOfShape& Shells() const; + Standard_EXPORT const NCollection_List& Shells() const; Standard_EXPORT static void SplitBlock(BOPTools_ConnexityBlock& theCB); protected: Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange); - TopTools_ListOfShape myStartShapes; - TopTools_ListOfShape myShells; - BOPTools_ListOfConnexityBlock myLCB; - -private: + NCollection_List myStartShapes; + NCollection_List myShells; + NCollection_List myLCB; }; #endif // _BOPAlgo_ShellSplitter_HeaderFile diff --git a/opencascade/BOPAlgo_Splitter.hxx b/opencascade/BOPAlgo_Splitter.hxx index 418ad5781..35be8ac68 100644 --- a/opencascade/BOPAlgo_Splitter.hxx +++ b/opencascade/BOPAlgo_Splitter.hxx @@ -22,27 +22,27 @@ #include //! The **Splitter algorithm** is the algorithm for splitting a group of -//! arbitrary shapes by the other group of arbitrary shapes.
-//! The arguments of the operation are divided on two groups:
-//! *Objects* - shapes that will be split;
-//! *Tools* - shapes by which the *Objects* will be split.
+//! arbitrary shapes by the other group of arbitrary shapes. +//! The arguments of the operation are divided on two groups: +//! *Objects* - shapes that will be split; +//! *Tools* - shapes by which the *Objects* will be split. //! The result of the operation contains only the split parts -//! of the shapes from the group of *Objects*.
+//! of the shapes from the group of *Objects*. //! The split parts of the shapes from the group of *Tools* are excluded -//! from the result.
+//! from the result. //! The shapes can be split by the other shapes from the same group //! (in case these shapes are interfering). //! //! The class is a General Fuse based algorithm. Thus, all options //! of the General Fuse algorithm such as Fuzzy mode, safe processing mode, //! parallel processing mode, gluing mode and history support are also -//! available in this algorithm.
+//! available in this algorithm. //! There is no requirement on the existence of the *Tools* shapes. //! And if there are no *Tools* shapes, the result of the splitting //! operation will be equivalent to the General Fuse result. //! //! The implementation of the algorithm is minimal - only the methods -//! CheckData() and Perform() have been overridden.
+//! CheckData() and Perform() have been overridden. //! The method BOPAlgo_Builder::BuildResult(), which adds the split parts of the arguments //! into result, does not have to be overridden, because its native implementation //! performs the necessary actions for the Splitter algorithm - it adds @@ -54,22 +54,22 @@ public: //! Empty constructor Standard_EXPORT BOPAlgo_Splitter(); - Standard_EXPORT virtual ~BOPAlgo_Splitter(); + Standard_EXPORT ~BOPAlgo_Splitter() override; - Standard_EXPORT BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_Splitter(const occ::handle& theAllocator); //! Performs the operation - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; protected: //! Checks the input data - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; //! Adds images of the argument shapes into result. //! When called the for the last time (for compound) it rebuilds the result //! shape to avoid multiple enclosure into compounds. - Standard_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType) Standard_OVERRIDE; + Standard_EXPORT void BuildResult(const TopAbs_ShapeEnum theType) override; }; #endif // _BOPAlgo_Splitter_HeaderFile diff --git a/opencascade/BOPAlgo_Tools.hxx b/opencascade/BOPAlgo_Tools.hxx index 5cbb14a6c..6b6079470 100644 --- a/opencascade/BOPAlgo_Tools.hxx +++ b/opencascade/BOPAlgo_Tools.hxx @@ -18,18 +18,18 @@ #include #include -#include -#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include class BOPDS_PaveBlock; @@ -43,12 +43,12 @@ class BOPAlgo_Tools public: //! Makes the chains of the connected elements from the given convexity map template - static void MakeBlocks(const TheMap& theMILI, - TheList& theMBlocks, - const Handle(NCollection_BaseAllocator)& theAllocator) + static void MakeBlocks(const TheMap& theMILI, + TheList& theMBlocks, + const occ::handle& theAllocator) { NCollection_Map aMFence; - Standard_Integer i, aNb = theMILI.Extent(); + int i, aNb = theMILI.Extent(); for (i = 1; i <= aNb; ++i) { const typename TheMap::key_type& n = theMILI.FindKey(i); @@ -81,10 +81,10 @@ public: //! Fills the map with the connected entities template - static void FillMap(const TheType& n1, - const TheType& n2, - TheMap& theMILI, - const Handle(NCollection_BaseAllocator)& theAllocator) + static void FillMap(const TheType& n1, + const TheType& n2, + TheMap& theMILI, + const occ::handle& theAllocator) { typename TheMap::value_type* pList1 = theMILI.ChangeSeek(n1); if (!pList1) @@ -101,79 +101,81 @@ public: pList2->Append(n1); } - Standard_EXPORT static void FillMap(const Handle(BOPDS_PaveBlock)& thePB1, - const Standard_Integer theF, - BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMILI, - const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT static void FillMap( + const occ::handle& thePB1, + const int theF, + NCollection_IndexedDataMap, NCollection_List>& theMILI, + const occ::handle& theAllocator); //! Create Common Blocks from the groups of pave blocks of //! connection map. Standard_EXPORT static void PerformCommonBlocks( - BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMBlocks, - const Handle(NCollection_BaseAllocator)& theAllocator, - BOPDS_PDS& theDS, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + NCollection_IndexedDataMap, + NCollection_List>>& theMBlocks, + const occ::handle& theAllocator, + BOPDS_PDS& theDS, + const occ::handle& theContext = occ::handle()); //! Create Common Blocks on faces using the PB->Faces connection map . Standard_EXPORT static void PerformCommonBlocks( - const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks, - const Handle(NCollection_BaseAllocator)& theAllocator, - BOPDS_PDS& pDS, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - Standard_EXPORT static Standard_Real ComputeToleranceOfCB( - const Handle(BOPDS_CommonBlock)& theCB, - const BOPDS_PDS theDS, - const Handle(IntTools_Context)& theContext); - - //! Creates planar wires from the given edges.
+ const NCollection_IndexedDataMap, NCollection_List>& + theMBlocks, + const occ::handle& theAllocator, + BOPDS_PDS& pDS, + const occ::handle& theContext = occ::handle()); + + Standard_EXPORT static double ComputeToleranceOfCB( + const occ::handle& theCB, + const BOPDS_PDS theDS, + const occ::handle& theContext); + + //! Creates planar wires from the given edges. //! The input edges are expected to be planar. And for the performance - //! sake the method does not check if the edges are really planar.
- //! Thus, the result wires will also be not planar if the input edges are not planar.
+ //! sake the method does not check if the edges are really planar. + //! Thus, the result wires will also be not planar if the input edges are not planar. //! The edges may be not shared, but the resulting wires will be sharing the - //! coinciding parts and intersecting parts.
- //! The output wires may be non-manifold and contain free and multi-connected vertices.
+ //! coinciding parts and intersecting parts. + //! The output wires may be non-manifold and contain free and multi-connected vertices. //! Parameters: - //! - input edges;
- //! - output wires;
+ //! - input edges; + //! - output wires; //! - boolean flag which defines whether the input edges are already - //! shared or have to be intersected;
+ //! shared or have to be intersected; //! - the angular tolerance which will be used for distinguishing //! the planes in which the edges are located. Default value is - //! 1.e-8 which is used for intersection of planes in IntTools_FaceFace.
- //! Method returns the following error statuses:
- //! 0 - in case of success (at least one wire has been built);
- //! 1 - in case there are no edges in the given shape;
- //! 2 - sharing of the edges has failed.
- Standard_EXPORT static Standard_Integer EdgesToWires( - const TopoDS_Shape& theEdges, - TopoDS_Shape& theWires, - const Standard_Boolean theShared = Standard_False, - const Standard_Real theAngTol = 1.e-8); - - //! Creates planar faces from given planar wires.
- //! The method does not check if the wires are really planar.
- //! The input wires may be non-manifold but should be shared.
+ //! 1.e-8 which is used for intersection of planes in IntTools_FaceFace. + //! Method returns the following error statuses: + //! 0 - in case of success (at least one wire has been built); + //! 1 - in case there are no edges in the given shape; + //! 2 - sharing of the edges has failed. + Standard_EXPORT static int EdgesToWires(const TopoDS_Shape& theEdges, + TopoDS_Shape& theWires, + const bool theShared = false, + const double theAngTol = 1.e-8); + + //! Creates planar faces from given planar wires. + //! The method does not check if the wires are really planar. + //! The input wires may be non-manifold but should be shared. //! The wires located in the same planes and included into other wires will create - //! holes in the faces built from outer wires.
+ //! holes in the faces built from outer wires. //! The tolerance values of the input shapes may be modified during the operation - //! due to projection of the edges on the planes for creation of 2D curves.
+ //! due to projection of the edges on the planes for creation of 2D curves. //! Parameters: - //! - the given wires;
- //! - the output faces;
+ //! - the given wires; + //! - the output faces; //! - the angular tolerance for distinguishing the planes in which //! the wires are located. Default value is 1.e-8 which is used - //! for intersection of planes in IntTools_FaceFace.
- //! Method returns TRUE in case of success, i.e. at least one face has been built.
- Standard_EXPORT static Standard_Boolean WiresToFaces(const TopoDS_Shape& theWires, - TopoDS_Shape& theFaces, - const Standard_Real theAngTol = 1.e-8); + //! for intersection of planes in IntTools_FaceFace. + //! Method returns TRUE in case of success, i.e. at least one face has been built. + Standard_EXPORT static bool WiresToFaces(const TopoDS_Shape& theWires, + TopoDS_Shape& theFaces, + const double theAngTol = 1.e-8); //! Finds chains of intersecting vertices Standard_EXPORT static void IntersectVertices( - const TopTools_IndexedDataMapOfShapeReal& theVertices, - const Standard_Real theFuzzyValue, - TopTools_ListOfListOfShape& theChains); + const NCollection_IndexedDataMap& theVertices, + const double theFuzzyValue, + NCollection_List>& theChains); //! Classifies the faces relatively solids . //! The IN faces for solids are stored into output data map . @@ -189,14 +191,20 @@ public: //! do not have any geometrically coinciding parts without topological //! sharing of these parts Standard_EXPORT static void ClassifyFaces( - const TopTools_ListOfShape& theFaces, - const TopTools_ListOfShape& theSolids, - const Standard_Boolean theRunParallel, - Handle(IntTools_Context)& theContext, - TopTools_IndexedDataMapOfShapeListOfShape& theInParts, - const TopTools_DataMapOfShapeBox& theShapeBoxMap = TopTools_DataMapOfShapeBox(), - const TopTools_DataMapOfShapeListOfShape& theSolidsIF = TopTools_DataMapOfShapeListOfShape(), - const Message_ProgressRange& theRange = Message_ProgressRange()); + const NCollection_List& theFaces, + const NCollection_List& theSolids, + const bool theRunParallel, + occ::handle& theContext, + NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theInParts, + const NCollection_DataMap& theShapeBoxMap = + NCollection_DataMap(), + const NCollection_DataMap, + TopTools_ShapeMapHasher>& theSolidsIF = + NCollection_DataMap, TopTools_ShapeMapHasher>(), + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Classifies the given parts relatively the given solids and //! fills the solids with the parts classified as INTERNAL. @@ -205,10 +213,13 @@ public: //! @param theParts - The parts to classify relatively solids //! @param theImages - Possible images of the parts that has to be classified //! @param theContext - cached geometrical tools to speed-up classifications - Standard_EXPORT static void FillInternals(const TopTools_ListOfShape& theSolids, - const TopTools_ListOfShape& theParts, - const TopTools_DataMapOfShapeListOfShape& theImages, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static void FillInternals( + const NCollection_List& theSolids, + const NCollection_List& theParts, + const NCollection_DataMap, + TopTools_ShapeMapHasher>& theImages, + const occ::handle& theContext); //! Computes the transformation needed to move the objects //! to the given point to increase the quality of computations. @@ -219,13 +230,11 @@ public: //! @param theTrsf the computed transformation //! @param thePoint the Point to compute transformation to //! @param theCriteria the Criteria to check whether thranformation is required - Standard_EXPORT static Standard_Boolean TrsfToPoint(const Bnd_Box& theBox1, - const Bnd_Box& theBox2, - gp_Trsf& theTrsf, - const gp_Pnt& thePoint = gp_Pnt(0.0, - 0.0, - 0.0), - const Standard_Real theCriteria = 1.e+5); + Standard_EXPORT static bool TrsfToPoint(const Bnd_Box& theBox1, + const Bnd_Box& theBox2, + gp_Trsf& theTrsf, + const gp_Pnt& thePoint = gp_Pnt(0.0, 0.0, 0.0), + const double theCriteria = 1.e+5); }; #endif // _BOPAlgo_Tools_HeaderFile diff --git a/opencascade/BOPAlgo_ToolsProvider.hxx b/opencascade/BOPAlgo_ToolsProvider.hxx index 2d08d80d7..2db8ef5cc 100644 --- a/opencascade/BOPAlgo_ToolsProvider.hxx +++ b/opencascade/BOPAlgo_ToolsProvider.hxx @@ -30,23 +30,23 @@ public: //! Empty constructor Standard_EXPORT BOPAlgo_ToolsProvider(); - Standard_EXPORT BOPAlgo_ToolsProvider(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_ToolsProvider(const occ::handle& theAllocator); //! Clears internal fields and arguments - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; //! Adds Tool argument of the operation Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape); //! Adds the Tool arguments of the operation - Standard_EXPORT virtual void SetTools(const TopTools_ListOfShape& theShapes); + Standard_EXPORT virtual void SetTools(const NCollection_List& theShapes); //! Returns the Tool arguments of the operation - const TopTools_ListOfShape& Tools() const { return myTools; } + const NCollection_List& Tools() const { return myTools; } protected: - TopTools_ListOfShape myTools; - TopTools_MapOfShape myMapTools; + NCollection_List myTools; + NCollection_Map myMapTools; }; #endif // _BOPAlgo_ToolsProvider_HeaderFile diff --git a/opencascade/BOPAlgo_WireEdgeSet.hxx b/opencascade/BOPAlgo_WireEdgeSet.hxx index 4cb540338..108f8026e 100644 --- a/opencascade/BOPAlgo_WireEdgeSet.hxx +++ b/opencascade/BOPAlgo_WireEdgeSet.hxx @@ -24,7 +24,8 @@ #include #include -#include +#include +#include class TopoDS_Face; class TopoDS_Shape; @@ -36,7 +37,7 @@ public: BOPAlgo_WireEdgeSet(); virtual ~BOPAlgo_WireEdgeSet(); - BOPAlgo_WireEdgeSet(const Handle(NCollection_BaseAllocator)& theAllocator); + BOPAlgo_WireEdgeSet(const occ::handle& theAllocator); void Clear(); @@ -46,18 +47,16 @@ public: void AddStartElement(const TopoDS_Shape& sS); - const TopTools_ListOfShape& StartElements() const; + const NCollection_List& StartElements() const; void AddShape(const TopoDS_Shape& sS); - const TopTools_ListOfShape& Shapes() const; + const NCollection_List& Shapes() const; protected: - TopoDS_Face myFace; - TopTools_ListOfShape myStartShapes; - TopTools_ListOfShape myShapes; - -private: + TopoDS_Face myFace; + NCollection_List myStartShapes; + NCollection_List myShapes; }; #include diff --git a/opencascade/BOPAlgo_WireEdgeSet.lxx b/opencascade/BOPAlgo_WireEdgeSet.lxx index a93507e9b..3e1fbc93f 100644 --- a/opencascade/BOPAlgo_WireEdgeSet.lxx +++ b/opencascade/BOPAlgo_WireEdgeSet.lxx @@ -15,89 +15,69 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : -// purpose : -//======================================================================= -inline BOPAlgo_WireEdgeSet::BOPAlgo_WireEdgeSet() {} - -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + +inline BOPAlgo_WireEdgeSet::BOPAlgo_WireEdgeSet() = default; + +//================================================================================================= + inline BOPAlgo_WireEdgeSet::BOPAlgo_WireEdgeSet( - const Handle(NCollection_BaseAllocator)& theAllocator) + const occ::handle& theAllocator) : myStartShapes(theAllocator), myShapes(theAllocator) { } -//======================================================================= -// function : ~ -// purpose : -//======================================================================= -inline BOPAlgo_WireEdgeSet::~BOPAlgo_WireEdgeSet() {} +//================================================================================================= + +inline BOPAlgo_WireEdgeSet::~BOPAlgo_WireEdgeSet() = default; + +//================================================================================================= -//======================================================================= -// function : Clear -// purpose : -//======================================================================= inline void BOPAlgo_WireEdgeSet::Clear() { myStartShapes.Clear(); myShapes.Clear(); } -//======================================================================= -// function : SetFace -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPAlgo_WireEdgeSet::SetFace(const TopoDS_Face& aF) { myFace = aF; } -//======================================================================= -// function : Face -// purpose : -//======================================================================= +//================================================================================================= + inline const TopoDS_Face& BOPAlgo_WireEdgeSet::Face() const { return myFace; } -//======================================================================= -// function : AddStartElement -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPAlgo_WireEdgeSet::AddStartElement(const TopoDS_Shape& aE) { myStartShapes.Append(aE); } -//======================================================================= -// function : StartElements -// purpose : -//======================================================================= -inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::StartElements() const +//================================================================================================= + +inline const NCollection_List& BOPAlgo_WireEdgeSet::StartElements() const { return myStartShapes; } -//======================================================================= -// function : AddShape -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPAlgo_WireEdgeSet::AddShape(const TopoDS_Shape& aW) { myShapes.Append(aW); } -//======================================================================= -// function : Shapes -// purpose : -//======================================================================= -inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::Shapes() const +//================================================================================================= + +inline const NCollection_List& BOPAlgo_WireEdgeSet::Shapes() const { return myShapes; } diff --git a/opencascade/BOPAlgo_WireSplitter.hxx b/opencascade/BOPAlgo_WireSplitter.hxx index 3d02b5e36..43b9f86e2 100644 --- a/opencascade/BOPAlgo_WireSplitter.hxx +++ b/opencascade/BOPAlgo_WireSplitter.hxx @@ -20,12 +20,12 @@ #include #include -#include -#include +#include #include +#include #include #include -#include +#include class TopoDS_Wire; class TopoDS_Face; @@ -40,37 +40,37 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT BOPAlgo_WireSplitter(); - Standard_EXPORT virtual ~BOPAlgo_WireSplitter(); + Standard_EXPORT ~BOPAlgo_WireSplitter() override; - Standard_EXPORT BOPAlgo_WireSplitter(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPAlgo_WireSplitter(const occ::handle& theAllocator); Standard_EXPORT void SetWES(const BOPAlgo_WireEdgeSet& theWES); Standard_EXPORT BOPAlgo_WireEdgeSet& WES(); //! Sets the context for the algorithm - Standard_EXPORT void SetContext(const Handle(IntTools_Context)& theContext); + Standard_EXPORT void SetContext(const occ::handle& theContext); //! Returns the context - Standard_EXPORT const Handle(IntTools_Context)& Context(); + Standard_EXPORT const occ::handle& Context(); - Standard_EXPORT virtual void Perform( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; - static void MakeWire(TopTools_ListOfShape& theLE, TopoDS_Wire& theW); + static void MakeWire(NCollection_List& theLE, TopoDS_Wire& theW); - Standard_EXPORT static void SplitBlock(const TopoDS_Face& theF, - BOPTools_ConnexityBlock& theCB, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static void SplitBlock(const TopoDS_Face& theF, + BOPTools_ConnexityBlock& theCB, + const occ::handle& theContext); protected: - Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + Standard_EXPORT void CheckData() override; Standard_EXPORT void MakeWires(const Message_ProgressRange& theRange); - BOPAlgo_PWireEdgeSet myWES; - BOPTools_ListOfConnexityBlock myLCB; - Handle(IntTools_Context) myContext; + BOPAlgo_PWireEdgeSet myWES; + NCollection_List myLCB; + occ::handle myContext; }; #include diff --git a/opencascade/BOPAlgo_WireSplitter.lxx b/opencascade/BOPAlgo_WireSplitter.lxx index 90b201370..5d8d07641 100644 --- a/opencascade/BOPAlgo_WireSplitter.lxx +++ b/opencascade/BOPAlgo_WireSplitter.lxx @@ -17,18 +17,16 @@ #include -//======================================================================= -// function : BOPAlgo_EdgeInfo -// purpose : -//======================================================================= +//================================================================================================= + class BOPAlgo_EdgeInfo { public: // BOPAlgo_EdgeInfo() - : myPassed(Standard_False), - myInFlag(Standard_False), - myIsInside(Standard_False), + : myPassed(false), + myInFlag(false), + myIsInside(false), myAngle(-1.) {}; // @@ -38,58 +36,51 @@ public: const TopoDS_Edge& Edge() const { return myEdge; }; // - void SetPassed(const Standard_Boolean theFlag) { myPassed = theFlag; }; + void SetPassed(const bool theFlag) { myPassed = theFlag; }; // - Standard_Boolean Passed() const { return myPassed; }; + bool Passed() const { return myPassed; }; // - void SetInFlag(const Standard_Boolean theFlag) { myInFlag = theFlag; }; + void SetInFlag(const bool theFlag) { myInFlag = theFlag; }; // - Standard_Boolean IsIn() const { return myInFlag; }; + bool IsIn() const { return myInFlag; }; // - void SetAngle(const Standard_Real theAngle) { myAngle = theAngle; }; + void SetAngle(const double theAngle) { myAngle = theAngle; }; // - Standard_Real Angle() const { return myAngle; }; + double Angle() const { return myAngle; }; // - Standard_Boolean IsInside() const { return myIsInside; }; + bool IsInside() const { return myIsInside; }; // - void SetIsInside(const Standard_Boolean theIsInside) { myIsInside = theIsInside; }; + void SetIsInside(const bool theIsInside) { myIsInside = theIsInside; }; // protected: - TopoDS_Edge myEdge; - Standard_Boolean myPassed; - Standard_Boolean myInFlag; - Standard_Boolean myIsInside; - Standard_Real myAngle; + TopoDS_Edge myEdge; + bool myPassed; + bool myInFlag; + bool myIsInside; + double myAngle; }; #include -typedef NCollection_List BOPAlgo_ListOfEdgeInfo; -typedef BOPAlgo_ListOfEdgeInfo::Iterator BOPAlgo_ListIteratorOfListOfEdgeInfo; #include #include -typedef NCollection_IndexedDataMap - BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo; +//================================================================================================= -//======================================================================= -// function : MakeWire -// purpose : -//======================================================================= -inline void BOPAlgo_WireSplitter::MakeWire(TopTools_ListOfShape& aLE, TopoDS_Wire& aWire) +inline void BOPAlgo_WireSplitter::MakeWire(NCollection_List& aLE, TopoDS_Wire& aWire) { BRep_Builder aBB; aBB.MakeWire(aWire); // - TopTools_ListIteratorOfListOfShape aIt(aLE); + NCollection_List::Iterator aIt(aLE); for (; aIt.More(); aIt.Next()) { aBB.Add(aWire, aIt.Value()); diff --git a/opencascade/BOPDS_CommonBlock.hxx b/opencascade/BOPDS_CommonBlock.hxx index d504f0e11..f4ea79b89 100644 --- a/opencascade/BOPDS_CommonBlock.hxx +++ b/opencascade/BOPDS_CommonBlock.hxx @@ -18,21 +18,18 @@ #include #include -#include +#include #include #include #include -#include +#include class BOPDS_PaveBlock; -class BOPDS_CommonBlock; -DEFINE_STANDARD_HANDLE(BOPDS_CommonBlock, Standard_Transient) - //! The class BOPDS_CommonBlock is to store the information //! about pave blocks that have geometrical coincidence -//! (in terms of a tolerance) with:
-//! a) other pave block(s);
-//! b) face(s).
+//! (in terms of a tolerance) with: +//! a) other pave block(s); +//! b) face(s). //! First pave block in the common block (real pave block) //! is always a pave block with the minimal index of the original edge. class BOPDS_CommonBlock : public Standard_Transient @@ -44,107 +41,105 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - Standard_EXPORT BOPDS_CommonBlock(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_CommonBlock(const occ::handle& theAllocator); //! Modifier //! Adds the pave block to the list of pave blocks //! of the common block - Standard_EXPORT void AddPaveBlock(const Handle(BOPDS_PaveBlock)& aPB); + Standard_EXPORT void AddPaveBlock(const occ::handle& aPB); //! Modifier //! Sets the list of pave blocks for the common block - Standard_EXPORT void SetPaveBlocks(const BOPDS_ListOfPaveBlock& aLPB); + Standard_EXPORT void SetPaveBlocks(const NCollection_List>& aLPB); //! Modifier //! Adds the index of the face //! to the list of indices of faces //! of the common block - Standard_EXPORT void AddFace(const Standard_Integer aF); + Standard_EXPORT void AddFace(const int aF); //! Modifier //! Sets the list of indices of faces //! of the common block - Standard_EXPORT void SetFaces(const TColStd_ListOfInteger& aLF); + Standard_EXPORT void SetFaces(const NCollection_List& aLF); //! Modifier //! Appends the list of indices of faces //! to the list of indices of faces //! of the common block (the input list is emptied) - Standard_EXPORT void AppendFaces(TColStd_ListOfInteger& aLF); + Standard_EXPORT void AppendFaces(NCollection_List& aLF); //! Selector //! Returns the list of pave blocks //! of the common block - Standard_EXPORT const BOPDS_ListOfPaveBlock& PaveBlocks() const; + Standard_EXPORT const NCollection_List>& PaveBlocks() const; //! Selector //! Returns the list of indices of faces //! of the common block - Standard_EXPORT const TColStd_ListOfInteger& Faces() const; + Standard_EXPORT const NCollection_List& Faces() const; //! Selector //! Returns the first pave block //! of the common block - Standard_EXPORT const Handle(BOPDS_PaveBlock)& PaveBlock1() const; + Standard_EXPORT const occ::handle& PaveBlock1() const; //! Selector //! Returns the pave block that belongs //! to the edge with index - Standard_EXPORT Handle(BOPDS_PaveBlock)& PaveBlockOnEdge(const Standard_Integer theIndex); + Standard_EXPORT occ::handle& PaveBlockOnEdge(const int theIndex); //! Query //! Returns true if the common block contains //! a pave block that belongs //! to the face with index - Standard_EXPORT Standard_Boolean IsPaveBlockOnFace(const Standard_Integer theIndex) const; + Standard_EXPORT bool IsPaveBlockOnFace(const int theIndex) const; //! Query //! Returns true if the common block contains //! a pave block that belongs //! to the edge with index - Standard_EXPORT Standard_Boolean IsPaveBlockOnEdge(const Standard_Integer theIndex) const; + Standard_EXPORT bool IsPaveBlockOnEdge(const int theIndex) const; //! Query //! Returns true if the common block contains - //! a pave block that is equal to - Standard_EXPORT Standard_Boolean Contains(const Handle(BOPDS_PaveBlock)& thePB) const; + //! a pave block that is equal to + Standard_EXPORT bool Contains(const occ::handle& thePB) const; //! Query //! Returns true if the common block contains - //! the face with index equal to - Standard_EXPORT Standard_Boolean Contains(const Standard_Integer theF) const; + //! the face with index equal to + Standard_EXPORT bool Contains(const int theF) const; //! Modifier //! Assign the index as the edge index //! to all pave blocks of the common block - Standard_EXPORT void SetEdge(const Standard_Integer theEdge); + Standard_EXPORT void SetEdge(const int theEdge); //! Selector //! Returns the index of the edge - //! of all pave blocks of the common block - Standard_EXPORT Standard_Integer Edge() const; + //! of all pave blocks of the common block + Standard_EXPORT int Edge() const; Standard_EXPORT void Dump() const; //! Moves the pave blocks in the list to make the given //! pave block to be the first. //! It will be representative for the whole group. - Standard_EXPORT void SetRealPaveBlock(const Handle(BOPDS_PaveBlock)& thePB); + Standard_EXPORT void SetRealPaveBlock(const occ::handle& thePB); //! Sets the tolerance for the common block - void SetTolerance(const Standard_Real theTol) { myTolerance = theTol; } + void SetTolerance(const double theTol) { myTolerance = theTol; } //! Return the tolerance of common block - Standard_Real Tolerance() const { return myTolerance; } + double Tolerance() const { return myTolerance; } DEFINE_STANDARD_RTTIEXT(BOPDS_CommonBlock, Standard_Transient) protected: - BOPDS_ListOfPaveBlock myPaveBlocks; //!< Pave blocks of the common block - TColStd_ListOfInteger myFaces; //!< Faces on which the pave blocks are lying - Standard_Real myTolerance; //!< Tolerance of the common block - -private: + NCollection_List> myPaveBlocks; //!< Pave blocks of the common block + NCollection_List myFaces; //!< Faces on which the pave blocks are lying + double myTolerance; //!< Tolerance of the common block }; #endif // _BOPDS_CommonBlock_HeaderFile diff --git a/opencascade/BOPDS_CoupleOfPaveBlocks.hxx b/opencascade/BOPDS_CoupleOfPaveBlocks.hxx index 21cb89e0a..ef2f717bc 100644 --- a/opencascade/BOPDS_CoupleOfPaveBlocks.hxx +++ b/opencascade/BOPDS_CoupleOfPaveBlocks.hxx @@ -17,22 +17,11 @@ #include -/** - * The Class BOPDS_CoupleOfPaveBlocks is to store - * the information about two pave blocks - * and some satellite information - * - */ -//======================================================================= -// class : BOPDS_CoupleOfPaveBlocks -// purpose : -//======================================================================= +//! Stores information about two pave blocks and satellite data. class BOPDS_CoupleOfPaveBlocks { public: - /** - * Constructor - */ + //! Default constructor. BOPDS_CoupleOfPaveBlocks() : myIndexInterf(-1), myIndex(-1), @@ -40,16 +29,11 @@ public: { } - // - /** - * Constructor - * @param thePB1 - * first pave block - * @param thePB2 - * secondt pave block - */ - BOPDS_CoupleOfPaveBlocks(const Handle(BOPDS_PaveBlock)& thePB1, - const Handle(BOPDS_PaveBlock)& thePB2) + //! Constructor with two pave blocks. + //! @param[in] thePB1 first pave block + //! @param[in] thePB2 second pave block + BOPDS_CoupleOfPaveBlocks(const occ::handle& thePB1, + const occ::handle& thePB2) : myIndexInterf(-1), myIndex(-1), myTolerance(0) @@ -57,120 +41,71 @@ public: SetPaveBlocks(thePB1, thePB2); } - // - /** - * Destructor - */ - ~BOPDS_CoupleOfPaveBlocks() {} - - // - /** - * Sets an index - * @param theIndex - * index - */ - void SetIndex(const Standard_Integer theIndex) { myIndex = theIndex; } - - // - /** - * Returns the index - * @return - * index - */ - Standard_Integer Index() const { return myIndex; } - - // - /** - * Sets an index of an interference - * @param theIndex - * index of an interference - */ - void SetIndexInterf(const Standard_Integer theIndex) { myIndexInterf = theIndex; } - - // - /** - * Returns the index of an interference - * @return - * index of an interference - */ - Standard_Integer IndexInterf() const { return myIndexInterf; } - - // - /** - * Sets pave blocks - * @param thePB1 - * first pave block - * @param thePB2 - * secondt pave block - */ - void SetPaveBlocks(const Handle(BOPDS_PaveBlock)& thePB1, const Handle(BOPDS_PaveBlock)& thePB2) + ~BOPDS_CoupleOfPaveBlocks() = default; + + //! Sets the index. + //! @param[in] theIndex the index + void SetIndex(const int theIndex) { myIndex = theIndex; } + + //! Returns the index. + //! @return the index + int Index() const { return myIndex; } + + //! Sets the index of an interference. + //! @param[in] theIndex index of an interference + void SetIndexInterf(const int theIndex) { myIndexInterf = theIndex; } + + //! Returns the index of an interference. + //! @return index of an interference + int IndexInterf() const { return myIndexInterf; } + + //! Sets both pave blocks. + //! @param[in] thePB1 first pave block + //! @param[in] thePB2 second pave block + void SetPaveBlocks(const occ::handle& thePB1, + const occ::handle& thePB2) { myPB[0] = thePB1; myPB[1] = thePB2; } - // - /** - * Returns pave blocks - * @param thePB1 - * the first pave block - * @param thePB2 - * the second pave block - */ - void PaveBlocks(Handle(BOPDS_PaveBlock)& thePB1, Handle(BOPDS_PaveBlock)& thePB2) const + //! @deprecated Use PaveBlock1() and PaveBlock2() instead. + Standard_DEPRECATED("Use PaveBlock1() and PaveBlock2() instead") + void PaveBlocks(occ::handle& thePB1, occ::handle& thePB2) const { - thePB1 = myPB[0]; - thePB2 = myPB[1]; + thePB1 = PaveBlock1(); + thePB2 = PaveBlock2(); } - // - /** - * Sets the first pave block - * @param thePB - * the first pave block - */ - void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& thePB) { myPB[0] = thePB; } - - /** - * Returns the first pave block - * @return - * the first pave block - */ - const Handle(BOPDS_PaveBlock)& PaveBlock1() const { return myPB[0]; } - - // - /** - * Sets the second pave block - * @param thePB - * the second pave block - */ - void SetPaveBlock2(const Handle(BOPDS_PaveBlock)& thePB) { myPB[1] = thePB; } - - // - /** - * Returns the second pave block - * @return - * the second pave block - */ - const Handle(BOPDS_PaveBlock)& PaveBlock2() const { return myPB[1]; } - - /** - * Sets the tolerance associated with this couple - */ - void SetTolerance(const Standard_Real theTol) { myTolerance = theTol; } - - // - /** - * Returns the tolerance associated with this couple - */ - Standard_Real Tolerance() const { return myTolerance; } + //! Sets the first pave block. + //! @param[in] thePB the first pave block + void SetPaveBlock1(const occ::handle& thePB) { myPB[0] = thePB; } + + //! Returns the first pave block. + //! @return handle to the first pave block + const occ::handle& PaveBlock1() const { return myPB[0]; } + + //! Sets the second pave block. + //! @param[in] thePB the second pave block + void SetPaveBlock2(const occ::handle& thePB) { myPB[1] = thePB; } + + //! Returns the second pave block. + //! @return handle to the second pave block + const occ::handle& PaveBlock2() const { return myPB[1]; } + + //! Sets the tolerance associated with this couple. + //! @param[in] theTol the tolerance value + void SetTolerance(const double theTol) { myTolerance = theTol; } + + //! Returns the tolerance associated with this couple. + //! @return the tolerance value + double Tolerance() const { return myTolerance; } protected: - Standard_Integer myIndexInterf; - Standard_Integer myIndex; - Handle(BOPDS_PaveBlock) myPB[2]; - Standard_Real myTolerance; + int myIndexInterf; + int myIndex; + occ::handle myPB[2]; + double myTolerance; }; -// #endif diff --git a/opencascade/BOPDS_Curve.hxx b/opencascade/BOPDS_Curve.hxx index f374d8f70..cae252af0 100644 --- a/opencascade/BOPDS_Curve.hxx +++ b/opencascade/BOPDS_Curve.hxx @@ -20,10 +20,10 @@ #include #include -#include #include #include -#include +#include +#include class IntTools_Curve; class Bnd_Box; class BOPDS_PaveBlock; @@ -42,7 +42,7 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - BOPDS_Curve(const Handle(NCollection_BaseAllocator)& theAllocator); + BOPDS_Curve(const occ::handle& theAllocator); //! Modifier //! Sets the curve @@ -64,60 +64,58 @@ public: //! Returns the bounding box of the curve Bnd_Box& ChangeBox(); - void SetPaveBlocks(const BOPDS_ListOfPaveBlock& theLPB); + void SetPaveBlocks(const NCollection_List>& theLPB); //! Selector //! Returns the list of pave blocks //! of the curve - const BOPDS_ListOfPaveBlock& PaveBlocks() const; + const NCollection_List>& PaveBlocks() const; //! Selector/Modifier //! Returns the list of pave blocks //! of the curve - BOPDS_ListOfPaveBlock& ChangePaveBlocks(); + NCollection_List>& ChangePaveBlocks(); - //! Creates initial pave block + //! Creates initial pave block //! of the curve void InitPaveBlock1(); //! Selector/Modifier - //! Returns initial pave block + //! Returns initial pave block //! of the curve - Handle(BOPDS_PaveBlock)& ChangePaveBlock1(); + occ::handle& ChangePaveBlock1(); //! Selector //! Returns list of indices of technologic vertices //! of the curve - const TColStd_ListOfInteger& TechnoVertices() const; + const NCollection_List& TechnoVertices() const; //! Selector/Modifier //! Returns list of indices of technologic vertices //! of the curve - TColStd_ListOfInteger& ChangeTechnoVertices(); + NCollection_List& ChangeTechnoVertices(); //! Query //! Returns true if at least one pave block of the curve //! has edge - Standard_Boolean HasEdge() const; + bool HasEdge() const; //! Sets the tolerance for the curve. - void SetTolerance(const Standard_Real theTol) { myTolerance = theTol; } + void SetTolerance(const double theTol) { myTolerance = theTol; } //! Returns the tolerance of the curve - Standard_Real Tolerance() const { return myTolerance; } + double Tolerance() const { return myTolerance; } //! Returns the tangential tolerance of the curve - Standard_Real TangentialTolerance() const { return myCurve.TangentialTolerance(); } + double TangentialTolerance() const { return myCurve.TangentialTolerance(); } protected: - Handle(NCollection_BaseAllocator) myAllocator; - IntTools_Curve myCurve; - BOPDS_ListOfPaveBlock myPaveBlocks; - TColStd_ListOfInteger myTechnoVertices; - Bnd_Box myBox; - Standard_Real myTolerance; - -private: + occ::handle myAllocator; + IntTools_Curve myCurve; + NCollection_List> myPaveBlocks; + NCollection_List myTechnoVertices; + Bnd_Box myBox; + double myTolerance; }; #include diff --git a/opencascade/BOPDS_Curve.lxx b/opencascade/BOPDS_Curve.lxx index 7accf9139..480f71dfa 100644 --- a/opencascade/BOPDS_Curve.lxx +++ b/opencascade/BOPDS_Curve.lxx @@ -14,10 +14,8 @@ #include -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_Curve::BOPDS_Curve() : myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()), myPaveBlocks(myAllocator), @@ -26,11 +24,9 @@ inline BOPDS_Curve::BOPDS_Curve() { } -//======================================================================= -// function : -// purpose : -//======================================================================= -inline BOPDS_Curve::BOPDS_Curve(const Handle(NCollection_BaseAllocator)& theAllocator) +//================================================================================================= + +inline BOPDS_Curve::BOPDS_Curve(const occ::handle& theAllocator) : myAllocator(theAllocator), myPaveBlocks(myAllocator), myTechnoVertices(myAllocator), @@ -38,37 +34,29 @@ inline BOPDS_Curve::BOPDS_Curve(const Handle(NCollection_BaseAllocator)& theAllo { } -//======================================================================= -// function : -// purpose : -//======================================================================= -inline BOPDS_Curve::~BOPDS_Curve() {} +//================================================================================================= + +inline BOPDS_Curve::~BOPDS_Curve() = default; + +//================================================================================================= -//======================================================================= -// function : SetCurve -// purpose : -//======================================================================= inline void BOPDS_Curve::SetCurve(const IntTools_Curve& theCurve) { myCurve = theCurve; } -//======================================================================= -// function : Curve -// purpose : -//======================================================================= +//================================================================================================= + inline const IntTools_Curve& BOPDS_Curve::Curve() const { return myCurve; } -//======================================================================= -// function : SetPaveBlocks -// purpose : -//======================================================================= -inline void BOPDS_Curve::SetPaveBlocks(const BOPDS_ListOfPaveBlock& theLPB) +//================================================================================================= + +inline void BOPDS_Curve::SetPaveBlocks(const NCollection_List>& theLPB) { - BOPDS_ListIteratorOfListOfPaveBlock aIt; + NCollection_List>::Iterator aIt; // myPaveBlocks.Clear(); aIt.Initialize(theLPB); @@ -78,107 +66,87 @@ inline void BOPDS_Curve::SetPaveBlocks(const BOPDS_ListOfPaveBlock& theLPB) } } -//======================================================================= -// function : PaveBlocks -// purpose : -//======================================================================= -inline const BOPDS_ListOfPaveBlock& BOPDS_Curve::PaveBlocks() const +//================================================================================================= + +inline const NCollection_List>& BOPDS_Curve::PaveBlocks() const { return myPaveBlocks; } -//======================================================================= -// function : ChangePaveBlocks -// purpose : -//======================================================================= -inline BOPDS_ListOfPaveBlock& BOPDS_Curve::ChangePaveBlocks() +//================================================================================================= + +inline NCollection_List>& BOPDS_Curve::ChangePaveBlocks() { return myPaveBlocks; } -//======================================================================= -// function : InitPaveBlock1 -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_Curve::InitPaveBlock1() { if (!myPaveBlocks.Extent()) { - Handle(BOPDS_PaveBlock) aPB = new BOPDS_PaveBlock; + occ::handle aPB = new BOPDS_PaveBlock; myPaveBlocks.Append(aPB); } } -//======================================================================= -// function : ChangePaveBlock1 -// purpose : -//======================================================================= -inline Handle(BOPDS_PaveBlock)& BOPDS_Curve::ChangePaveBlock1() +//================================================================================================= + +inline occ::handle& BOPDS_Curve::ChangePaveBlock1() { - Handle(BOPDS_PaveBlock)* pPB = (Handle(BOPDS_PaveBlock)*)&myPaveBlocks.First(); + occ::handle* pPB = (occ::handle*)&myPaveBlocks.First(); return *pPB; } -//======================================================================= -// function : TechnoVertices -// purpose : -//======================================================================= -inline const TColStd_ListOfInteger& BOPDS_Curve::TechnoVertices() const +//================================================================================================= + +inline const NCollection_List& BOPDS_Curve::TechnoVertices() const { return myTechnoVertices; } -//======================================================================= -// function : ChangeTechnoVertices -// purpose : -//======================================================================= -inline TColStd_ListOfInteger& BOPDS_Curve::ChangeTechnoVertices() +//================================================================================================= + +inline NCollection_List& BOPDS_Curve::ChangeTechnoVertices() { return myTechnoVertices; } -//======================================================================= -// function : SetBox -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_Curve::SetBox(const Bnd_Box& theBox) { myBox = theBox; } -//======================================================================= -// function : Box -// purpose : -//======================================================================= +//================================================================================================= + inline const Bnd_Box& BOPDS_Curve::Box() const { return myBox; } -//======================================================================= -// function : ChangeBox -// purpose : -//======================================================================= +//================================================================================================= + inline Bnd_Box& BOPDS_Curve::ChangeBox() { return myBox; } -//======================================================================= -// function : HasEdge -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_Curve::HasEdge() const +//================================================================================================= + +inline bool BOPDS_Curve::HasEdge() const { - Standard_Boolean bFlag; - BOPDS_ListIteratorOfListOfPaveBlock aItPB; + bool bFlag; + NCollection_List>::Iterator aItPB; // - bFlag = Standard_False; + bFlag = false; aItPB.Initialize(myPaveBlocks); for (; aItPB.More(); aItPB.Next()) { - const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); - bFlag = aPB->HasEdge(); + const occ::handle& aPB = aItPB.Value(); + bFlag = aPB->HasEdge(); if (bFlag) { break; diff --git a/opencascade/BOPDS_DS.hxx b/opencascade/BOPDS_DS.hxx index 005e51ef5..b52481dc1 100644 --- a/opencascade/BOPDS_DS.hxx +++ b/opencascade/BOPDS_DS.hxx @@ -19,34 +19,23 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include class BOPDS_IndexRange; class BOPDS_ShapeInfo; @@ -59,20 +48,19 @@ class Bnd_Box; //! The class BOPDS_DS provides the control //! of data structure for the algorithms in the //! Boolean Component such as General Fuse, Boolean operations, -//! Section, Maker Volume, Splitter and Cells Builder.
+//! Section, Maker Volume, Splitter and Cells Builder. //! -//! The data structure has the following contents:
-//! 1. the arguments of an operation [myArguments];
-//! 2 the information about arguments/new shapes +//! The data structure has the following contents: +//! 1. the arguments of an operation [myArguments]; +//! 2. the information about arguments/new shapes //! and their sub-shapes (type of the shape, -//! bounding box, etc) [myLines];
+//! bounding box, etc) [myLines]; //! 3. each argument shape(and its subshapes) -//! has/have own range of indices (rank);
-//! 4. pave blocks on source edges [myPaveBlocksPool];
-//! 5. the state of source faces [myFaceInfoPool];
-//! 6 the collection of same domain shapes [myShapesSD];
-//! 7 the collection of interferences [myInterfTB, -//! myInterfVV,..myInterfFF] +//! has/have own range of indices (rank); +//! 4. pave blocks on source edges [myPaveBlocksPool]; +//! 5. the state of source faces [myFaceInfoPool]; +//! 6. the collection of same domain shapes [myShapesSD]; +//! 7. the collection of interferences [myInterfTB, myInterfVV,..myInterfFF] class BOPDS_DS { public: @@ -85,181 +73,187 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - Standard_EXPORT BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_DS(const occ::handle& theAllocator); //! Clears the contents Standard_EXPORT void Clear(); //! Selector - Standard_EXPORT const Handle(NCollection_BaseAllocator)& Allocator() const; + Standard_EXPORT const occ::handle& Allocator() const; //! Modifier //! Sets the arguments [theLS] of an operation - Standard_EXPORT void SetArguments(const TopTools_ListOfShape& theLS); + Standard_EXPORT void SetArguments(const NCollection_List& theLS); //! Selector //! Returns the arguments of an operation - Standard_EXPORT const TopTools_ListOfShape& Arguments() const; + Standard_EXPORT const NCollection_List& Arguments() const; //! Initializes the data structure for //! the arguments - Standard_EXPORT void Init(const Standard_Real theFuzz = Precision::Confusion()); + Standard_EXPORT void Init(const double theFuzz = Precision::Confusion()); //! Selector //! Returns the total number of shapes stored - Standard_EXPORT Standard_Integer NbShapes() const; + Standard_EXPORT int NbShapes() const; //! Selector //! Returns the total number of source shapes stored - Standard_EXPORT Standard_Integer NbSourceShapes() const; + Standard_EXPORT int NbSourceShapes() const; //! Selector //! Returns the number of index ranges - Standard_EXPORT Standard_Integer NbRanges() const; + Standard_EXPORT int NbRanges() const; //! Selector //! Returns the index range "i" - Standard_EXPORT const BOPDS_IndexRange& Range(const Standard_Integer theIndex) const; + Standard_EXPORT const BOPDS_IndexRange& Range(const int theIndex) const; //! Selector //! Returns the rank of the shape of index "i" - Standard_EXPORT Standard_Integer Rank(const Standard_Integer theIndex) const; + Standard_EXPORT int Rank(const int theIndex) const; //! Returns true if the shape of index "i" is not //! the source shape/sub-shape - Standard_EXPORT Standard_Boolean IsNewShape(const Standard_Integer theIndex) const; + Standard_EXPORT bool IsNewShape(const int theIndex) const; //! Modifier //! Appends the information about the shape [theSI] //! to the data structure //! Returns the index of theSI in the data structure - Standard_EXPORT Standard_Integer Append(const BOPDS_ShapeInfo& theSI); + Standard_EXPORT int Append(const BOPDS_ShapeInfo& theSI); //! Modifier //! Appends the default information about the shape [theS] //! to the data structure //! Returns the index of theS in the data structure - Standard_EXPORT Standard_Integer Append(const TopoDS_Shape& theS); + Standard_EXPORT int Append(const TopoDS_Shape& theS); //! Selector //! Returns the information about the shape //! with index theIndex - Standard_EXPORT const BOPDS_ShapeInfo& ShapeInfo(const Standard_Integer theIndex) const; + Standard_EXPORT const BOPDS_ShapeInfo& ShapeInfo(const int theIndex) const; //! Selector/Modifier //! Returns the information about the shape //! with index theIndex - Standard_EXPORT BOPDS_ShapeInfo& ChangeShapeInfo(const Standard_Integer theIndex); + Standard_EXPORT BOPDS_ShapeInfo& ChangeShapeInfo(const int theIndex); //! Selector //! Returns the shape //! with index theIndex - Standard_EXPORT const TopoDS_Shape& Shape(const Standard_Integer theIndex) const; + Standard_EXPORT const TopoDS_Shape& Shape(const int theIndex) const; //! Selector - //! Returns the index of the shape theS - Standard_EXPORT Standard_Integer Index(const TopoDS_Shape& theS) const; + //! Returns the index of the shape theS + Standard_EXPORT int Index(const TopoDS_Shape& theS) const; //! Selector //! Returns the information about pave blocks on source edges - Standard_EXPORT const BOPDS_VectorOfListOfPaveBlock& PaveBlocksPool() const; + Standard_EXPORT const NCollection_DynamicArray>>& + PaveBlocksPool() const; //! Selector/Modifier //! Returns the information about pave blocks on source edges - Standard_EXPORT BOPDS_VectorOfListOfPaveBlock& ChangePaveBlocksPool(); + Standard_EXPORT NCollection_DynamicArray>>& + ChangePaveBlocksPool(); //! Query //! Returns true if the shape with index theIndex has the //! information about pave blocks - Standard_EXPORT Standard_Boolean HasPaveBlocks(const Standard_Integer theIndex) const; + Standard_EXPORT bool HasPaveBlocks(const int theIndex) const; //! Selector //! Returns the pave blocks for the shape with index theIndex - Standard_EXPORT const BOPDS_ListOfPaveBlock& PaveBlocks(const Standard_Integer theIndex) const; + Standard_EXPORT const NCollection_List>& PaveBlocks( + const int theIndex) const; //! Selector/Modifier //! Returns the pave blocks for the shape with index theIndex - Standard_EXPORT BOPDS_ListOfPaveBlock& ChangePaveBlocks(const Standard_Integer theIndex); + Standard_EXPORT NCollection_List>& ChangePaveBlocks( + const int theIndex); //! Update the pave blocks for the all shapes in data structure Standard_EXPORT void UpdatePaveBlocks(); //! Update the pave block thePB - Standard_EXPORT void UpdatePaveBlock(const Handle(BOPDS_PaveBlock)& thePB); + Standard_EXPORT void UpdatePaveBlock(const occ::handle& thePB); //! Update the common block theCB - Standard_EXPORT void UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB, - const Standard_Real theFuzz); + Standard_EXPORT void UpdateCommonBlock(const occ::handle& theCB, + const double theFuzz); //! Query //! Returns true if the pave block is common block - Standard_EXPORT Standard_Boolean IsCommonBlock(const Handle(BOPDS_PaveBlock)& thePB) const; + Standard_EXPORT bool IsCommonBlock(const occ::handle& thePB) const; //! Selector //! Returns the common block - Standard_EXPORT Handle(BOPDS_CommonBlock) CommonBlock(const Handle(BOPDS_PaveBlock)& thePB) const; + Standard_EXPORT occ::handle CommonBlock( + const occ::handle& thePB) const; //! Modifier //! Sets the common block - Standard_EXPORT void SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB, - const Handle(BOPDS_CommonBlock)& theCB); + Standard_EXPORT void SetCommonBlock(const occ::handle& thePB, + const occ::handle& theCB); //! Selector //! Returns the real first pave block - Standard_EXPORT Handle(BOPDS_PaveBlock) RealPaveBlock(const Handle(BOPDS_PaveBlock)& thePB) const; + Standard_EXPORT occ::handle RealPaveBlock( + const occ::handle& thePB) const; //! Query //! Returns true if common block contains more then one pave block - Standard_EXPORT Standard_Boolean IsCommonBlockOnEdge(const Handle(BOPDS_PaveBlock)& thePB) const; + Standard_EXPORT bool IsCommonBlockOnEdge(const occ::handle& thePB) const; //! Selector //! Returns the information about state of faces - Standard_EXPORT const BOPDS_VectorOfFaceInfo& FaceInfoPool() const; + Standard_EXPORT const NCollection_DynamicArray& FaceInfoPool() const; //! Query //! Returns true if the shape with index theIndex has the //! information about state of face - Standard_EXPORT Standard_Boolean HasFaceInfo(const Standard_Integer theIndex) const; + Standard_EXPORT bool HasFaceInfo(const int theIndex) const; //! Selector //! Returns the state of face with index theIndex - Standard_EXPORT const BOPDS_FaceInfo& FaceInfo(const Standard_Integer theIndex) const; + Standard_EXPORT const BOPDS_FaceInfo& FaceInfo(const int theIndex) const; //! Selector/Modifier //! Returns the state of face with index theIndex - Standard_EXPORT BOPDS_FaceInfo& ChangeFaceInfo(const Standard_Integer theIndex); + Standard_EXPORT BOPDS_FaceInfo& ChangeFaceInfo(const int theIndex); //! Update the state In of face with index theIndex - Standard_EXPORT void UpdateFaceInfoIn(const Standard_Integer theIndex); + Standard_EXPORT void UpdateFaceInfoIn(const int theIndex); //! Update the state IN for all faces in the given map - Standard_EXPORT void UpdateFaceInfoIn(const TColStd_MapOfInteger& theFaces); + Standard_EXPORT void UpdateFaceInfoIn(const NCollection_Map& theFaces); //! Update the state On of face with index theIndex - Standard_EXPORT void UpdateFaceInfoOn(const Standard_Integer theIndex); + Standard_EXPORT void UpdateFaceInfoOn(const int theIndex); //! Update the state ON for all faces in the given map - Standard_EXPORT void UpdateFaceInfoOn(const TColStd_MapOfInteger& theFaces); + Standard_EXPORT void UpdateFaceInfoOn(const NCollection_Map& theFaces); //! Selector //! Returns the state On //! [theMPB,theMVP] of face with index theIndex - Standard_EXPORT void FaceInfoOn(const Standard_Integer theIndex, - BOPDS_IndexedMapOfPaveBlock& theMPB, - TColStd_MapOfInteger& theMVP); + Standard_EXPORT void FaceInfoOn(const int theIndex, + NCollection_IndexedMap>& theMPB, + NCollection_Map& theMVP); //! Selector //! Returns the state In //! [theMPB,theMVP] of face with index theIndex - Standard_EXPORT void FaceInfoIn(const Standard_Integer theIndex, - BOPDS_IndexedMapOfPaveBlock& theMPB, - TColStd_MapOfInteger& theMVP); + Standard_EXPORT void FaceInfoIn(const int theIndex, + NCollection_IndexedMap>& theMPB, + NCollection_Map& theMVP); //! Selector //! Returns the indices of alone vertices - //! for the face with index theIndex - Standard_EXPORT void AloneVertices(const Standard_Integer theF, - TColStd_ListOfInteger& theLI) const; + //! for the face with index @p theFaceIndex + Standard_EXPORT void AloneVertices(const int theFaceIndex, + NCollection_List& theVertexList) const; //! Refine the state On for the all faces having //! state information @@ -271,35 +265,35 @@ public: Standard_EXPORT void RefineFaceInfoIn(); //! Returns information about ON/IN sub-shapes of the given faces. + //! @param theFaceIndex1 the index of the first face + //! @param theFaceIndex2 the index of the second face //! @param theMVOnIn the indices of ON/IN vertices from both faces //! @param theMVCommon the indices of common vertices for both faces //! @param thePBOnIn all On/In pave blocks from both faces - //! @param theCommonPB the common pave blocks (that are shared by both faces). - Standard_EXPORT void SubShapesOnIn(const Standard_Integer theNF1, - const Standard_Integer theNF2, - TColStd_MapOfInteger& theMVOnIn, - TColStd_MapOfInteger& theMVCommon, - BOPDS_IndexedMapOfPaveBlock& thePBOnIn, - BOPDS_MapOfPaveBlock& theCommonPB) const; - - //! Returns the indices of edges that are shared - //! for the faces with indices theF1, theF2 - //! - //! same domain shapes - Standard_EXPORT void SharedEdges(const Standard_Integer theF1, - const Standard_Integer theF2, - TColStd_ListOfInteger& theLI, - const Handle(NCollection_BaseAllocator)& theAllocator); + //! @param theCommonPaveBlocks the common pave blocks (that are shared by both faces). + Standard_EXPORT void SubShapesOnIn( + const int theFaceIndex1, + const int theFaceIndex2, + NCollection_Map& theMVOnIn, + NCollection_Map& theMVCommon, + NCollection_IndexedMap>& thePBOnIn, + NCollection_Map>& theCommonPaveBlocks) const; + + //! Returns the indices of edges that are shared + //! for the faces with indices @p theFaceIndex1 and @p theFaceIndex2. + Standard_EXPORT void SharedEdges(const int theFaceIndex1, + const int theFaceIndex2, + NCollection_List& theEdgeList, + const occ::handle& theAllocator); //! Selector //! Returns the collection same domain shapes - Standard_EXPORT TColStd_DataMapOfIntegerInteger& ShapesSD(); + Standard_EXPORT NCollection_DataMap& ShapesSD(); //! Modifier //! Adds the information about same domain shapes //! with indices theIndex, theIndexSD - Standard_EXPORT void AddShapeSD(const Standard_Integer theIndex, - const Standard_Integer theIndexSD); + Standard_EXPORT void AddShapeSD(const int theIndex, const int theIndexSD); //! Query //! Returns true if the shape with index theIndex has the @@ -307,169 +301,205 @@ public: //! the index of same domain shape found //! //! interferences - Standard_EXPORT Standard_Boolean HasShapeSD(const Standard_Integer theIndex, - Standard_Integer& theIndexSD) const; + Standard_EXPORT bool HasShapeSD(const int theIndex, int& theIndexSD) const; + + //! Returns the index of same domain shape for the shape + //! with index @p theIndex. If there is no same domain shape, returns @p theIndex itself. + Standard_EXPORT int GetSameDomainIndex(const int theIndex) const; //! Selector/Modifier //! Returns the collection of interferences Vertex/Vertex - BOPDS_VectorOfInterfVV& InterfVV(); + NCollection_DynamicArray& InterfVV(); //! Selector/Modifier //! Returns the collection of interferences Vertex/Edge - BOPDS_VectorOfInterfVE& InterfVE(); + NCollection_DynamicArray& InterfVE(); //! Selector/Modifier //! Returns the collection of interferences Vertex/Face - BOPDS_VectorOfInterfVF& InterfVF(); + NCollection_DynamicArray& InterfVF(); //! Selector/Modifier //! Returns the collection of interferences Edge/Edge - BOPDS_VectorOfInterfEE& InterfEE(); + NCollection_DynamicArray& InterfEE(); //! Selector/Modifier //! Returns the collection of interferences Edge/Face - BOPDS_VectorOfInterfEF& InterfEF(); + NCollection_DynamicArray& InterfEF(); //! Selector/Modifier //! Returns the collection of interferences Face/Face - BOPDS_VectorOfInterfFF& InterfFF(); + NCollection_DynamicArray& InterfFF(); //! Selector/Modifier //! Returns the collection of interferences Vertex/Solid - BOPDS_VectorOfInterfVZ& InterfVZ(); + NCollection_DynamicArray& InterfVZ(); //! Selector/Modifier //! Returns the collection of interferences Edge/Solid - BOPDS_VectorOfInterfEZ& InterfEZ(); + NCollection_DynamicArray& InterfEZ(); //! Selector/Modifier //! Returns the collection of interferences Face/Solid - BOPDS_VectorOfInterfFZ& InterfFZ(); + NCollection_DynamicArray& InterfFZ(); //! Selector/Modifier //! Returns the collection of interferences Solid/Solid - BOPDS_VectorOfInterfZZ& InterfZZ(); + NCollection_DynamicArray& InterfZZ(); //! Returns the number of types of the interferences - static Standard_Integer NbInterfTypes(); + static int NbInterfTypes(); //! Modifier //! Adds the information about an interference between //! shapes with indices theI1, theI2 to the summary //! table of interferences - Standard_Boolean AddInterf(const Standard_Integer theI1, const Standard_Integer theI2); + bool AddInterf(const int theI1, const int theI2); //! Query //! Returns true if the shape with index theI //! is interferred - Standard_Boolean HasInterf(const Standard_Integer theI) const; + bool HasInterf(const int theI) const; //! Query //! Returns true if the shapes with indices theI1, theI2 //! are interferred - Standard_Boolean HasInterf(const Standard_Integer theI1, const Standard_Integer theI2) const; + bool HasInterf(const int theI1, const int theI2) const; //! Query - //! Returns true if the shape with index theI1 is interfered + //! Returns true if the shape with index theIndex1 is interfered //! with - //! any sub-shape of the shape with index theI2 (theFlag=true) - //! all sub-shapes of the shape with index theI2 (theFlag=false) - Standard_EXPORT Standard_Boolean - HasInterfShapeSubShapes(const Standard_Integer theI1, - const Standard_Integer theI2, - const Standard_Boolean theFlag = Standard_True) const; + //! any sub-shape of the shape with index theIndex2 (theAnyInterference=true) + //! all sub-shapes of the shape with index theIndex2 (theAnyInterference=false) + Standard_EXPORT bool HasInterfShapeSubShapes(const int theIndex1, + const int theIndex2, + const bool theAnyInterference = true) const; //! Query - //! Returns true if the shapes with indices theI1, theI2 + //! Returns true if the shapes with indices theIndex1, theIndex2 //! have interferred sub-shapes - Standard_EXPORT Standard_Boolean HasInterfSubShapes(const Standard_Integer theI1, - const Standard_Integer theI2) const; + Standard_EXPORT bool HasInterfSubShapes(const int theIndex1, const int theIndex2) const; //! Selector //! Returns the table of interferences //! //! debug - const BOPDS_MapOfPair& Interferences() const; + const NCollection_Map& Interferences() const; Standard_EXPORT void Dump() const; - Standard_EXPORT Standard_Boolean IsSubShape(const Standard_Integer theI1, - const Standard_Integer theI2); + //! Returns true if the shape with index @p theCandidate is a sub-shape + //! of the shape with index @p theParent + Standard_EXPORT bool IsSubShape(const int theCandidate, const int theParent); //! Fills theLP with sorted paves //! of the shape with index theIndex - Standard_EXPORT void Paves(const Standard_Integer theIndex, BOPDS_ListOfPave& theLP); + Standard_EXPORT void Paves(const int theIndex, NCollection_List& theLP); //! Update the pave blocks for all shapes in data structure Standard_EXPORT void UpdatePaveBlocksWithSDVertices(); //! Update the pave block for all shapes in data structure - Standard_EXPORT void UpdatePaveBlockWithSDVertices(const Handle(BOPDS_PaveBlock)& thePB); + Standard_EXPORT void UpdatePaveBlockWithSDVertices(const occ::handle& thePB); //! Update the pave block of the common block for all shapes in data structure - Standard_EXPORT void UpdateCommonBlockWithSDVertices(const Handle(BOPDS_CommonBlock)& theCB); + Standard_EXPORT void UpdateCommonBlockWithSDVertices(const occ::handle& theCB); - Standard_EXPORT void InitPaveBlocksForVertex(const Standard_Integer theNV); + Standard_EXPORT void InitPaveBlocksForVertex(const int theNV); //! Clears information about PaveBlocks for the untouched edges Standard_EXPORT void ReleasePaveBlocks(); - //! Checks if the existing shrunk data of the pave block is still valid.
+ //! Checks if the existing shrunk data of the pave block is still valid. //! The shrunk data may become invalid if e.g. the vertices of the pave block //! have been replaced with the new one with bigger tolerances, or the tolerances //! of the existing vertices have been increased. - Standard_EXPORT Standard_Boolean IsValidShrunkData(const Handle(BOPDS_PaveBlock)& thePB); + Standard_EXPORT bool IsValidShrunkData(const occ::handle& thePB); //! Computes bounding box for the solid with DS-index . //! The flag enables/disables the check of the solid //! for inverted status. By default the solids will be checked. - Standard_EXPORT void BuildBndBoxSolid(const Standard_Integer theIndex, - Bnd_Box& theBox, - const Standard_Boolean theCheckInverted = Standard_True); + Standard_EXPORT void BuildBndBoxSolid(const int theIndex, + Bnd_Box& theBox, + const bool theCheckInverted = true); -protected: +private: //! Initializes the pave blocks for the shape with index theIndex - Standard_EXPORT void InitPaveBlocks(const Standard_Integer theIndex); + void InitPaveBlocks(const int theIndex); //! Initializes the state of face with index theIndex - Standard_EXPORT void InitFaceInfo(const Standard_Integer theIndex); + void InitFaceInfo(const int theIndex); //! Initializes the FaceInfo structure for face with index theIndex with elements //! having IN state for the face - Standard_EXPORT void InitFaceInfoIn(const Standard_Integer theIndex); - - Standard_EXPORT void InitShape(const Standard_Integer theIndex, const TopoDS_Shape& theS); - - Standard_EXPORT Standard_Boolean CheckCoincidence(const Handle(BOPDS_PaveBlock)& thePB1, - const Handle(BOPDS_PaveBlock)& thePB2, - const Standard_Real theFuzz); - - Handle(NCollection_BaseAllocator) myAllocator; - TopTools_ListOfShape myArguments; - Standard_Integer myNbShapes; - Standard_Integer myNbSourceShapes; - BOPDS_VectorOfIndexRange myRanges; - BOPDS_VectorOfShapeInfo myLines; - TopTools_DataMapOfShapeInteger myMapShapeIndex; - BOPDS_VectorOfListOfPaveBlock myPaveBlocksPool; - BOPDS_DataMapOfPaveBlockCommonBlock myMapPBCB; - BOPDS_VectorOfFaceInfo myFaceInfoPool; - TColStd_DataMapOfIntegerInteger myShapesSD; - TColStd_DataMapOfIntegerListOfInteger myMapVE; - BOPDS_MapOfPair myInterfTB; - BOPDS_VectorOfInterfVV myInterfVV; - BOPDS_VectorOfInterfVE myInterfVE; - BOPDS_VectorOfInterfVF myInterfVF; - BOPDS_VectorOfInterfEE myInterfEE; - BOPDS_VectorOfInterfEF myInterfEF; - BOPDS_VectorOfInterfFF myInterfFF; - BOPDS_VectorOfInterfVZ myInterfVZ; - BOPDS_VectorOfInterfEZ myInterfEZ; - BOPDS_VectorOfInterfFZ myInterfFZ; - BOPDS_VectorOfInterfZZ myInterfZZ; - TColStd_MapOfInteger myInterfered; + void InitFaceInfoIn(const int theIndex); + + void InitShape(const int theIndex, const TopoDS_Shape& theS); + + bool CheckCoincidence(const occ::handle& thePB1, + const occ::handle& thePB2, + const double theFuzz); + + //! Prepares vertices, updates their bounding boxes. + //! @param theAdditionalTolerance The additional tolerance to be added to the + //! gaps of the bounding boxes. + //! @return The number of vertices processed. + int prepareVertices(const double theAdditionalTolerance); + + //! Prepares edges, updates their bounding boxes, + //! sets degenerated flag for degenerated edges, creates start/end vertices for infinite edges. + //! @param theAdditionalTolerance The additional tolerance to be added to the + //! gaps of the bounding boxes. + //! @return The number of edges processed. + int prepareEdges(const double theAdditionalTolerance); + + //! Prepares faces, updates their bounding boxes and sub-shapes. + //! Initially, subshapes of the faces are wires. They will be updated to + //! contain edges and vertices. + //! @param theAdditionalTolerance The additional tolerance to be added to the + //! gaps of the bounding boxes. + //! @return The number of faces processed. + int prepareFaces(const double theAdditionalTolerance); + + //! Prepares solids, updates their bounding boxes and sub-shapes. + //! Initially, subshapes of the solids are shells. They will be updated to + //! contain faces and edges. + //! @param theAdditionalTolerance The additional tolerance to be added to the + //! gaps of the bounding boxes. + //! @return The number of solids processed. + int prepareSolids(); + + //! Prepares the Vertex-Edge connection map. + //! For the index of each vertex in the data structure, + //! finds all edges sharing this vertex and + //! stores the indices of these edges in a map. + void buildVertexEdgeMap(); private: + occ::handle myAllocator; + NCollection_List myArguments; + int myNbShapes; + int myNbSourceShapes; + NCollection_DynamicArray myRanges; + NCollection_DynamicArray myLines; + NCollection_DataMap myMapShapeIndex; + NCollection_DynamicArray>> myPaveBlocksPool; + NCollection_DataMap, occ::handle> myMapPBCB; + NCollection_DynamicArray myFaceInfoPool; + NCollection_DataMap myShapesSD; + NCollection_DataMap> myMapVE; + NCollection_Map myInterfTB; + NCollection_DynamicArray myInterfVV; + NCollection_DynamicArray myInterfVE; + NCollection_DynamicArray myInterfVF; + NCollection_DynamicArray myInterfEE; + NCollection_DynamicArray myInterfEF; + NCollection_DynamicArray myInterfFF; + NCollection_DynamicArray myInterfVZ; + NCollection_DynamicArray myInterfEZ; + NCollection_DynamicArray myInterfFZ; + NCollection_DynamicArray myInterfZZ; + NCollection_Map myInterfered; }; #include diff --git a/opencascade/BOPDS_DS.lxx b/opencascade/BOPDS_DS.lxx index 3df8949b9..6e9f1f959 100644 --- a/opencascade/BOPDS_DS.lxx +++ b/opencascade/BOPDS_DS.lxx @@ -14,145 +14,112 @@ #include -//======================================================================= -// function : InterfVV -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfVV& BOPDS_DS::InterfVV() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfVV() { return myInterfVV; } -//======================================================================= -// function : InterfVE -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfVE& BOPDS_DS::InterfVE() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfVE() { return myInterfVE; } -//======================================================================= -// function : InterfVF -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfVF& BOPDS_DS::InterfVF() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfVF() { return myInterfVF; -} //======================================================================= +} //================================================================================================= -// function : InterfEE -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfEE& BOPDS_DS::InterfEE() +inline NCollection_DynamicArray& BOPDS_DS::InterfEE() { return myInterfEE; } -//======================================================================= -// function : InterfEF -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfEF& BOPDS_DS::InterfEF() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfEF() { return myInterfEF; } -//======================================================================= -// function : InterfFF -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfFF& BOPDS_DS::InterfFF() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfFF() { return myInterfFF; } -//======================================================================= -// function : InterfVZ -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfVZ& BOPDS_DS::InterfVZ() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfVZ() { return myInterfVZ; } -//======================================================================= -// function : InterfEZ -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfEZ& BOPDS_DS::InterfEZ() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfEZ() { return myInterfEZ; } -//======================================================================= -// function : InterfFZ -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfFZ& BOPDS_DS::InterfFZ() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfFZ() { return myInterfFZ; } -//======================================================================= -// function : InterfZZ -// purpose : -//======================================================================= -inline BOPDS_VectorOfInterfZZ& BOPDS_DS::InterfZZ() +//================================================================================================= + +inline NCollection_DynamicArray& BOPDS_DS::InterfZZ() { return myInterfZZ; } -//======================================================================= -// function : NbInterfTypes -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_DS::NbInterfTypes() +//================================================================================================= + +inline int BOPDS_DS::NbInterfTypes() { return 10; } -//======================================================================= -// function : AddInterf -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_DS::AddInterf(const Standard_Integer theI1, - const Standard_Integer theI2) +//================================================================================================= + +inline bool BOPDS_DS::AddInterf(const int theI1, const int theI2) { if (myInterfTB.Add(BOPDS_Pair(theI1, theI2))) { myInterfered.Add(theI1); myInterfered.Add(theI2); - return Standard_True; + return true; } - return Standard_False; + return false; } -//======================================================================= -// function : HasInterf -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI) const +//================================================================================================= + +inline bool BOPDS_DS::HasInterf(const int theI) const { return myInterfered.Contains(theI); } -//======================================================================= -// function : HasInterf -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI1, - const Standard_Integer theI2) const +//================================================================================================= + +inline bool BOPDS_DS::HasInterf(const int theI1, const int theI2) const { BOPDS_Pair aPK(theI1, theI2); return myInterfTB.Contains(aPK); } -//======================================================================= -// function : Interferences -// purpose : -//======================================================================= -inline const BOPDS_MapOfPair& BOPDS_DS::Interferences() const +//================================================================================================= + +inline const NCollection_Map& BOPDS_DS::Interferences() const { return myInterfTB; } diff --git a/opencascade/BOPDS_DataMapOfIntegerListOfPaveBlock.hxx b/opencascade/BOPDS_DataMapOfIntegerListOfPaveBlock.hxx index 38d808cf3..3a8094c8e 100644 --- a/opencascade/BOPDS_DataMapOfIntegerListOfPaveBlock.hxx +++ b/opencascade/BOPDS_DataMapOfIntegerListOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_DataMapOfIntegerListOfPaveBlock_HeaderFile -#define BOPDS_DataMapOfIntegerListOfPaveBlock_HeaderFile +//! @file BOPDS_DataMapOfIntegerListOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DataMap directly instead. +#ifndef _BOPDS_DataMapOfIntegerListOfPaveBlock_hxx +#define _BOPDS_DataMapOfIntegerListOfPaveBlock_hxx + +#include #include #include -typedef NCollection_DataMap - BOPDS_DataMapOfIntegerListOfPaveBlock; +Standard_HEADER_DEPRECATED("BOPDS_DataMapOfIntegerListOfPaveBlock.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_DataMap directly.") + + Standard_DEPRECATED("BOPDS_DataMapOfIntegerListOfPaveBlock is deprecated, use " + "NCollection_DataMap directly") +typedef NCollection_DataMap BOPDS_DataMapOfIntegerListOfPaveBlock; -#endif +#endif // _BOPDS_DataMapOfIntegerListOfPaveBlock_hxx diff --git a/opencascade/BOPDS_DataMapOfPaveBlockCommonBlock.hxx b/opencascade/BOPDS_DataMapOfPaveBlockCommonBlock.hxx index 2ba7f43f3..24b9b2c89 100644 --- a/opencascade/BOPDS_DataMapOfPaveBlockCommonBlock.hxx +++ b/opencascade/BOPDS_DataMapOfPaveBlockCommonBlock.hxx @@ -1,6 +1,4 @@ -// Created on: 2013-05-23 -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 2013-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,15 +11,32 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_DataMapOfPaveBlockCommonBlock_HeaderFile -#define BOPDS_DataMapOfPaveBlockCommonBlock_HeaderFile +//! @file BOPDS_DataMapOfPaveBlockCommonBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_DataMapOfPaveBlockCommonBlock_hxx +#define _BOPDS_DataMapOfPaveBlockCommonBlock_hxx + +#include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED("BOPDS_DataMapOfPaveBlockCommonBlock.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_DataMapOfPaveBlockCommonBlock is deprecated, use " + "NCollection_DataMap, " + "opencascade::handle> directly") +typedef NCollection_DataMap, + opencascade::handle> BOPDS_DataMapOfPaveBlockCommonBlock; -typedef BOPDS_DataMapOfPaveBlockCommonBlock::Iterator +Standard_DEPRECATED("BOPDS_DataMapIteratorOfDataMapOfPaveBlockCommonBlock is deprecated, use " + "NCollection_DataMap, " + "opencascade::handle>::Iterator directly") +typedef NCollection_DataMap, + opencascade::handle>::Iterator BOPDS_DataMapIteratorOfDataMapOfPaveBlockCommonBlock; -#endif +#endif // _BOPDS_DataMapOfPaveBlockCommonBlock_hxx diff --git a/opencascade/BOPDS_DataMapOfPaveBlockListOfInteger.hxx b/opencascade/BOPDS_DataMapOfPaveBlockListOfInteger.hxx index b7ee15b67..68d1224ad 100644 --- a/opencascade/BOPDS_DataMapOfPaveBlockListOfInteger.hxx +++ b/opencascade/BOPDS_DataMapOfPaveBlockListOfInteger.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,15 +11,30 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_DataMapOfPaveBlockListOfInteger_HeaderFile -#define BOPDS_DataMapOfPaveBlockListOfInteger_HeaderFile +//! @file BOPDS_DataMapOfPaveBlockListOfInteger.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_DataMapOfPaveBlockListOfInteger_hxx +#define _BOPDS_DataMapOfPaveBlockListOfInteger_hxx + +#include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED("BOPDS_DataMapOfPaveBlockListOfInteger.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BOPDS_DataMapOfPaveBlockListOfInteger is deprecated, use " + "NCollection_DataMap, TColStd_ListOfInteger> directly") +typedef NCollection_DataMap, TColStd_ListOfInteger> BOPDS_DataMapOfPaveBlockListOfInteger; -typedef BOPDS_DataMapOfPaveBlockListOfInteger::Iterator +Standard_DEPRECATED("BOPDS_DataMapIteratorOfDataMapOfPaveBlockListOfInteger is deprecated, use " + "NCollection_DataMap, " + "TColStd_ListOfInteger>::Iterator directly") +typedef NCollection_DataMap, TColStd_ListOfInteger>::Iterator BOPDS_DataMapIteratorOfDataMapOfPaveBlockListOfInteger; -#endif +#endif // _BOPDS_DataMapOfPaveBlockListOfInteger_hxx diff --git a/opencascade/BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx b/opencascade/BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx index 98c76f9d9..9fe5a3532 100644 --- a/opencascade/BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx +++ b/opencascade/BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,16 +11,31 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_DataMapOfPaveBlockListOfPaveBlock_HeaderFile -#define BOPDS_DataMapOfPaveBlockListOfPaveBlock_HeaderFile +//! @file BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_DataMapOfPaveBlockListOfPaveBlock_hxx +#define _BOPDS_DataMapOfPaveBlockListOfPaveBlock_hxx + +#include #include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED("BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BOPDS_DataMapOfPaveBlockListOfPaveBlock is deprecated, use " + "NCollection_DataMap, BOPDS_ListOfPaveBlock> directly") +typedef NCollection_DataMap, BOPDS_ListOfPaveBlock> BOPDS_DataMapOfPaveBlockListOfPaveBlock; -typedef BOPDS_DataMapOfPaveBlockListOfPaveBlock::Iterator +Standard_DEPRECATED("BOPDS_DataMapIteratorOfDataMapOfPaveBlockListOfPaveBlock is deprecated, use " + "NCollection_DataMap, " + "BOPDS_ListOfPaveBlock>::Iterator directly") +typedef NCollection_DataMap, BOPDS_ListOfPaveBlock>::Iterator BOPDS_DataMapIteratorOfDataMapOfPaveBlockListOfPaveBlock; -#endif +#endif // _BOPDS_DataMapOfPaveBlockListOfPaveBlock_hxx diff --git a/opencascade/BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx b/opencascade/BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx index 67adc4393..8c690c489 100644 --- a/opencascade/BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx +++ b/opencascade/BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,17 +11,31 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_DataMapOfShapeCoupleOfPaveBlocks_HeaderFile -#define BOPDS_DataMapOfShapeCoupleOfPaveBlocks_HeaderFile +//! @file BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. -#include +#ifndef _BOPDS_DataMapOfShapeCoupleOfPaveBlocks_hxx +#define _BOPDS_DataMapOfShapeCoupleOfPaveBlocks_hxx +#include +#include #include #include +Standard_HEADER_DEPRECATED("BOPDS_DataMapOfShapeCoupleOfPaveBlocks.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BOPDS_DataMapOfShapeCoupleOfPaveBlocks is deprecated, use NCollection_DataMap directly") typedef NCollection_DataMap BOPDS_DataMapOfShapeCoupleOfPaveBlocks; -typedef BOPDS_DataMapOfShapeCoupleOfPaveBlocks::Iterator - BOPDS_DataMapIteratorOfDataMapOfShapeCoupleOfPaveBlocks; +Standard_DEPRECATED("BOPDS_DataMapIteratorOfDataMapOfShapeCoupleOfPaveBlocks is deprecated, use " + "NCollection_DataMap::Iterator directly") +typedef NCollection_DataMap:: + Iterator BOPDS_DataMapIteratorOfDataMapOfShapeCoupleOfPaveBlocks; -#endif +#endif // _BOPDS_DataMapOfShapeCoupleOfPaveBlocks_hxx diff --git a/opencascade/BOPDS_FaceInfo.hxx b/opencascade/BOPDS_FaceInfo.hxx index ebcabca50..2e884a50a 100644 --- a/opencascade/BOPDS_FaceInfo.hxx +++ b/opencascade/BOPDS_FaceInfo.hxx @@ -22,10 +22,11 @@ #include #include -#include +#include +#include #include #include -#include +#include //! The class BOPDS_FaceInfo is to store //! handy information about state of face @@ -41,37 +42,37 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - BOPDS_FaceInfo(const Handle(NCollection_BaseAllocator)& theAllocator); + BOPDS_FaceInfo(const occ::handle& theAllocator); //! Clears the contents void Clear(); //! Modifier //! Sets the index of the face - void SetIndex(const Standard_Integer theI); + void SetIndex(const int theI); //! Selector //! Returns the index of the face //! //! In - Standard_Integer Index() const; + int Index() const; //! Selector //! Returns the pave blocks of the face - //! that have state In - const BOPDS_IndexedMapOfPaveBlock& PaveBlocksIn() const; + //! that have state In + const NCollection_IndexedMap>& PaveBlocksIn() const; //! Selector/Modifier //! Returns the pave blocks //! of the face - //! that have state In - BOPDS_IndexedMapOfPaveBlock& ChangePaveBlocksIn(); + //! that have state In + NCollection_IndexedMap>& ChangePaveBlocksIn(); //! Selector //! Returns the list of indices for vertices //! of the face //! that have state In - const TColStd_MapOfInteger& VerticesIn() const; + const NCollection_Map& VerticesIn() const; //! Selector/Modifier //! Returns the list of indices for vertices @@ -79,24 +80,24 @@ public: //! that have state In //! //! On - TColStd_MapOfInteger& ChangeVerticesIn(); + NCollection_Map& ChangeVerticesIn(); //! Selector //! Returns the pave blocks of the face - //! that have state On - const BOPDS_IndexedMapOfPaveBlock& PaveBlocksOn() const; + //! that have state On + const NCollection_IndexedMap>& PaveBlocksOn() const; //! Selector/Modifier //! Returns the pave blocks //! of the face - //! that have state On - BOPDS_IndexedMapOfPaveBlock& ChangePaveBlocksOn(); + //! that have state On + NCollection_IndexedMap>& ChangePaveBlocksOn(); //! Selector //! Returns the list of indices for vertices //! of the face //! that have state On - const TColStd_MapOfInteger& VerticesOn() const; + const NCollection_Map& VerticesOn() const; //! Selector/Modifier //! Returns the list of indices for vertices @@ -104,38 +105,36 @@ public: //! that have state On //! //! Sections - TColStd_MapOfInteger& ChangeVerticesOn(); + NCollection_Map& ChangeVerticesOn(); //! Selector //! Returns the pave blocks of the face - //! that are pave blocks of section edges - const BOPDS_IndexedMapOfPaveBlock& PaveBlocksSc() const; + //! that are pave blocks of section edges + const NCollection_IndexedMap>& PaveBlocksSc() const; - BOPDS_IndexedMapOfPaveBlock& ChangePaveBlocksSc(); + NCollection_IndexedMap>& ChangePaveBlocksSc(); //! Selector - //! Returns the list of indices for section vertices + //! Returns the list of indices for section vertices //! of the face - const TColStd_MapOfInteger& VerticesSc() const; + const NCollection_Map& VerticesSc() const; //! Selector/Modifier - //! Returns the list of indices for section vertices + //! Returns the list of indices for section vertices //! of the face //! //! Others - TColStd_MapOfInteger& ChangeVerticesSc(); + NCollection_Map& ChangeVerticesSc(); protected: - Handle(NCollection_BaseAllocator) myAllocator; - Standard_Integer myIndex; - BOPDS_IndexedMapOfPaveBlock myPaveBlocksIn; - TColStd_MapOfInteger myVerticesIn; - BOPDS_IndexedMapOfPaveBlock myPaveBlocksOn; - TColStd_MapOfInteger myVerticesOn; - BOPDS_IndexedMapOfPaveBlock myPaveBlocksSc; - TColStd_MapOfInteger myVerticesSc; - -private: + occ::handle myAllocator; + int myIndex; + NCollection_IndexedMap> myPaveBlocksIn; + NCollection_Map myVerticesIn; + NCollection_IndexedMap> myPaveBlocksOn; + NCollection_Map myVerticesOn; + NCollection_IndexedMap> myPaveBlocksSc; + NCollection_Map myVerticesSc; }; #include diff --git a/opencascade/BOPDS_FaceInfo.lxx b/opencascade/BOPDS_FaceInfo.lxx index bf4272a60..91a21ac10 100644 --- a/opencascade/BOPDS_FaceInfo.lxx +++ b/opencascade/BOPDS_FaceInfo.lxx @@ -15,10 +15,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_FaceInfo::BOPDS_FaceInfo() : myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()), myIndex(-1), @@ -31,11 +29,9 @@ inline BOPDS_FaceInfo::BOPDS_FaceInfo() { } -//======================================================================= -// function : -// purpose : -//======================================================================= -inline BOPDS_FaceInfo::BOPDS_FaceInfo(const Handle(NCollection_BaseAllocator)& theAllocator) +//================================================================================================= + +inline BOPDS_FaceInfo::BOPDS_FaceInfo(const occ::handle& theAllocator) : myAllocator(theAllocator), myIndex(-1), myPaveBlocksIn(100, myAllocator), @@ -47,19 +43,15 @@ inline BOPDS_FaceInfo::BOPDS_FaceInfo(const Handle(NCollection_BaseAllocator)& t { } -//======================================================================= -// function : ~ -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_FaceInfo::~BOPDS_FaceInfo() { Clear(); } -//======================================================================= -// function : Clear -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_FaceInfo::Clear() { myPaveBlocksIn.Clear(); @@ -68,130 +60,105 @@ inline void BOPDS_FaceInfo::Clear() myVerticesOn.Clear(); } -//======================================================================= -// function : SetIndex -// purpose : -//======================================================================= -inline void BOPDS_FaceInfo::SetIndex(const Standard_Integer theI) +//================================================================================================= + +inline void BOPDS_FaceInfo::SetIndex(const int theI) { myIndex = theI; } -//======================================================================= -// function : Index -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_FaceInfo::Index() const +//================================================================================================= + +inline int BOPDS_FaceInfo::Index() const { return myIndex; } -//======================================================================= -// function : PaveBlockIn -// purpose : -//======================================================================= -inline const BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::PaveBlocksIn() const +//================================================================================================= + +inline const NCollection_IndexedMap>& BOPDS_FaceInfo::PaveBlocksIn() + const { return myPaveBlocksIn; } -//======================================================================= -// function : ChangePaveBlocksIn -// purpose : -//======================================================================= -inline BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::ChangePaveBlocksIn() +//================================================================================================= + +inline NCollection_IndexedMap>& BOPDS_FaceInfo::ChangePaveBlocksIn() { return myPaveBlocksIn; } -//======================================================================= -// function : VerticesIn -// purpose : -//======================================================================= -inline const TColStd_MapOfInteger& BOPDS_FaceInfo::VerticesIn() const +//================================================================================================= + +inline const NCollection_Map& BOPDS_FaceInfo::VerticesIn() const { return myVerticesIn; } -//======================================================================= -// function : ChangeVerticesIn -// purpose : -//======================================================================= -inline TColStd_MapOfInteger& BOPDS_FaceInfo::ChangeVerticesIn() +//================================================================================================= + +inline NCollection_Map& BOPDS_FaceInfo::ChangeVerticesIn() { return myVerticesIn; } // On -//======================================================================= -// function : PaveBlocksOn -// purpose : -//======================================================================= -inline const BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::PaveBlocksOn() const +//================================================================================================= + +inline const NCollection_IndexedMap>& BOPDS_FaceInfo::PaveBlocksOn() + const { return myPaveBlocksOn; } -//======================================================================= -// function : ChangePaveBlocksOn -// purpose : -//======================================================================= -inline BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::ChangePaveBlocksOn() +//================================================================================================= + +inline NCollection_IndexedMap>& BOPDS_FaceInfo::ChangePaveBlocksOn() { return myPaveBlocksOn; } -//======================================================================= -// function : VerticesOn -// purpose : -//======================================================================= -inline const TColStd_MapOfInteger& BOPDS_FaceInfo::VerticesOn() const +//================================================================================================= + +inline const NCollection_Map& BOPDS_FaceInfo::VerticesOn() const { return myVerticesOn; } -//======================================================================= -// function : ChangeVerticesOn -// purpose : -//======================================================================= -inline TColStd_MapOfInteger& BOPDS_FaceInfo::ChangeVerticesOn() +//================================================================================================= + +inline NCollection_Map& BOPDS_FaceInfo::ChangeVerticesOn() { return myVerticesOn; } // Sc -//======================================================================= -// function : PaveBlocksSc -// purpose : -//======================================================================= -inline const BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::PaveBlocksSc() const +//================================================================================================= + +inline const NCollection_IndexedMap>& BOPDS_FaceInfo::PaveBlocksSc() + const { return myPaveBlocksSc; } -//======================================================================= -// function : ChangePaveBlocksSc -// purpose : -//======================================================================= -inline BOPDS_IndexedMapOfPaveBlock& BOPDS_FaceInfo::ChangePaveBlocksSc() +//================================================================================================= + +inline NCollection_IndexedMap>& BOPDS_FaceInfo::ChangePaveBlocksSc() { return myPaveBlocksSc; } -//======================================================================= -// function : VerticesSc -// purpose : -//======================================================================= -inline const TColStd_MapOfInteger& BOPDS_FaceInfo::VerticesSc() const +//================================================================================================= + +inline const NCollection_Map& BOPDS_FaceInfo::VerticesSc() const { return myVerticesSc; } -//======================================================================= -// function : ChangeVerticesSc -// purpose : -//======================================================================= -inline TColStd_MapOfInteger& BOPDS_FaceInfo::ChangeVerticesSc() +//================================================================================================= + +inline NCollection_Map& BOPDS_FaceInfo::ChangeVerticesSc() { return myVerticesSc; } diff --git a/opencascade/BOPDS_IndexRange.hxx b/opencascade/BOPDS_IndexRange.hxx index 1bc4b9156..fde30e170 100644 --- a/opencascade/BOPDS_IndexRange.hxx +++ b/opencascade/BOPDS_IndexRange.hxx @@ -31,43 +31,44 @@ public: //! Empty constructor BOPDS_IndexRange(); + //! Constructor with initial indices + BOPDS_IndexRange(const int theI1, const int theI2); + //! Modifier - //! Sets the first index of the range - void SetFirst(const Standard_Integer theI1); + //! Sets the first index of the range + void SetFirst(const int theI1); //! Modifier - //! Sets the second index of the range - void SetLast(const Standard_Integer theI2); + //! Sets the second index of the range + void SetLast(const int theI2); //! Selector //! Returns the first index of the range - Standard_Integer First() const; + int First() const; //! Selector //! Returns the second index of the range - Standard_Integer Last() const; + int Last() const; //! Modifier //! Sets the first index of the range //! Sets the second index of the range - void SetIndices(const Standard_Integer theI1, const Standard_Integer theI2); + void SetIndices(const int theI1, const int theI2); //! Selector //! Returns the first index of the range //! Returns the second index of the range - void Indices(Standard_Integer& theI1, Standard_Integer& theI2) const; + void Indices(int& theI1, int& theI2) const; //! Query //! Returns true if the range contains - Standard_Boolean Contains(const Standard_Integer theIndex) const; + bool Contains(const int theIndex) const; Standard_EXPORT void Dump() const; protected: - Standard_Integer myFirst; - Standard_Integer myLast; - -private: + int myFirst; + int myLast; }; #include diff --git a/opencascade/BOPDS_IndexRange.lxx b/opencascade/BOPDS_IndexRange.lxx index b348c9c45..07b9c56b9 100644 --- a/opencascade/BOPDS_IndexRange.lxx +++ b/opencascade/BOPDS_IndexRange.lxx @@ -12,77 +12,69 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_IndexRange::BOPDS_IndexRange() : myFirst(0), myLast(0) { } -//======================================================================= -// function : SetFirst -// purpose : -//======================================================================= -inline void BOPDS_IndexRange::SetFirst(const Standard_Integer aFirst) +//================================================================================================= + +inline BOPDS_IndexRange::BOPDS_IndexRange(const int theI1, const int theI2) + : myFirst(theI1), + myLast(theI2) +{ +} + +//================================================================================================= + +inline void BOPDS_IndexRange::SetFirst(const int aFirst) { myFirst = aFirst; } -//======================================================================= -// function : First -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_IndexRange::First() const +//================================================================================================= + +inline int BOPDS_IndexRange::First() const { return myFirst; } -//======================================================================= -// function : SetLast -// purpose : -//======================================================================= -inline void BOPDS_IndexRange::SetLast(const Standard_Integer aLast) +//================================================================================================= + +inline void BOPDS_IndexRange::SetLast(const int aLast) { myLast = aLast; } -//======================================================================= -// function :Last -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_IndexRange::Last() const +//================================================================================================= + +inline int BOPDS_IndexRange::Last() const { return myLast; } -//======================================================================= -// function : SetIndices -// purpose : -//======================================================================= -inline void BOPDS_IndexRange::SetIndices(const Standard_Integer theI1, const Standard_Integer theI2) +//================================================================================================= + +inline void BOPDS_IndexRange::SetIndices(const int theI1, const int theI2) { myFirst = theI1; myLast = theI2; } -//======================================================================= -// function : Indices -// purpose : -//======================================================================= -inline void BOPDS_IndexRange::Indices(Standard_Integer& theI1, Standard_Integer& theI2) const +//================================================================================================= + +inline void BOPDS_IndexRange::Indices(int& theI1, int& theI2) const { theI1 = myFirst; theI2 = myLast; } -//======================================================================= -// function : Contains -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_IndexRange::Contains(const Standard_Integer aIndex) const +//================================================================================================= + +inline bool BOPDS_IndexRange::Contains(const int aIndex) const { return aIndex >= myFirst && aIndex <= myLast; } diff --git a/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx b/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx index f23c5f5ab..b294f58ae 100644 --- a/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx +++ b/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,14 +11,29 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_IndexedDataMapOfPaveBlockListOfInteger_HeaderFile -#define BOPDS_IndexedDataMapOfPaveBlockListOfInteger_HeaderFile +//! @file BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap, +//! TColStd_ListOfInteger> directly instead. +#ifndef _BOPDS_IndexedDataMapOfPaveBlockListOfInteger_hxx +#define _BOPDS_IndexedDataMapOfPaveBlockListOfInteger_hxx + +#include #include #include #include -typedef NCollection_IndexedDataMap +Standard_HEADER_DEPRECATED( + "BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedDataMap, TColStd_ListOfInteger> " + "directly.") + + Standard_DEPRECATED("BOPDS_IndexedDataMapOfPaveBlockListOfInteger is deprecated, use " + "NCollection_IndexedDataMap, " + "TColStd_ListOfInteger> directly") +typedef NCollection_IndexedDataMap, TColStd_ListOfInteger> BOPDS_IndexedDataMapOfPaveBlockListOfInteger; -#endif +#endif // _BOPDS_IndexedDataMapOfPaveBlockListOfInteger_hxx diff --git a/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx b/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx index 78bff7a70..71305e305 100644 --- a/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx +++ b/opencascade/BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,14 +11,29 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock_HeaderFile -#define BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock_HeaderFile +//! @file BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap, +//! BOPDS_ListOfPaveBlock> directly instead. +#ifndef _BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock_hxx +#define _BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock_hxx + +#include #include #include #include -typedef NCollection_IndexedDataMap +Standard_HEADER_DEPRECATED( + "BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedDataMap, BOPDS_ListOfPaveBlock> " + "directly.") + + Standard_DEPRECATED("BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock is deprecated, use " + "NCollection_IndexedDataMap, " + "BOPDS_ListOfPaveBlock> directly") +typedef NCollection_IndexedDataMap, BOPDS_ListOfPaveBlock> BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock; -#endif +#endif // _BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock_hxx diff --git a/opencascade/BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx b/opencascade/BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx index ea63259fc..c9e8b7ef4 100644 --- a/opencascade/BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx +++ b/opencascade/BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,15 +11,28 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks_HeaderFile -#define BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks_HeaderFile +//! @file BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap directly instead. -#include +#ifndef _BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks_hxx +#define _BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks_hxx +#include +#include #include #include +Standard_HEADER_DEPRECATED("BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx is deprecated since " + "OCCT 8.0.0. Use NCollection_IndexedDataMap directly.") + + Standard_DEPRECATED("BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks is deprecated, use " + "NCollection_IndexedDataMap directly") typedef NCollection_IndexedDataMap BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks; -#endif +#endif // _BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks_hxx diff --git a/opencascade/BOPDS_IndexedMapOfPaveBlock.hxx b/opencascade/BOPDS_IndexedMapOfPaveBlock.hxx index 1b58f9f55..03031a9d6 100644 --- a/opencascade/BOPDS_IndexedMapOfPaveBlock.hxx +++ b/opencascade/BOPDS_IndexedMapOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_IndexedMapOfPaveBlock_HeaderFile -#define BOPDS_IndexedMapOfPaveBlock_HeaderFile +//! @file BOPDS_IndexedMapOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedMap> directly instead. +#ifndef _BOPDS_IndexedMapOfPaveBlock_hxx +#define _BOPDS_IndexedMapOfPaveBlock_hxx + +#include #include #include -typedef NCollection_IndexedMap BOPDS_IndexedMapOfPaveBlock; +Standard_HEADER_DEPRECATED("BOPDS_IndexedMapOfPaveBlock.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedMap> directly.") + + Standard_DEPRECATED("BOPDS_IndexedMapOfPaveBlock is deprecated, use " + "NCollection_IndexedMap> directly") +typedef NCollection_IndexedMap> BOPDS_IndexedMapOfPaveBlock; -#endif +#endif // _BOPDS_IndexedMapOfPaveBlock_hxx diff --git a/opencascade/BOPDS_Interf.hxx b/opencascade/BOPDS_Interf.hxx index 307981638..3182aeb1a 100644 --- a/opencascade/BOPDS_Interf.hxx +++ b/opencascade/BOPDS_Interf.hxx @@ -17,8 +17,11 @@ #include #include -#include -#include +#include +#include +#include + +#include /** * The class BOPDS_Interf stores the information about @@ -26,10 +29,8 @@ * The class BOPDS_Interf is root class * */ -//======================================================================= -// function : BOPDS_Interf -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_Interf { public: @@ -41,7 +42,7 @@ public: * @param theIndex2 * index of the second shape */ - void SetIndices(const Standard_Integer theIndex1, const Standard_Integer theIndex2) + void SetIndices(const int theIndex1, const int theIndex2) { myIndex1 = theIndex1; myIndex2 = theIndex2; @@ -55,7 +56,7 @@ public: * @param theIndex2 * index of the second shape */ - void Indices(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const + void Indices(int& theIndex1, int& theIndex2) const { theIndex1 = myIndex1; theIndex2 = myIndex2; @@ -67,7 +68,7 @@ public: * @param theIndex * index of the first shape */ - void SetIndex1(const Standard_Integer theIndex) { myIndex1 = theIndex; } + void SetIndex1(const int theIndex) { myIndex1 = theIndex; } // /** @@ -75,7 +76,7 @@ public: * @param theIndex * index of the second shape */ - void SetIndex2(const Standard_Integer theIndex) { myIndex2 = theIndex; } + void SetIndex2(const int theIndex) { myIndex2 = theIndex; } // /** @@ -83,7 +84,7 @@ public: * @return * index of the first shape */ - Standard_Integer Index1() const { return myIndex1; } + int Index1() const { return myIndex1; } // /** @@ -91,7 +92,7 @@ public: * @return * index of the second shape */ - Standard_Integer Index2() const { return myIndex2; } + int Index2() const { return myIndex2; } // /** @@ -101,7 +102,7 @@ public: * @return * index of opposite shape */ - Standard_Integer OppositeIndex(const Standard_Integer theI) const + int OppositeIndex(const int theI) const { if (theI == myIndex1) { @@ -125,10 +126,7 @@ public: * @return * true if the interference contains given index */ - Standard_Boolean Contains(const Standard_Integer theIndex) const - { - return (myIndex1 == theIndex || myIndex2 == theIndex); - } + bool Contains(const int theIndex) const { return (myIndex1 == theIndex || myIndex2 == theIndex); } // /** @@ -136,7 +134,7 @@ public: * @param theIndex * the index */ - void SetIndexNew(const Standard_Integer theIndex) { myIndexNew = theIndex; } + void SetIndexNew(const int theIndex) { myIndexNew = theIndex; } // // @@ -145,7 +143,7 @@ public: * @return theIndex * the index of new shape */ - Standard_Integer IndexNew() const { return myIndexNew; } + int IndexNew() const { return myIndexNew; } // /** @@ -156,7 +154,7 @@ public: * @return true if the interference has index of new shape * that is equal to the given index */ - Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const + bool HasIndexNew(int& theIndex) const { theIndex = myIndexNew; return (myIndexNew >= 0); @@ -168,7 +166,14 @@ public: * the index * @return true if the interference has index of new shape */ - Standard_Boolean HasIndexNew() const { return (myIndexNew + 1) != 0; } + bool HasIndexNew() const { return myIndexNew != -1; } + + //! Returns the index of new shape. + //! If the index is not set, returns std::nullopt. + std::optional GetIndexNew() const + { + return myIndexNew != -1 ? std::optional(myIndexNew) : std::nullopt; + } // protected: @@ -181,7 +186,7 @@ protected: } // - BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_Interf(const occ::handle& theAllocator) : myIndex1(-1), myIndex2(-1), myIndexNew(-1), @@ -190,23 +195,21 @@ protected: } // - virtual ~BOPDS_Interf() {} + virtual ~BOPDS_Interf() = default; protected: - Standard_Integer myIndex1; - Standard_Integer myIndex2; - Standard_Integer myIndexNew; - Handle(NCollection_BaseAllocator) myAllocator; + int myIndex1; + int myIndex2; + int myIndexNew; + occ::handle myAllocator; }; /** * The class BOPDS_InterfVV stores the information about * the interference of the type vertex/vertex. */ -//======================================================================= -// function : BOPDS_InterfVV -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfVV : public BOPDS_Interf { public: @@ -215,9 +218,8 @@ public: * Constructor */ BOPDS_InterfVV() - : BOPDS_Interf() - { - } + + = default; // /** @@ -225,7 +227,7 @@ public: * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfVV(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) { } @@ -234,7 +236,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfVV() {} + ~BOPDS_InterfVV() override = default; // }; @@ -243,10 +245,8 @@ public: * The class BOPDS_InterfVE stores the information about * the interference of the type vertex/edge. */ -//======================================================================= -// function : BOPDS_InterfVE -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfVE : public BOPDS_Interf { public: @@ -255,8 +255,7 @@ public: * Constructor */ BOPDS_InterfVE() - : BOPDS_Interf(), - myParameter(0.) + : myParameter(0.) { } @@ -266,7 +265,7 @@ public: * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfVE(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator), myParameter(0.) { @@ -276,7 +275,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfVE() {} + ~BOPDS_InterfVE() override = default; // /** @@ -287,7 +286,7 @@ public: * @param theT * value of parameter */ - void SetParameter(const Standard_Real theT) { myParameter = theT; } + void SetParameter(const double theT) { myParameter = theT; } // /** @@ -298,20 +297,18 @@ public: * @return * value of parameter */ - Standard_Real Parameter() const { return myParameter; } + double Parameter() const { return myParameter; } protected: - Standard_Real myParameter; + double myParameter; }; /** * The class BOPDS_InterfVF stores the information about * the interference of the type vertex/face */ -//======================================================================= -// function : BOPDS_InterfVF -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfVF : public BOPDS_Interf { public: @@ -320,8 +317,7 @@ public: * Constructor */ BOPDS_InterfVF() - : BOPDS_Interf(), - myU(0.), + : myU(0.), myV(0.) { } @@ -332,7 +328,7 @@ public: * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfVF(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator), myU(0.), myV(0.) @@ -343,7 +339,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfVF() {} + ~BOPDS_InterfVF() override = default; // /** @@ -356,7 +352,7 @@ public: * @param theV * value of U parameter */ - void SetUV(const Standard_Real theU, const Standard_Real theV) + void SetUV(const double theU, const double theV) { myU = theU; myV = theV; @@ -373,25 +369,23 @@ public: * @param theV * value of U parameter */ - void UV(Standard_Real& theU, Standard_Real& theV) const + void UV(double& theU, double& theV) const { theU = myU; theV = myV; } protected: - Standard_Real myU; - Standard_Real myV; + double myU; + double myV; }; /** * The class BOPDS_InterfEE stores the information about * the interference of the type edge/edge. */ -//======================================================================= -// function : BOPDS_InterfEE -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfEE : public BOPDS_Interf { public: @@ -400,9 +394,8 @@ public: * Constructor */ BOPDS_InterfEE() - : BOPDS_Interf() - { - } + + = default; // /** @@ -410,7 +403,7 @@ public: * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfEE(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) { } @@ -419,7 +412,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfEE() {} + ~BOPDS_InterfEE() override = default; // /** @@ -447,10 +440,8 @@ protected: * The class BOPDS_InterfEF stores the information about * the interference of the type edge/face. */ -//======================================================================= -// function : BOPDS_InterfEF -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfEF : public BOPDS_Interf { public: @@ -459,9 +450,8 @@ public: * Constructor */ BOPDS_InterfEF() - : BOPDS_Interf() - { - } + + = default; // /** @@ -474,7 +464,7 @@ public: * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfEF(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) { } @@ -483,7 +473,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfEF() {} + ~BOPDS_InterfEF() override = default; // /** @@ -513,10 +503,8 @@ protected: */ ; -//======================================================================= -// function : BOPDS_InterfFF -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfFF : public BOPDS_Interf { public: @@ -525,8 +513,7 @@ public: * Constructor */ BOPDS_InterfFF() - : BOPDS_Interf(), - myTangentFaces(Standard_False), + : myTangentFaces(false), myCurves(0, myAllocator), myPoints(0, myAllocator) { @@ -536,7 +523,7 @@ public: /** * Destructor */ - virtual ~BOPDS_InterfFF() {} + ~BOPDS_InterfFF() override = default; // /** @@ -547,7 +534,7 @@ public: * number of intersection points */ - void Init(const Standard_Integer theNbCurves, const Standard_Integer theNbPoints) + void Init(const int theNbCurves, const int theNbPoints) { if (theNbCurves > 0) { @@ -565,7 +552,7 @@ public: * @param theFlag * the flag */ - void SetTangentFaces(const Standard_Boolean theFlag) { myTangentFaces = theFlag; } + void SetTangentFaces(const bool theFlag) { myTangentFaces = theFlag; } /** * Selector @@ -573,7 +560,7 @@ public: * @return * the flag */ - Standard_Boolean TangentFaces() const { return myTangentFaces; } + bool TangentFaces() const { return myTangentFaces; } // /** @@ -582,7 +569,7 @@ public: * @return * intersection curves */ - const BOPDS_VectorOfCurve& Curves() const { return myCurves; } + const NCollection_DynamicArray& Curves() const { return myCurves; } // /** @@ -591,7 +578,7 @@ public: * @return * intersection curves */ - BOPDS_VectorOfCurve& ChangeCurves() { return myCurves; } + NCollection_DynamicArray& ChangeCurves() { return myCurves; } // /** @@ -600,7 +587,7 @@ public: * @return * intersection points */ - const BOPDS_VectorOfPoint& Points() const { return myPoints; } + const NCollection_DynamicArray& Points() const { return myPoints; } // /** @@ -609,23 +596,21 @@ public: * @return * intersection points */ - BOPDS_VectorOfPoint& ChangePoints() { return myPoints; } + NCollection_DynamicArray& ChangePoints() { return myPoints; } // protected: - Standard_Boolean myTangentFaces; - BOPDS_VectorOfCurve myCurves; - BOPDS_VectorOfPoint myPoints; + bool myTangentFaces; + NCollection_DynamicArray myCurves; + NCollection_DynamicArray myPoints; }; /** * The class BOPDS_InterfVZ stores the information about * the interference of the type vertex/solid. */ -//======================================================================= -// function : BOPDS_InterfVZ -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfVZ : public BOPDS_Interf { public: @@ -633,21 +618,20 @@ public: /** * Constructor */ - BOPDS_InterfVZ() - : BOPDS_Interf() {}; + BOPDS_InterfVZ() = default; // /** * Constructor * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfVZ(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) {}; // /** * Destructor */ - virtual ~BOPDS_InterfVZ() {}; + ~BOPDS_InterfVZ() override = default; // }; @@ -655,10 +639,8 @@ public: * The class BOPDS_InterfEZ stores the information about * the interference of the type edge/solid. */ -//======================================================================= -// function : BOPDS_InterfEZ -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfEZ : public BOPDS_Interf { public: @@ -666,21 +648,20 @@ public: /** * Constructor */ - BOPDS_InterfEZ() - : BOPDS_Interf() {}; + BOPDS_InterfEZ() = default; // /** * Constructor * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfEZ(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) {}; // /** * Destructor */ - virtual ~BOPDS_InterfEZ() {}; + ~BOPDS_InterfEZ() override = default; // }; @@ -688,10 +669,8 @@ public: * The class BOPDS_InterfFZ stores the information about * the interference of the type face/solid. */ -//======================================================================= -// function : BOPDS_InterfFZ -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfFZ : public BOPDS_Interf { public: @@ -699,21 +678,20 @@ public: /** * Constructor */ - BOPDS_InterfFZ() - : BOPDS_Interf() {}; + BOPDS_InterfFZ() = default; // /** * Constructor * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfFZ(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) {}; // /** * Destructor */ - virtual ~BOPDS_InterfFZ() {}; + ~BOPDS_InterfFZ() override = default; // }; @@ -721,10 +699,8 @@ public: * The class BOPDS_InterfZZ stores the information about * the interference of the type solid/solid. */ -//======================================================================= -// function : BOPDS_InterfZZ -// purpose : -//======================================================================= +//================================================================================================= + class BOPDS_InterfZZ : public BOPDS_Interf { public: @@ -732,21 +708,20 @@ public: /** * Constructor */ - BOPDS_InterfZZ() - : BOPDS_Interf() {}; + BOPDS_InterfZZ() = default; // /** * Constructor * @param theAllocator * allocator to manage the memory */ - BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPDS_InterfZZ(const occ::handle& theAllocator) : BOPDS_Interf(theAllocator) {}; // /** * Destructor */ - virtual ~BOPDS_InterfZZ() {}; + ~BOPDS_InterfZZ() override = default; // }; diff --git a/opencascade/BOPDS_Iterator.hxx b/opencascade/BOPDS_Iterator.hxx index 77243b3be..eb88668f1 100644 --- a/opencascade/BOPDS_Iterator.hxx +++ b/opencascade/BOPDS_Iterator.hxx @@ -24,7 +24,8 @@ #include #include -#include +#include +#include #include #include #include @@ -48,7 +49,7 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - Standard_EXPORT BOPDS_Iterator(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_Iterator(const occ::handle& theAllocator); //! Modifier //! Sets the data structure to process @@ -58,14 +59,14 @@ public: //! Returns the data structure Standard_EXPORT const BOPDS_DS& DS() const; - //! Initializes the iterator + //! Initializes the iterator //! theType1 - the first type of shape //! theType2 - the second type of shape Standard_EXPORT void Initialize(const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2); - //! Returns true if still there are pairs + //! Returns true if still there are pairs //! of intersected shapes - Standard_EXPORT Standard_Boolean More() const; + Standard_EXPORT bool More() const; //! Moves iterations ahead Standard_EXPORT void Next(); @@ -73,57 +74,59 @@ public: //! Returns indices (DS) of intersected shapes //! theIndex1 - the index of the first shape //! theIndex2 - the index of the second shape - Standard_EXPORT void Value(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const; + Standard_EXPORT void Value(int& theIndex1, int& theIndex2) const; //! Perform the intersection algorithm and prepare //! the results to be used Standard_EXPORT virtual void Prepare( - const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(), - const Standard_Boolean theCheckOBB = Standard_False, - const Standard_Real theFuzzyValue = Precision::Confusion()); + const occ::handle& theCtx = occ::handle(), + const bool theCheckOBB = false, + const double theFuzzyValue = Precision::Confusion()); //! Updates the tree of Bounding Boxes with increased boxes and //! intersects such elements with the tree. - Standard_EXPORT void IntersectExt(const TColStd_MapOfInteger& theIndicies); + Standard_EXPORT void IntersectExt(const NCollection_Map& theIndicies); //! Returns the number of intersections founded - Standard_EXPORT Standard_Integer ExpectedLength() const; + Standard_EXPORT int ExpectedLength() const; //! Returns the block length - Standard_EXPORT Standard_Integer BlockLength() const; + Standard_EXPORT int BlockLength() const; //! Set the flag of parallel processing //! if is true the parallel processing is switched on //! if is false the parallel processing is switched off - Standard_EXPORT void SetRunParallel(const Standard_Boolean theFlag); + Standard_EXPORT void SetRunParallel(const bool theFlag); //! Returns the flag of parallel processing - Standard_EXPORT Standard_Boolean RunParallel() const; + Standard_EXPORT bool RunParallel() const; public: //! @name Number of extra interfering types // Extra lists contain only V/V, V/E, V/F interfering pairs. // Although E/E is also initialized (but never filled) for code simplicity. - static Standard_Integer NbExtInterfs() { return 4; } + static int NbExtInterfs() { return 4; } protected: //! @name Protected methods for bounding boxes intersection //! Intersects the Bounding boxes of sub-shapes of the arguments with the tree //! and saves the interfering pairs for further geometrical intersection. Standard_EXPORT virtual void Intersect( - const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(), - const Standard_Boolean theCheckOBB = Standard_False, - const Standard_Real theFuzzyValue = Precision::Confusion()); - -protected: //! @name Fields - Handle(NCollection_BaseAllocator) myAllocator; //!< Allocator - Standard_Integer myLength; //!< Length of the intersection vector of - //! particular intersection type - BOPDS_PDS myDS; //!< Data Structure - BOPDS_VectorOfVectorOfPair myLists; //!< Pairs with interfering bounding boxes - BOPDS_VectorOfPair::Iterator myIterator; //!< Iterator on each interfering type - Standard_Boolean myRunParallel; //!< Flag for parallel processing - BOPDS_VectorOfVectorOfPair myExtLists; //!< Extra pairs of sub-shapes found after - //! intersection of increased sub-shapes - Standard_Boolean myUseExt; //!< Information flag for using the extra lists + const occ::handle& theCtx = occ::handle(), + const bool theCheckOBB = false, + const double theFuzzyValue = Precision::Confusion()); + +protected: //! @name Fields + occ::handle myAllocator; //!< Allocator + int myLength; //!< Length of the intersection vector of + //! particular intersection type + BOPDS_PDS myDS; //!< Data Structure + NCollection_DynamicArray> + myLists; //!< Pairs with interfering bounding boxes + NCollection_DynamicArray::Iterator myIterator; //!< Iterator on each interfering type + bool myRunParallel; //!< Flag for parallel processing + NCollection_DynamicArray> + myExtLists; //!< Extra pairs of sub-shapes found after + //! intersection of increased sub-shapes + bool myUseExt; //!< Information flag for using the extra lists }; #endif // _BOPDS_Iterator_HeaderFile diff --git a/opencascade/BOPDS_IteratorSI.hxx b/opencascade/BOPDS_IteratorSI.hxx index ee18bfd6f..480735ff0 100644 --- a/opencascade/BOPDS_IteratorSI.hxx +++ b/opencascade/BOPDS_IteratorSI.hxx @@ -40,11 +40,11 @@ public: //! Empty constructor Standard_EXPORT BOPDS_IteratorSI(); - Standard_EXPORT virtual ~BOPDS_IteratorSI(); + Standard_EXPORT ~BOPDS_IteratorSI() override; //! Constructor //! @param theAllocator the allocator to manage the memory - Standard_EXPORT BOPDS_IteratorSI(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_IteratorSI(const occ::handle& theAllocator); //! Updates the lists of possible intersections //! according to the value of . @@ -55,15 +55,13 @@ public: //! 3 - V/V, V/E, E/E and V/F; //! 4 - V/V, V/E, E/E, V/F and E/F; //! other - all interferences. - Standard_EXPORT void UpdateByLevelOfCheck(const Standard_Integer theLevel); + Standard_EXPORT void UpdateByLevelOfCheck(const int theLevel); protected: - Standard_EXPORT virtual void Intersect( - const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(), - const Standard_Boolean theCheckOBB = Standard_False, - const Standard_Real theFuzzyValue = Precision::Confusion()) Standard_OVERRIDE; - -private: + Standard_EXPORT void Intersect( + const occ::handle& theCtx = occ::handle(), + const bool theCheckOBB = false, + const double theFuzzyValue = Precision::Confusion()) override; }; #endif // _BOPDS_IteratorSI_HeaderFile diff --git a/opencascade/BOPDS_ListOfPave.hxx b/opencascade/BOPDS_ListOfPave.hxx index 4a835678c..3a5900f3b 100644 --- a/opencascade/BOPDS_ListOfPave.hxx +++ b/opencascade/BOPDS_ListOfPave.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_ListOfPave_HeaderFile -#define BOPDS_ListOfPave_HeaderFile +//! @file BOPDS_ListOfPave.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_ListOfPave_hxx +#define _BOPDS_ListOfPave_hxx + +#include #include #include +Standard_HEADER_DEPRECATED( + "BOPDS_ListOfPave.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_ListOfPave is deprecated, use NCollection_List directly") typedef NCollection_List BOPDS_ListOfPave; -typedef BOPDS_ListOfPave::Iterator BOPDS_ListIteratorOfListOfPave; +Standard_DEPRECATED("BOPDS_ListIteratorOfListOfPave is deprecated, use " + "NCollection_List::Iterator directly") +typedef NCollection_List::Iterator BOPDS_ListIteratorOfListOfPave; -#endif +#endif // _BOPDS_ListOfPave_hxx diff --git a/opencascade/BOPDS_ListOfPaveBlock.hxx b/opencascade/BOPDS_ListOfPaveBlock.hxx deleted file mode 100644 index aee744175..000000000 --- a/opencascade/BOPDS_ListOfPaveBlock.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BOPDS_ListOfPaveBlock_HeaderFile -#define BOPDS_ListOfPaveBlock_HeaderFile - -#include -#include - -class BOPDS_PaveBlock; - -typedef NCollection_List BOPDS_ListOfPaveBlock; -typedef BOPDS_ListOfPaveBlock::Iterator BOPDS_ListIteratorOfListOfPaveBlock; - -#endif diff --git a/opencascade/BOPDS_MapOfCommonBlock.hxx b/opencascade/BOPDS_MapOfCommonBlock.hxx index 0e22bc313..f46ba1007 100644 --- a/opencascade/BOPDS_MapOfCommonBlock.hxx +++ b/opencascade/BOPDS_MapOfCommonBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,27 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_MapOfCommonBlock_HeaderFile -#define BOPDS_MapOfCommonBlock_HeaderFile +//! @file BOPDS_MapOfCommonBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_MapOfCommonBlock_hxx +#define _BOPDS_MapOfCommonBlock_hxx + +#include #include #include -typedef NCollection_Map BOPDS_MapOfCommonBlock; -typedef BOPDS_MapOfCommonBlock::Iterator BOPDS_MapIteratorOfMapOfCommonBlock; +Standard_HEADER_DEPRECATED( + "BOPDS_MapOfCommonBlock.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_MapOfCommonBlock is deprecated, use " + "NCollection_Map> directly") +typedef NCollection_Map> BOPDS_MapOfCommonBlock; +Standard_DEPRECATED("BOPDS_MapIteratorOfMapOfCommonBlock is deprecated, use " + "NCollection_Map>::Iterator directly") +typedef NCollection_Map>::Iterator + BOPDS_MapIteratorOfMapOfCommonBlock; -#endif +#endif // _BOPDS_MapOfCommonBlock_hxx diff --git a/opencascade/BOPDS_MapOfPair.hxx b/opencascade/BOPDS_MapOfPair.hxx index 5793d9fc3..fe52607da 100644 --- a/opencascade/BOPDS_MapOfPair.hxx +++ b/opencascade/BOPDS_MapOfPair.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 2017 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_MapOfPair_HeaderFile -#define BOPDS_MapOfPair_HeaderFile +//! @file BOPDS_MapOfPair.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_MapOfPair_hxx +#define _BOPDS_MapOfPair_hxx + +#include #include #include +Standard_HEADER_DEPRECATED( + "BOPDS_MapOfPair.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_MapOfPair is deprecated, use NCollection_Map directly") typedef NCollection_Map BOPDS_MapOfPair; -typedef BOPDS_MapOfPair::Iterator BOPDS_MapIteratorOfMapOfPair; +Standard_DEPRECATED( + "BOPDS_MapIteratorOfMapOfPair is deprecated, use NCollection_Map::Iterator directly") +typedef NCollection_Map::Iterator BOPDS_MapIteratorOfMapOfPair; -#endif +#endif // _BOPDS_MapOfPair_hxx diff --git a/opencascade/BOPDS_MapOfPave.hxx b/opencascade/BOPDS_MapOfPave.hxx index 8ee118c45..5dbf022fd 100644 --- a/opencascade/BOPDS_MapOfPave.hxx +++ b/opencascade/BOPDS_MapOfPave.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_MapOfPave_HeaderFile -#define BOPDS_MapOfPave_HeaderFile +//! @file BOPDS_MapOfPave.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_MapOfPave_hxx +#define _BOPDS_MapOfPave_hxx + +#include #include #include +Standard_HEADER_DEPRECATED( + "BOPDS_MapOfPave.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_MapOfPave is deprecated, use NCollection_Map directly") typedef NCollection_Map BOPDS_MapOfPave; -typedef BOPDS_MapOfPave::Iterator BOPDS_MapIteratorOfMapOfPave; +Standard_DEPRECATED( + "BOPDS_MapIteratorOfMapOfPave is deprecated, use NCollection_Map::Iterator directly") +typedef NCollection_Map::Iterator BOPDS_MapIteratorOfMapOfPave; -#endif +#endif // _BOPDS_MapOfPave_hxx diff --git a/opencascade/BOPDS_MapOfPaveBlock.hxx b/opencascade/BOPDS_MapOfPaveBlock.hxx index 8e3ba0901..7b6224408 100644 --- a/opencascade/BOPDS_MapOfPaveBlock.hxx +++ b/opencascade/BOPDS_MapOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,27 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_MapOfPaveBlock_HeaderFile -#define BOPDS_MapOfPaveBlock_HeaderFile +//! @file BOPDS_MapOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPDS_MapOfPaveBlock_hxx +#define _BOPDS_MapOfPaveBlock_hxx + +#include #include #include -typedef NCollection_Map BOPDS_MapOfPaveBlock; -typedef BOPDS_MapOfPaveBlock::Iterator BOPDS_MapIteratorOfMapOfPaveBlock; +Standard_HEADER_DEPRECATED( + "BOPDS_MapOfPaveBlock.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPDS_MapOfPaveBlock is deprecated, use " + "NCollection_Map> directly") +typedef NCollection_Map> BOPDS_MapOfPaveBlock; +Standard_DEPRECATED("BOPDS_MapIteratorOfMapOfPaveBlock is deprecated, use " + "NCollection_Map>::Iterator directly") +typedef NCollection_Map>::Iterator + BOPDS_MapIteratorOfMapOfPaveBlock; -#endif +#endif // _BOPDS_MapOfPaveBlock_hxx diff --git a/opencascade/BOPDS_Pair.hxx b/opencascade/BOPDS_Pair.hxx index feb535a6b..cdf53edae 100644 --- a/opencascade/BOPDS_Pair.hxx +++ b/opencascade/BOPDS_Pair.hxx @@ -33,17 +33,17 @@ public: } // - BOPDS_Pair(const Standard_Integer theIndex1, const Standard_Integer theIndex2) + BOPDS_Pair(const int theIndex1, const int theIndex2) : myIndex1(theIndex1), myIndex2(theIndex2) { } - ~BOPDS_Pair() {} + ~BOPDS_Pair() = default; // //! Sets the indices - void SetIndices(const Standard_Integer theIndex1, const Standard_Integer theIndex2) + void SetIndices(const int theIndex1, const int theIndex2) { myIndex1 = theIndex1; myIndex2 = theIndex2; @@ -51,7 +51,7 @@ public: // //! Gets the indices - void Indices(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const + void Indices(int& theIndex1, int& theIndex2) const { theIndex1 = myIndex1; theIndex2 = myIndex2; @@ -59,7 +59,7 @@ public: // //! Operator less - Standard_Boolean operator<(const BOPDS_Pair& theOther) const + bool operator<(const BOPDS_Pair& theOther) const { return ((myIndex1 != theOther.myIndex1) ? (myIndex1 < theOther.myIndex1) : (myIndex2 < theOther.myIndex2)); @@ -67,7 +67,7 @@ public: // //! Returns true if the Pair is equal to - Standard_Boolean IsEqual(const BOPDS_Pair& theOther) const + bool IsEqual(const BOPDS_Pair& theOther) const { return (myIndex1 == theOther.myIndex1 && myIndex2 == theOther.myIndex2) || (myIndex1 == theOther.myIndex2 && myIndex2 == theOther.myIndex1); @@ -76,8 +76,8 @@ public: bool operator==(const BOPDS_Pair& theOther) const { return IsEqual(theOther); } protected: - Standard_Integer myIndex1; - Standard_Integer myIndex2; + int myIndex1; + int myIndex2; }; namespace std @@ -99,4 +99,4 @@ struct hash }; } // namespace std -#endif // _BOPDS_Pair \ No newline at end of file +#endif // _BOPDS_Pair diff --git a/opencascade/BOPDS_Pave.hxx b/opencascade/BOPDS_Pave.hxx index 9e853ae5e..49e92e1e2 100644 --- a/opencascade/BOPDS_Pave.hxx +++ b/opencascade/BOPDS_Pave.hxx @@ -32,48 +32,49 @@ public: //! Empty constructor BOPDS_Pave(); + //! Constructor with index and parameter + BOPDS_Pave(const int theIndex, const double theParameter); + //! Modifier //! Sets the index of vertex - void SetIndex(const Standard_Integer theIndex); + void SetIndex(const int theIndex); //! Selector //! Returns the index of vertex - Standard_Integer Index() const; + int Index() const; //! Modifier //! Sets the parameter of vertex - void SetParameter(const Standard_Real theParameter); + void SetParameter(const double theParameter); //! Selector //! Returns the parameter of vertex - Standard_Real Parameter() const; + double Parameter() const; //! Selector //! Returns the index of vertex //! Returns the parameter of vertex - void Contents(Standard_Integer& theIndex, Standard_Real& theParameter) const; + void Contents(int& theIndex, double& theParameter) const; //! Query - //! Returns true if thr parameter od this is less - //! than the parameter of - Standard_Boolean IsLess(const BOPDS_Pave& theOther) const; + //! Returns true if the parameter of this is less + //! than the parameter of + bool IsLess(const BOPDS_Pave& theOther) const; - Standard_Boolean operator<(const BOPDS_Pave& theOther) const { return IsLess(theOther); } + bool operator<(const BOPDS_Pave& theOther) const { return IsLess(theOther); } //! Query - //! Returns true if thr parameter od this is equal - //! to the parameter of - Standard_Boolean IsEqual(const BOPDS_Pave& theOther) const; + //! Returns true if the parameter of this is equal + //! to the parameter of + bool IsEqual(const BOPDS_Pave& theOther) const; - Standard_Boolean operator==(const BOPDS_Pave& theOther) const { return IsEqual(theOther); } + bool operator==(const BOPDS_Pave& theOther) const { return IsEqual(theOther); } Standard_EXPORT void Dump() const; protected: - Standard_Integer myIndex; - Standard_Real myParameter; - -private: + int myIndex; + double myParameter; }; namespace std diff --git a/opencascade/BOPDS_Pave.lxx b/opencascade/BOPDS_Pave.lxx index 5361d85b3..e15567e0e 100644 --- a/opencascade/BOPDS_Pave.lxx +++ b/opencascade/BOPDS_Pave.lxx @@ -12,79 +12,67 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_Pave::BOPDS_Pave() + : myIndex(-1), + myParameter(99.) +{ +} + +//============================================================================================== +inline BOPDS_Pave::BOPDS_Pave(const int theIndex, const double theParameter) + : myIndex(theIndex), + myParameter(theParameter) { - myIndex = -1; - myParameter = 99.; } -//======================================================================= -// function : SetIndex -// purpose : -//======================================================================= -inline void BOPDS_Pave::SetIndex(const Standard_Integer theIndex) +//================================================================================================= + +inline void BOPDS_Pave::SetIndex(const int theIndex) { myIndex = theIndex; } -//======================================================================= -// function : Index -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_Pave::Index() const +//================================================================================================= + +inline int BOPDS_Pave::Index() const { return myIndex; } -//======================================================================= -// function : SetParameter -// purpose : -//======================================================================= -inline void BOPDS_Pave::SetParameter(const Standard_Real theParameter) +//================================================================================================= + +inline void BOPDS_Pave::SetParameter(const double theParameter) { myParameter = theParameter; } -//======================================================================= -// function : Parameter -// purpose : -//======================================================================= -inline Standard_Real BOPDS_Pave::Parameter() const +//================================================================================================= + +inline double BOPDS_Pave::Parameter() const { return myParameter; } -//======================================================================= -// function : Contents -// purpose : -//======================================================================= -inline void BOPDS_Pave::Contents(Standard_Integer& theIndex, Standard_Real& theParameter) const +//================================================================================================= + +inline void BOPDS_Pave::Contents(int& theIndex, double& theParameter) const { theIndex = myIndex; theParameter = myParameter; } -//======================================================================= -// function : IsLess -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_Pave::IsLess(const BOPDS_Pave& theOther) const +//================================================================================================= + +inline bool BOPDS_Pave::IsLess(const BOPDS_Pave& theOther) const { return myParameter < theOther.myParameter; } -//======================================================================= -// function : IsEqual -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_Pave::IsEqual(const BOPDS_Pave& theOther) const +//================================================================================================= + +inline bool BOPDS_Pave::IsEqual(const BOPDS_Pave& theOther) const { - Standard_Boolean bFlag; - // - bFlag = ((myIndex == theOther.myIndex) && (myParameter == theOther.myParameter)); - return bFlag; + return myIndex == theOther.myIndex && myParameter == theOther.myParameter; } diff --git a/opencascade/BOPDS_PaveBlock.hxx b/opencascade/BOPDS_PaveBlock.hxx index f2ad4391d..9d453556c 100644 --- a/opencascade/BOPDS_PaveBlock.hxx +++ b/opencascade/BOPDS_PaveBlock.hxx @@ -18,16 +18,14 @@ #include #include -#include -#include +#include #include +#include #include #include #include -#include - +#include class BOPDS_PaveBlock; -DEFINE_STANDARD_HANDLE(BOPDS_PaveBlock, Standard_Transient) //! The class BOPDS_PaveBlock is to store //! the information about pave block on an edge. @@ -41,7 +39,7 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - Standard_EXPORT BOPDS_PaveBlock(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_PaveBlock(const occ::handle& theAllocator); //! Modifier //! Sets the first pave @@ -61,54 +59,54 @@ public: //! Modifier //! Sets the index of edge of pave block - Standard_EXPORT void SetEdge(const Standard_Integer theEdge); + Standard_EXPORT void SetEdge(const int theEdge); //! Selector //! Returns the index of edge of pave block - Standard_EXPORT Standard_Integer Edge() const; + Standard_EXPORT int Edge() const; //! Query //! Returns true if the pave block has edge - Standard_EXPORT Standard_Boolean HasEdge() const; + Standard_EXPORT bool HasEdge() const; //! Query //! Returns true if the pave block has edge //! Returns the index of edge - Standard_EXPORT Standard_Boolean HasEdge(Standard_Integer& theEdge) const; + Standard_EXPORT bool HasEdge(int& theEdge) const; //! Modifier //! Sets the index of original edge //! of the pave block - Standard_EXPORT void SetOriginalEdge(const Standard_Integer theEdge); + Standard_EXPORT void SetOriginalEdge(const int theEdge); //! Selector //! Returns the index of original edge of pave block - Standard_EXPORT Standard_Integer OriginalEdge() const; + Standard_EXPORT int OriginalEdge() const; //! Query //! Returns true if the edge is equal to the original edge //! of the pave block - Standard_EXPORT Standard_Boolean IsSplitEdge() const; + Standard_EXPORT bool IsSplitEdge() const; //! Selector //! Returns the parametric range //! of the pave block - Standard_EXPORT void Range(Standard_Real& theT1, Standard_Real& theT2) const; + Standard_EXPORT void Range(double& theT1, double& theT2) const; //! Query //! Returns true if the pave block has pave indices - //! that equal to the pave indices of the pave block + //! that equal to the pave indices of the pave block //! - Standard_EXPORT Standard_Boolean HasSameBounds(const Handle(BOPDS_PaveBlock)& theOther) const; + Standard_EXPORT bool HasSameBounds(const occ::handle& theOther) const; //! Selector - //! Returns the pave indices + //! Returns the pave indices //! of the pave block - Standard_EXPORT void Indices(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const; + Standard_EXPORT void Indices(int& theIndex1, int& theIndex2) const; //! Query //! Returns true if the pave block contains extra paves - Standard_EXPORT Standard_Boolean IsToUpdate() const; + Standard_EXPORT bool IsToUpdate() const; //! Modifier //! Appends extra paves @@ -120,81 +118,79 @@ public: //! Modifier //! Removes a pave with the given vertex number from extra paves - Standard_EXPORT void RemoveExtPave(const Standard_Integer theVertNum); + Standard_EXPORT void RemoveExtPave(const int theVertNum); //! Selector - //! Returns the extra paves - Standard_EXPORT const BOPDS_ListOfPave& ExtPaves() const; + //! Returns the extra paves + Standard_EXPORT const NCollection_List& ExtPaves() const; //! Selector / Modifier //! Returns the extra paves - Standard_EXPORT BOPDS_ListOfPave& ChangeExtPaves(); + Standard_EXPORT NCollection_List& ChangeExtPaves(); //! Modifier //! Updates the pave block. The extra paves are used //! to create new pave blocks . - //! - if true, the first pave and the second + //! - if true, the first and second //! pave are used to produce new pave blocks. - Standard_EXPORT void Update(BOPDS_ListOfPaveBlock& theLPB, - const Standard_Boolean theFlag = Standard_True); + Standard_EXPORT void Update(NCollection_List>& theLPB, + const bool theFlag = true); //! Query //! Returns true if the extra paves contain the pave //! with given value of the parameter //! - the value of the tolerance to compare //! - index of the found pave - Standard_EXPORT Standard_Boolean ContainsParameter(const Standard_Real thePrm, - const Standard_Real theTol, - Standard_Integer& theInd) const; + Standard_EXPORT bool ContainsParameter(const double thePrm, + const double theTol, + int& theInd) const; //! Modifier //! Sets the shrunk data for the pave block - //! , - shrunk range + //! , - shrunk range //! - the bounding box //! - defines whether the edge can be split - Standard_EXPORT void SetShrunkData(const Standard_Real theTS1, - const Standard_Real theTS2, - const Bnd_Box& theBox, - const Standard_Boolean theIsSplittable); + Standard_EXPORT void SetShrunkData(const double theTS1, + const double theTS2, + const Bnd_Box& theBox, + const bool theIsSplittable); //! Selector - //! Returns the shrunk data for the pave block - //! , - shrunk range + //! Returns the shrunk data for the pave block + //! , - shrunk range //! - the bounding box //! - defines whether the edge can be split - Standard_EXPORT void ShrunkData(Standard_Real& theTS1, - Standard_Real& theTS2, - Bnd_Box& theBox, - Standard_Boolean& theIsSplittable) const; + Standard_EXPORT void ShrunkData(double& theTS1, + double& theTS2, + Bnd_Box& theBox, + bool& theIsSplittable) const; //! Query //! Returns true if the pave block contains //! the shrunk data - Standard_EXPORT Standard_Boolean HasShrunkData() const; + Standard_EXPORT bool HasShrunkData() const; Standard_EXPORT void Dump() const; //! Query //! Returns FALSE if the pave block has a too short //! shrunk range and cannot be split, otherwise returns TRUE - Standard_Boolean IsSplittable() const { return myIsSplittable; } + bool IsSplittable() const { return myIsSplittable; } DEFINE_STANDARD_RTTIEXT(BOPDS_PaveBlock, Standard_Transient) protected: - Handle(NCollection_BaseAllocator) myAllocator; - Standard_Integer myEdge; - Standard_Integer myOriginalEdge; - BOPDS_Pave myPave1; - BOPDS_Pave myPave2; - BOPDS_ListOfPave myExtPaves; - Standard_Real myTS1; - Standard_Real myTS2; - Bnd_Box myShrunkBox; - TColStd_MapOfInteger myMFence; - Standard_Boolean myIsSplittable; - -private: + occ::handle myAllocator; + int myEdge; + int myOriginalEdge; + BOPDS_Pave myPave1; + BOPDS_Pave myPave2; + NCollection_List myExtPaves; + double myTS1; + double myTS2; + Bnd_Box myShrunkBox; + NCollection_Map myMFence; + bool myIsSplittable; }; #endif // _BOPDS_PaveBlock_HeaderFile diff --git a/opencascade/BOPDS_Point.hxx b/opencascade/BOPDS_Point.hxx index 8b01d3e86..57b45f921 100644 --- a/opencascade/BOPDS_Point.hxx +++ b/opencascade/BOPDS_Point.hxx @@ -61,19 +61,17 @@ public: //! Modifier //! Sets the index of the vertex - void SetIndex(const Standard_Integer theIndex); + void SetIndex(const int theIndex); //! Selector //! Returns index of the vertex - Standard_Integer Index() const; + int Index() const; protected: - gp_Pnt myPnt; - gp_Pnt2d myPnt2D1; - gp_Pnt2d myPnt2D2; - Standard_Integer myIndex; - -private: + gp_Pnt myPnt; + gp_Pnt2d myPnt2D1; + gp_Pnt2d myPnt2D2; + int myIndex; }; #include diff --git a/opencascade/BOPDS_Point.lxx b/opencascade/BOPDS_Point.lxx index a9d67e8e4..b75158e8e 100644 --- a/opencascade/BOPDS_Point.lxx +++ b/opencascade/BOPDS_Point.lxx @@ -12,10 +12,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_Point::BOPDS_Point() { myPnt.SetCoord(99., 99., 99.); @@ -24,79 +22,61 @@ inline BOPDS_Point::BOPDS_Point() myIndex = -1; } -//======================================================================= -// function : ~ -// purpose : -//======================================================================= -inline BOPDS_Point::~BOPDS_Point() {} - -//======================================================================= -// function : SetIndex -// purpose : -//======================================================================= -inline void BOPDS_Point::SetIndex(const Standard_Integer theIndex) +//================================================================================================= + +inline BOPDS_Point::~BOPDS_Point() = default; + +//================================================================================================= + +inline void BOPDS_Point::SetIndex(const int theIndex) { myIndex = theIndex; } -//======================================================================= -// function : Index -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_Point::Index() const +//================================================================================================= + +inline int BOPDS_Point::Index() const { return myIndex; } -//======================================================================= -// function : SetPnt -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_Point::SetPnt(const gp_Pnt& thePnt) { myPnt = thePnt; } -//======================================================================= -// function : Pnt -// purpose : -//======================================================================= +//================================================================================================= + inline const gp_Pnt& BOPDS_Point::Pnt() const { return myPnt; } -//======================================================================= -// function : SetPnt2D1 -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_Point::SetPnt2D1(const gp_Pnt2d& thePnt) { myPnt2D1 = thePnt; } -//======================================================================= -// function : Pnt2D1 -// purpose : -//======================================================================= +//================================================================================================= + inline const gp_Pnt2d& BOPDS_Point::Pnt2D1() const { return myPnt2D1; } -//======================================================================= -// function : SetPnt2D2 -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_Point::SetPnt2D2(const gp_Pnt2d& thePnt) { myPnt2D2 = thePnt; } -//======================================================================= -// function : Pnt2D2 -// purpose : -//======================================================================= +//================================================================================================= + inline const gp_Pnt2d& BOPDS_Point::Pnt2D2() const { return myPnt2D2; diff --git a/opencascade/BOPDS_ShapeInfo.hxx b/opencascade/BOPDS_ShapeInfo.hxx index b5886d14e..f738a9201 100644 --- a/opencascade/BOPDS_ShapeInfo.hxx +++ b/opencascade/BOPDS_ShapeInfo.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include //! The class BOPDS_ShapeInfo is to store @@ -40,7 +40,7 @@ public: //! Constructor //! @param theAllocator the allocator to manage the memory - BOPDS_ShapeInfo(const Handle(NCollection_BaseAllocator)& theAllocator); + BOPDS_ShapeInfo(const occ::handle& theAllocator); //! Modifier //! Sets the shape @@ -72,52 +72,52 @@ public: //! Selector //! Returns the list of indices of sub-shapes - const TColStd_ListOfInteger& SubShapes() const; + const NCollection_List& SubShapes() const; //! Selector/ Modifier //! Returns the list of indices of sub-shapes - TColStd_ListOfInteger& ChangeSubShapes(); + NCollection_List& ChangeSubShapes(); //! Query //! Returns true if the shape has sub-shape with //! index theI - Standard_Boolean HasSubShape(const Standard_Integer theI) const; + bool HasSubShape(const int theI) const; - Standard_Boolean HasReference() const; + bool HasReference() const; //! Modifier //! Sets the index of a reference information - void SetReference(const Standard_Integer theI); + void SetReference(const int theI); //! Selector //! Returns the index of a reference information - Standard_Integer Reference() const; + int Reference() const; //! Query //! Returns true if the shape has boundary representation - Standard_Boolean HasBRep() const; + bool HasBRep() const; //! Returns true if the shape can be participant of //! an interference //! //! Flag - Standard_Boolean IsInterfering() const; + bool IsInterfering() const; //! Query //! Returns true if there is flag. - Standard_Boolean HasFlag() const; + bool HasFlag() const; //! Query //! Returns true if there is flag. //! Returns the flag theFlag - Standard_Boolean HasFlag(Standard_Integer& theFlag) const; + bool HasFlag(int& theFlag) const; //! Modifier //! Sets the flag - void SetFlag(const Standard_Integer theI); + void SetFlag(const int theI); //! Returns the flag - Standard_Integer Flag() const; + int Flag() const; Standard_EXPORT void Dump() const; @@ -125,11 +125,9 @@ protected: TopoDS_Shape myShape; TopAbs_ShapeEnum myType; Bnd_Box myBox; - TColStd_ListOfInteger mySubShapes; - Standard_Integer myReference; - Standard_Integer myFlag; - -private: + NCollection_List mySubShapes; + int myReference; + int myFlag; }; #include diff --git a/opencascade/BOPDS_ShapeInfo.lxx b/opencascade/BOPDS_ShapeInfo.lxx index 45fbba584..d1f4dd878 100644 --- a/opencascade/BOPDS_ShapeInfo.lxx +++ b/opencascade/BOPDS_ShapeInfo.lxx @@ -14,10 +14,8 @@ #include -//======================================================================= -// function : -// purpose : -//======================================================================= +//================================================================================================= + inline BOPDS_ShapeInfo::BOPDS_ShapeInfo() : @@ -27,11 +25,9 @@ inline BOPDS_ShapeInfo::BOPDS_ShapeInfo() { } -//======================================================================= -// function : -// purpose : -//======================================================================= -inline BOPDS_ShapeInfo::BOPDS_ShapeInfo(const Handle(NCollection_BaseAllocator)& theAllocator) +//================================================================================================= + +inline BOPDS_ShapeInfo::BOPDS_ShapeInfo(const occ::handle& theAllocator) : myType(TopAbs_SHAPE), mySubShapes(theAllocator), myReference(-1), @@ -39,180 +35,140 @@ inline BOPDS_ShapeInfo::BOPDS_ShapeInfo(const Handle(NCollection_BaseAllocator)& { } -//======================================================================= -// function : ~ -// purpose : -//======================================================================= -inline BOPDS_ShapeInfo::~BOPDS_ShapeInfo() {} +//================================================================================================= + +inline BOPDS_ShapeInfo::~BOPDS_ShapeInfo() = default; + +//================================================================================================= -//======================================================================= -// function : SetShape -// purpose : -//======================================================================= inline void BOPDS_ShapeInfo::SetShape(const TopoDS_Shape& theS) { myShape = theS; } -//======================================================================= -// function : Shape -// purpose : -//======================================================================= +//================================================================================================= + inline const TopoDS_Shape& BOPDS_ShapeInfo::Shape() const { return myShape; } -//======================================================================= -// function : SetShapeType -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_ShapeInfo::SetShapeType(const TopAbs_ShapeEnum theType) { myType = theType; } -//======================================================================= -// function : ShapeType -// purpose : -//======================================================================= +//================================================================================================= + inline TopAbs_ShapeEnum BOPDS_ShapeInfo::ShapeType() const { return myType; } -//======================================================================= -// function : SetBox -// purpose : -//======================================================================= +//================================================================================================= + inline void BOPDS_ShapeInfo::SetBox(const Bnd_Box& theBox) { myBox = theBox; } -//======================================================================= -// function : Box -// purpose : -//======================================================================= +//================================================================================================= + inline const Bnd_Box& BOPDS_ShapeInfo::Box() const { return myBox; } -//======================================================================= -// function : ChangeBox -// purpose : -//======================================================================= +//================================================================================================= + inline Bnd_Box& BOPDS_ShapeInfo::ChangeBox() { return myBox; } -//======================================================================= -// function : SubShapes -// purpose : -//======================================================================= -inline const TColStd_ListOfInteger& BOPDS_ShapeInfo::SubShapes() const +//================================================================================================= + +inline const NCollection_List& BOPDS_ShapeInfo::SubShapes() const { return mySubShapes; } -//======================================================================= -// function : ChangeSubShapes -// purpose : -//======================================================================= -inline TColStd_ListOfInteger& BOPDS_ShapeInfo::ChangeSubShapes() +//================================================================================================= + +inline NCollection_List& BOPDS_ShapeInfo::ChangeSubShapes() { return mySubShapes; } -//======================================================================= -// function : HasSubShape -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::HasSubShape(const Standard_Integer theI) const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::HasSubShape(const int theI) const { return mySubShapes.Contains(theI); } -//======================================================================= -// function : HasReference -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::HasReference() const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::HasReference() const { return (myReference >= 0); } -//======================================================================= -// function : SetReference -// purpose : -//======================================================================= -inline void BOPDS_ShapeInfo::SetReference(const Standard_Integer theI) +//================================================================================================= + +inline void BOPDS_ShapeInfo::SetReference(const int theI) { myReference = theI; } -//======================================================================= -// function : Reference -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_ShapeInfo::Reference() const +//================================================================================================= + +inline int BOPDS_ShapeInfo::Reference() const { return myReference; } -//======================================================================= -// function : HasBRep -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::HasBRep() const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::HasBRep() const { return (BOPDS_Tools::HasBRep(myType)); } -//======================================================================= -// function : IsInterfering -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::IsInterfering() const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::IsInterfering() const { return (HasBRep() || myType == TopAbs_SOLID); } -//======================================================================= -// function : HasFlag -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::HasFlag() const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::HasFlag() const { return (myFlag >= 0); } -//======================================================================= -// function : HasFlag -// purpose : -//======================================================================= -inline Standard_Boolean BOPDS_ShapeInfo::HasFlag(Standard_Integer& theFlag) const +//================================================================================================= + +inline bool BOPDS_ShapeInfo::HasFlag(int& theFlag) const { theFlag = myFlag; return (myFlag >= 0); } -//======================================================================= -// function : SetFlag -// purpose : -//======================================================================= -inline void BOPDS_ShapeInfo::SetFlag(const Standard_Integer theFlag) +//================================================================================================= + +inline void BOPDS_ShapeInfo::SetFlag(const int theFlag) { myFlag = theFlag; } -//======================================================================= -// function : Flag -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_ShapeInfo::Flag() const +//================================================================================================= + +inline int BOPDS_ShapeInfo::Flag() const { return myFlag; } diff --git a/opencascade/BOPDS_SubIterator.hxx b/opencascade/BOPDS_SubIterator.hxx index e498da6c4..9451eba5c 100644 --- a/opencascade/BOPDS_SubIterator.hxx +++ b/opencascade/BOPDS_SubIterator.hxx @@ -20,10 +20,11 @@ #include #include -#include +#include +#include #include -#include #include +#include //! The class BOPDS_SubIterator is used to compute intersections between //! bounding boxes of two sub-sets of BRep sub-shapes of arguments @@ -41,7 +42,7 @@ public: //! Constructor //! theAllocator - the allocator to manage the memory - Standard_EXPORT BOPDS_SubIterator(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPDS_SubIterator(const occ::handle& theAllocator); //! Sets the data structure to process. //! It is used to access the shapes and their bounding boxes. @@ -51,28 +52,28 @@ public: const BOPDS_DS& DS() const { return *myDS; } //! Sets the first set of indices to process - void SetSubSet1(const TColStd_ListOfInteger& theLI) + void SetSubSet1(const NCollection_List& theLI) { - mySubSet1 = (TColStd_ListOfInteger*)&theLI; + mySubSet1 = (NCollection_List*)&theLI; } //! Returns the first set of indices to process - const TColStd_ListOfInteger& SubSet1() const { return *mySubSet1; } + const NCollection_List& SubSet1() const { return *mySubSet1; } //! Sets the second set of indices to process - void SetSubSet2(const TColStd_ListOfInteger& theLI) + void SetSubSet2(const NCollection_List& theLI) { - mySubSet2 = (TColStd_ListOfInteger*)&theLI; + mySubSet2 = (NCollection_List*)&theLI; } //! Returns the second set of indices to process - const TColStd_ListOfInteger& SubSet2() const { return *mySubSet2; } + const NCollection_List& SubSet2() const { return *mySubSet2; } //! Initializes the iterator Standard_EXPORT void Initialize(); //! Returns true if there are more pairs of intersected shapes - Standard_Boolean More() const { return myIterator.More(); } + bool More() const { return myIterator.More(); } //! Moves iterations ahead void Next() { myIterator.Next(); } @@ -80,27 +81,25 @@ public: //! Returns indices (DS) of intersected shapes //! theIndex1 - the index of the first shape //! theIndex2 - the index of the second shape - Standard_EXPORT void Value(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const; + Standard_EXPORT void Value(int& theIndex1, int& theIndex2) const; //! Perform the intersection algorithm and prepare //! the results to be used Standard_EXPORT virtual void Prepare(); //! Returns the number of interfering pairs - Standard_Integer ExpectedLength() const { return myList.Length(); } + int ExpectedLength() const { return myList.Length(); } protected: //! Performs intersection of bounding boxes Standard_EXPORT virtual void Intersect(); - Handle(NCollection_BaseAllocator) myAllocator; - BOPDS_PDS myDS; - BOPDS_VectorOfPair myList; - BOPDS_VectorOfPair::Iterator myIterator; - TColStd_ListOfInteger* mySubSet1; - TColStd_ListOfInteger* mySubSet2; - -private: + occ::handle myAllocator; + BOPDS_PDS myDS; + NCollection_DynamicArray myList; + NCollection_DynamicArray::Iterator myIterator; + NCollection_List* mySubSet1; + NCollection_List* mySubSet2; }; #endif // _BOPDS_SubIterator_HeaderFile diff --git a/opencascade/BOPDS_Tools.hxx b/opencascade/BOPDS_Tools.hxx index f05a89043..863cab677 100644 --- a/opencascade/BOPDS_Tools.hxx +++ b/opencascade/BOPDS_Tools.hxx @@ -32,22 +32,19 @@ public: //! Converts the conmbination of two types //! of shape , //! to the one integer value, that is returned - static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum theT1, const TopAbs_ShapeEnum theT2); + static int TypeToInteger(const TopAbs_ShapeEnum theT1, const TopAbs_ShapeEnum theT2); //! Converts the type of shape , //! to integer value, that is returned - static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum theT); + static int TypeToInteger(const TopAbs_ShapeEnum theT); - //! Returns true if the type correspond + //! Returns true if the type correspond //! to a shape having boundary representation - static Standard_Boolean HasBRep(const TopAbs_ShapeEnum theT); + static bool HasBRep(const TopAbs_ShapeEnum theT); //! Returns true if the type can be participant of //! an interference - static Standard_Boolean IsInterfering(const TopAbs_ShapeEnum theT); - -protected: -private: + static bool IsInterfering(const TopAbs_ShapeEnum theT); }; #include diff --git a/opencascade/BOPDS_Tools.lxx b/opencascade/BOPDS_Tools.lxx index 9af72a7f5..aeb4e6dac 100644 --- a/opencascade/BOPDS_Tools.lxx +++ b/opencascade/BOPDS_Tools.lxx @@ -12,32 +12,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function: HasBRep -// purpose: -//======================================================================= -inline Standard_Boolean BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) +//================================================================================================= + +inline bool BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) { return (aTi == TopAbs_VERTEX || aTi == TopAbs_EDGE || aTi == TopAbs_FACE); } -//======================================================================= -// function: IsInterfering -// purpose: -//======================================================================= -inline Standard_Boolean BOPDS_Tools::IsInterfering(const TopAbs_ShapeEnum aTi) +//================================================================================================= + +inline bool BOPDS_Tools::IsInterfering(const TopAbs_ShapeEnum aTi) { return (BOPDS_Tools::HasBRep(aTi) || aTi == TopAbs_SOLID); } -//======================================================================= -// function : TypeToInteger -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) +//================================================================================================= + +inline int BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, const TopAbs_ShapeEnum aType2) { - Standard_Integer iRet, iT1, iT2, iX; + int iRet, iT1, iT2, iX; // iRet = -1; iT1 = BOPDS_Tools::TypeToInteger(aType1); @@ -88,13 +81,11 @@ inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1 return iRet; } -//======================================================================= -// function : TypeToInteger -// purpose : -//======================================================================= -inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1) +//================================================================================================= + +inline int BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1) { - Standard_Integer iRet = 9; + int iRet = 9; // switch (aType1) { diff --git a/opencascade/BOPDS_VectorOfCurve.hxx b/opencascade/BOPDS_VectorOfCurve.hxx index 89260c61b..16daa88bf 100644 --- a/opencascade/BOPDS_VectorOfCurve.hxx +++ b/opencascade/BOPDS_VectorOfCurve.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfCurve_HeaderFile -#define BOPDS_VectorOfCurve_HeaderFile +//! @file BOPDS_VectorOfCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfCurve_hxx +#define _BOPDS_VectorOfCurve_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfCurve; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfCurve.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfCurve is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfCurve; -#endif +#endif // _BOPDS_VectorOfCurve_hxx diff --git a/opencascade/BOPDS_VectorOfFaceInfo.hxx b/opencascade/BOPDS_VectorOfFaceInfo.hxx index a4ea381c7..4e810c816 100644 --- a/opencascade/BOPDS_VectorOfFaceInfo.hxx +++ b/opencascade/BOPDS_VectorOfFaceInfo.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfFaceInfo_HeaderFile -#define BOPDS_VectorOfFaceInfo_HeaderFile +//! @file BOPDS_VectorOfFaceInfo.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfFaceInfo_hxx +#define _BOPDS_VectorOfFaceInfo_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfFaceInfo; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfFaceInfo.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfFaceInfo is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfFaceInfo; -#endif +#endif // _BOPDS_VectorOfFaceInfo_hxx diff --git a/opencascade/BOPDS_VectorOfIndexRange.hxx b/opencascade/BOPDS_VectorOfIndexRange.hxx index 63466323a..828ad1bf7 100644 --- a/opencascade/BOPDS_VectorOfIndexRange.hxx +++ b/opencascade/BOPDS_VectorOfIndexRange.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfIndexRange_HeaderFile -#define BOPDS_VectorOfIndexRange_HeaderFile +//! @file BOPDS_VectorOfIndexRange.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfIndexRange_hxx +#define _BOPDS_VectorOfIndexRange_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfIndexRange; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfIndexRange.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED("BOPDS_VectorOfIndexRange is deprecated, use " + "NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfIndexRange; -#endif +#endif // _BOPDS_VectorOfIndexRange_hxx diff --git a/opencascade/BOPDS_VectorOfInterfEE.hxx b/opencascade/BOPDS_VectorOfInterfEE.hxx index 3b1342c9e..b7d225c42 100644 --- a/opencascade/BOPDS_VectorOfInterfEE.hxx +++ b/opencascade/BOPDS_VectorOfInterfEE.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfEE_HeaderFile -#define BOPDS_VectorOfInterfEE_HeaderFile +//! @file BOPDS_VectorOfInterfEE.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfEE_hxx +#define _BOPDS_VectorOfInterfEE_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfEE; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfEE.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfEE is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfEE; -#endif +#endif // _BOPDS_VectorOfInterfEE_hxx diff --git a/opencascade/BOPDS_VectorOfInterfEF.hxx b/opencascade/BOPDS_VectorOfInterfEF.hxx index e01711c3a..436925907 100644 --- a/opencascade/BOPDS_VectorOfInterfEF.hxx +++ b/opencascade/BOPDS_VectorOfInterfEF.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfEF_HeaderFile -#define BOPDS_VectorOfInterfEF_HeaderFile +//! @file BOPDS_VectorOfInterfEF.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfEF_hxx +#define _BOPDS_VectorOfInterfEF_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfEF; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfEF.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfEF is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfEF; -#endif +#endif // _BOPDS_VectorOfInterfEF_hxx diff --git a/opencascade/BOPDS_VectorOfInterfEZ.hxx b/opencascade/BOPDS_VectorOfInterfEZ.hxx index 3c672dbc7..3ffa8a60f 100644 --- a/opencascade/BOPDS_VectorOfInterfEZ.hxx +++ b/opencascade/BOPDS_VectorOfInterfEZ.hxx @@ -1,6 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfEZ_HeaderFile -#define BOPDS_VectorOfInterfEZ_HeaderFile +//! @file BOPDS_VectorOfInterfEZ.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. + +#ifndef _BOPDS_VectorOfInterfEZ_hxx +#define _BOPDS_VectorOfInterfEZ_hxx -#include +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfEZ; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfEZ.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfEZ is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfEZ; -#endif +#endif // _BOPDS_VectorOfInterfEZ_hxx diff --git a/opencascade/BOPDS_VectorOfInterfFF.hxx b/opencascade/BOPDS_VectorOfInterfFF.hxx index 5ea393f19..74b8e35ea 100644 --- a/opencascade/BOPDS_VectorOfInterfFF.hxx +++ b/opencascade/BOPDS_VectorOfInterfFF.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfFF_HeaderFile -#define BOPDS_VectorOfInterfFF_HeaderFile +//! @file BOPDS_VectorOfInterfFF.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfFF_hxx +#define _BOPDS_VectorOfInterfFF_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfFF; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfFF.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfFF is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfFF; -#endif +#endif // _BOPDS_VectorOfInterfFF_hxx diff --git a/opencascade/BOPDS_VectorOfInterfFZ.hxx b/opencascade/BOPDS_VectorOfInterfFZ.hxx index 8c2759886..3d44b2d1b 100644 --- a/opencascade/BOPDS_VectorOfInterfFZ.hxx +++ b/opencascade/BOPDS_VectorOfInterfFZ.hxx @@ -1,6 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfFZ_HeaderFile -#define BOPDS_VectorOfInterfFZ_HeaderFile +//! @file BOPDS_VectorOfInterfFZ.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. + +#ifndef _BOPDS_VectorOfInterfFZ_hxx +#define _BOPDS_VectorOfInterfFZ_hxx -#include +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfFZ; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfFZ.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfFZ is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfFZ; -#endif +#endif // _BOPDS_VectorOfInterfFZ_hxx diff --git a/opencascade/BOPDS_VectorOfInterfVE.hxx b/opencascade/BOPDS_VectorOfInterfVE.hxx index e676ba94e..ce3d8f6d7 100644 --- a/opencascade/BOPDS_VectorOfInterfVE.hxx +++ b/opencascade/BOPDS_VectorOfInterfVE.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfVE_HeaderFile -#define BOPDS_VectorOfInterfVE_HeaderFile +//! @file BOPDS_VectorOfInterfVE.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfVE_hxx +#define _BOPDS_VectorOfInterfVE_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfVE; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfVE.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfVE is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfVE; -#endif +#endif // _BOPDS_VectorOfInterfVE_hxx diff --git a/opencascade/BOPDS_VectorOfInterfVF.hxx b/opencascade/BOPDS_VectorOfInterfVF.hxx index 56e20c941..236030b86 100644 --- a/opencascade/BOPDS_VectorOfInterfVF.hxx +++ b/opencascade/BOPDS_VectorOfInterfVF.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfVF_HeaderFile -#define BOPDS_VectorOfInterfVF_HeaderFile +//! @file BOPDS_VectorOfInterfVF.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfVF_hxx +#define _BOPDS_VectorOfInterfVF_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfVF; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfVF.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfVF is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfVF; -#endif +#endif // _BOPDS_VectorOfInterfVF_hxx diff --git a/opencascade/BOPDS_VectorOfInterfVV.hxx b/opencascade/BOPDS_VectorOfInterfVV.hxx index 4ce09846f..6830da300 100644 --- a/opencascade/BOPDS_VectorOfInterfVV.hxx +++ b/opencascade/BOPDS_VectorOfInterfVV.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfVV_HeaderFile -#define BOPDS_VectorOfInterfVV_HeaderFile +//! @file BOPDS_VectorOfInterfVV.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfInterfVV_hxx +#define _BOPDS_VectorOfInterfVV_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfVV; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfVV.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfVV is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfVV; -#endif +#endif // _BOPDS_VectorOfInterfVV_hxx diff --git a/opencascade/BOPDS_VectorOfInterfVZ.hxx b/opencascade/BOPDS_VectorOfInterfVZ.hxx index c554d9847..15002ddb3 100644 --- a/opencascade/BOPDS_VectorOfInterfVZ.hxx +++ b/opencascade/BOPDS_VectorOfInterfVZ.hxx @@ -1,6 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfVZ_HeaderFile -#define BOPDS_VectorOfInterfVZ_HeaderFile +//! @file BOPDS_VectorOfInterfVZ.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. + +#ifndef _BOPDS_VectorOfInterfVZ_hxx +#define _BOPDS_VectorOfInterfVZ_hxx -#include +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfVZ; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfVZ.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfVZ is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfVZ; -#endif +#endif // _BOPDS_VectorOfInterfVZ_hxx diff --git a/opencascade/BOPDS_VectorOfInterfZZ.hxx b/opencascade/BOPDS_VectorOfInterfZZ.hxx index 6497cff1f..cfba8feba 100644 --- a/opencascade/BOPDS_VectorOfInterfZZ.hxx +++ b/opencascade/BOPDS_VectorOfInterfZZ.hxx @@ -1,6 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfInterfZZ_HeaderFile -#define BOPDS_VectorOfInterfZZ_HeaderFile +//! @file BOPDS_VectorOfInterfZZ.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. + +#ifndef _BOPDS_VectorOfInterfZZ_hxx +#define _BOPDS_VectorOfInterfZZ_hxx -#include +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfInterfZZ; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfInterfZZ.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfInterfZZ is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfInterfZZ; -#endif +#endif // _BOPDS_VectorOfInterfZZ_hxx diff --git a/opencascade/BOPDS_VectorOfListOfPaveBlock.hxx b/opencascade/BOPDS_VectorOfListOfPaveBlock.hxx index 4a8313931..636966d15 100644 --- a/opencascade/BOPDS_VectorOfListOfPaveBlock.hxx +++ b/opencascade/BOPDS_VectorOfListOfPaveBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfListOfPaveBlock_HeaderFile -#define BOPDS_VectorOfListOfPaveBlock_HeaderFile +//! @file BOPDS_VectorOfListOfPaveBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfListOfPaveBlock_hxx +#define _BOPDS_VectorOfListOfPaveBlock_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfListOfPaveBlock; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfListOfPaveBlock.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED("BOPDS_VectorOfListOfPaveBlock is deprecated, use " + "NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfListOfPaveBlock; -#endif +#endif // _BOPDS_VectorOfListOfPaveBlock_hxx diff --git a/opencascade/BOPDS_VectorOfPair.hxx b/opencascade/BOPDS_VectorOfPair.hxx index 0b5b648be..dd5d7b1b9 100644 --- a/opencascade/BOPDS_VectorOfPair.hxx +++ b/opencascade/BOPDS_VectorOfPair.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 2017 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfPair_HeaderFile -#define BOPDS_VectorOfPair_HeaderFile +//! @file BOPDS_VectorOfPair.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfPair_hxx +#define _BOPDS_VectorOfPair_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfPair; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfPair.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfPair is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfPair; -#endif +#endif // _BOPDS_VectorOfPair_hxx diff --git a/opencascade/BOPDS_VectorOfPave.hxx b/opencascade/BOPDS_VectorOfPave.hxx index 7182dd425..daa3a8467 100644 --- a/opencascade/BOPDS_VectorOfPave.hxx +++ b/opencascade/BOPDS_VectorOfPave.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfPave_HeaderFile -#define BOPDS_VectorOfPave_HeaderFile +//! @file BOPDS_VectorOfPave.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _BOPDS_VectorOfPave_hxx +#define _BOPDS_VectorOfPave_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BOPDS_VectorOfPave.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Array1 directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfPave is deprecated, use NCollection_Array1 directly") typedef NCollection_Array1 BOPDS_VectorOfPave; -#endif +#endif // _BOPDS_VectorOfPave_hxx diff --git a/opencascade/BOPDS_VectorOfPoint.hxx b/opencascade/BOPDS_VectorOfPoint.hxx index 76948b00c..abf7f6574 100644 --- a/opencascade/BOPDS_VectorOfPoint.hxx +++ b/opencascade/BOPDS_VectorOfPoint.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfPoint_HeaderFile -#define BOPDS_VectorOfPoint_HeaderFile +//! @file BOPDS_VectorOfPoint.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfPoint_hxx +#define _BOPDS_VectorOfPoint_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfPoint; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfPoint.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfPoint is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfPoint; -#endif +#endif // _BOPDS_VectorOfPoint_hxx diff --git a/opencascade/BOPDS_VectorOfShapeInfo.hxx b/opencascade/BOPDS_VectorOfShapeInfo.hxx index 675460cf6..19bfeaece 100644 --- a/opencascade/BOPDS_VectorOfShapeInfo.hxx +++ b/opencascade/BOPDS_VectorOfShapeInfo.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfShapeInfo_HeaderFile -#define BOPDS_VectorOfShapeInfo_HeaderFile +//! @file BOPDS_VectorOfShapeInfo.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfShapeInfo_hxx +#define _BOPDS_VectorOfShapeInfo_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfShapeInfo; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfShapeInfo.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED( + "BOPDS_VectorOfShapeInfo is deprecated, use NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfShapeInfo; -#endif +#endif // _BOPDS_VectorOfShapeInfo_hxx diff --git a/opencascade/BOPDS_VectorOfVectorOfPair.hxx b/opencascade/BOPDS_VectorOfVectorOfPair.hxx index 38e68e24a..9f905fdfb 100644 --- a/opencascade/BOPDS_VectorOfVectorOfPair.hxx +++ b/opencascade/BOPDS_VectorOfVectorOfPair.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 2017 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPDS_VectorOfVectorOfPair_HeaderFile -#define BOPDS_VectorOfVectorOfPair_HeaderFile +//! @file BOPDS_VectorOfVectorOfPair.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DynamicArray directly instead. -#include +#ifndef _BOPDS_VectorOfVectorOfPair_hxx +#define _BOPDS_VectorOfVectorOfPair_hxx + +#include +#include #include -typedef NCollection_Vector BOPDS_VectorOfVectorOfPair; +Standard_HEADER_DEPRECATED("BOPDS_VectorOfVectorOfPair.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DynamicArray directly.") + + Standard_DEPRECATED("BOPDS_VectorOfVectorOfPair is deprecated, use " + "NCollection_DynamicArray directly") +typedef NCollection_DynamicArray BOPDS_VectorOfVectorOfPair; -#endif +#endif // _BOPDS_VectorOfVectorOfPair_hxx diff --git a/opencascade/BOPTools_AlgoTools.hxx b/opencascade/BOPTools_AlgoTools.hxx index a32bd31a4..be304acfb 100644 --- a/opencascade/BOPTools_AlgoTools.hxx +++ b/opencascade/BOPTools_AlgoTools.hxx @@ -25,16 +25,17 @@ #include #include #include -#include -#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include class TopoDS_Vertex; class gp_Pnt; @@ -66,72 +67,72 @@ public: //! @name Constants //! by intersection of two shapes is slightly bigger than the actual //! distances to these shapes. It helps to avoid numerical instability //! which may occur when comparing distances and tolerances. - static Standard_Real DTolerance() { return 1.e-12; } + static double DTolerance() { return 1.e-12; } public: //! @name Intersection of the vertices //! Intersects the vertex with the point with tolerance . //! Returns the error status: //! - 0 - no error, meaning that the vertex intersects the point; //! - 1 - the distance between vertex and point is grater than the sum of tolerances. - Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& theV, - const gp_Pnt& theP, - const Standard_Real theTolP); + Standard_EXPORT static int ComputeVV(const TopoDS_Vertex& theV, + const gp_Pnt& theP, + const double theTolP); //! Intersects the given vertices with given fuzzy value. //! Returns the error status: //! - 0 - no error, meaning that the vertices interferes with given tolerance; //! - 1 - the distance between vertices is grater than the sum of their tolerances. - Standard_EXPORT static Standard_Integer ComputeVV( - const TopoDS_Vertex& theV1, - const TopoDS_Vertex& theV2, - const Standard_Real theFuzz = Precision::Confusion()); + Standard_EXPORT static int ComputeVV(const TopoDS_Vertex& theV1, + const TopoDS_Vertex& theV2, + const double theFuzz = Precision::Confusion()); public: //! @name Vertices construction //! Makes the vertex in the middle of given vertices with //! the tolerance covering all tolerance spheres of vertices. - Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV, TopoDS_Vertex& theV); + Standard_EXPORT static void MakeVertex(const NCollection_List& theLV, + TopoDS_Vertex& theV); //! Make a vertex using 3D-point and 3D-tolerance value - Standard_EXPORT static void MakeNewVertex(const gp_Pnt& aP1, - const Standard_Real aTol, - TopoDS_Vertex& aNewVertex); + Standard_EXPORT static void MakeNewVertex(const gp_Pnt& aP1, + const double aTol, + TopoDS_Vertex& aNewVertex); - //! Make a vertex using couple of vertices + //! Make a vertex using couple of vertices Standard_EXPORT static void MakeNewVertex(const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV2, TopoDS_Vertex& aNewVertex); //! Make a vertex in place of intersection between two edges //! with parameters - Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, - const Standard_Real aP1, - const TopoDS_Edge& aE2, - const Standard_Real aP2, - TopoDS_Vertex& aNewVertex); + Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, + const double aP1, + const TopoDS_Edge& aE2, + const double aP2, + TopoDS_Vertex& aNewVertex); //! Make a vertex in place of intersection between the edge //! with parameter and the face - Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, - const Standard_Real aP1, - const TopoDS_Face& aF2, - TopoDS_Vertex& aNewVertex); + Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, + const double aP1, + const TopoDS_Face& aF2, + TopoDS_Vertex& aNewVertex); public: //! @name Updating the vertex - //! Update the tolerance value for vertex + //! Update the tolerance value for vertex //! taking into account the fact that lays on //! the curve Standard_EXPORT static void UpdateVertex(const IntTools_Curve& aIC, - const Standard_Real aT, + const double aT, const TopoDS_Vertex& aV); - //! Update the tolerance value for vertex + //! Update the tolerance value for vertex //! taking into account the fact that lays on //! the edge Standard_EXPORT static void UpdateVertex(const TopoDS_Edge& aE, - const Standard_Real aT, + const double aT, const TopoDS_Vertex& aV); - //! Update the tolerance value for vertex + //! Update the tolerance value for vertex //! taking into account the fact that should //! cover tolerance zone of Standard_EXPORT static void UpdateVertex(const TopoDS_Vertex& aVF, const TopoDS_Vertex& aVN); @@ -140,10 +141,10 @@ public: //! @name Edge construction //! Makes the edge based on the given curve with given bounding vertices. Standard_EXPORT static void MakeEdge(const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, - const Standard_Real theT1, + const double theT1, const TopoDS_Vertex& theV2, - const Standard_Real theT2, - const Standard_Real theTolR3D, + const double theT2, + const double theTolR3D, TopoDS_Edge& theE); //! Makes a copy of with vertices. @@ -153,18 +154,18 @@ public: //! @name Edge construction //! at parameters Standard_EXPORT static void MakeSplitEdge(const TopoDS_Edge& aE1, const TopoDS_Vertex& aV1, - const Standard_Real aP1, + const double aP1, const TopoDS_Vertex& aV2, - const Standard_Real aP2, + const double aP2, TopoDS_Edge& aNewEdge); - //! Make the edge from 3D-Curve and two vertices + //! Make the edge from 3D-Curve and two vertices //! at parameters Standard_EXPORT static void MakeSectEdge(const IntTools_Curve& aIC, const TopoDS_Vertex& aV1, - const Standard_Real aP1, + const double aP1, const TopoDS_Vertex& aV2, - const Standard_Real aP2, + const double aP2, TopoDS_Edge& aNewEdge); public: //! @name Point/Edge/Face classification relatively solid @@ -173,30 +174,30 @@ public: //! @name Point/Edge/Face classification relatively solid //! theTol - value of precision of computation //! theContext- cached geometrical tools //! Returns 3-D state. - Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint, - const TopoDS_Solid& theSolid, - const Standard_Real theTol, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint, + const TopoDS_Solid& theSolid, + const double theTol, + const occ::handle& theContext); //! Computes the 3-D state of the vertex theVertex //! toward solid theSolid. //! theTol - value of precision of computation //! theContext- cached geometrical tools //! Returns 3-D state. - Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex, - const TopoDS_Solid& theSolid, - const Standard_Real theTol, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex, + const TopoDS_Solid& theSolid, + const double theTol, + const occ::handle& theContext); //! Computes the 3-D state of the edge theEdge //! toward solid theSolid. //! theTol - value of precision of computation //! theContext- cached geometrical tools //! Returns 3-D state. - Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge, - const TopoDS_Solid& theSolid, - const Standard_Real theTol, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge, + const TopoDS_Solid& theSolid, + const double theTol, + const occ::handle& theContext); //! Computes the 3-D state of the face theFace //! toward solid theSolid. @@ -204,11 +205,12 @@ public: //! @name Point/Edge/Face classification relatively solid //! theBounds - set of edges of to avoid //! theContext- cached geometrical tools //! Returns 3-D state. - Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace, - const TopoDS_Solid& theSolid, - const Standard_Real theTol, - const TopTools_IndexedMapOfShape& theBounds, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static TopAbs_State ComputeState( + const TopoDS_Face& theFace, + const TopoDS_Solid& theSolid, + const double theTol, + const NCollection_IndexedMap& theBounds, + const occ::handle& theContext); //! Computes the 3-D state of the shape theShape //! toward solid theSolid. @@ -216,78 +218,77 @@ public: //! @name Point/Edge/Face classification relatively solid //! theContext- cached geometrical tools //! Returns 3-D state. Standard_EXPORT static TopAbs_State ComputeStateByOnePoint( - const TopoDS_Shape& theShape, - const TopoDS_Solid& theSolid, - const Standard_Real theTol, - const Handle(IntTools_Context)& theContext); + const TopoDS_Shape& theShape, + const TopoDS_Solid& theSolid, + const double theTol, + const occ::handle& theContext); public: //! @name Face classification relatively solid //! For the face theFace and its edge theEdge //! finds the face suitable to produce shell. //! theLCEF - set of faces to search. All faces //! from theLCEF must share edge theEdge - Standard_EXPORT static Standard_Boolean GetFaceOff(const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace, - BOPTools_ListOfCoupleOfShape& theLCEF, - TopoDS_Face& theFaceOff, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static bool GetFaceOff(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + NCollection_List& theLCEF, + TopoDS_Face& theFaceOff, + const occ::handle& theContext); //! Returns True if the face theFace is inside of the //! couple of faces theFace1, theFace2. - //! The faces theFace, theFace1, theFace2 must + //! The faces theFace, theFace1, theFace2 must //! share the edge theEdge //! Return values: //! * 0 state is not IN //! * 1 state is IN //! * 2 state can not be found by the method of angles - Standard_EXPORT static Standard_Integer IsInternalFace( - const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace1, - const TopoDS_Face& theFace2, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace1, + const TopoDS_Face& theFace2, + const occ::handle& theContext); //! Returns True if the face theFace is inside of the - //! appropriate couple of faces (from the set theLF) . - //! The faces of the set theLF and theFace must - //! share the edge theEdge + //! appropriate couple of faces (from the set theLF). + //! The faces of the set theLF and theFace must share + //! the edge theEdge //! * 0 state is not IN //! * 1 state is IN //! * 2 state can not be found by the method of angles - Standard_EXPORT static Standard_Integer IsInternalFace( - const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - TopTools_ListOfShape& theLF, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Edge& theEdge, + NCollection_List& theLF, + const occ::handle& theContext); //! Returns True if the face theFace is inside the //! solid theSolid. //! theMEF - Map Edge/Faces for theSolid //! theTol - value of precision of computation //! theContext- cached geometrical tools - Standard_EXPORT static Standard_Boolean IsInternalFace( - const TopoDS_Face& theFace, - const TopoDS_Solid& theSolid, - TopTools_IndexedDataMapOfShapeListOfShape& theMEF, - const Standard_Real theTol, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static bool IsInternalFace( + const TopoDS_Face& theFace, + const TopoDS_Solid& theSolid, + NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theMEF, + const double theTol, + const occ::handle& theContext); public: //! @name PCurve construction - //! Makes 2d curve of the edge on the faces and .
+ //! Makes 2d curve of the edge on the faces and . //! - storage for caching the geometrical tools Standard_EXPORT static void MakePCurve( - const TopoDS_Edge& theE, - const TopoDS_Face& theF1, - const TopoDS_Face& theF2, - const IntTools_Curve& theCurve, - const Standard_Boolean thePC1, - const Standard_Boolean thePC2, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + const TopoDS_Edge& theE, + const TopoDS_Face& theF1, + const TopoDS_Face& theF2, + const IntTools_Curve& theCurve, + const bool thePC1, + const bool thePC2, + const occ::handle& theContext = occ::handle()); public: //! @name Wire classification relatively face //! Checks if the wire is a hole for the face. - Standard_EXPORT static Standard_Boolean IsHole(const TopoDS_Shape& theW, - const TopoDS_Shape& theF); + Standard_EXPORT static bool IsHole(const TopoDS_Shape& theW, const TopoDS_Shape& theF); public: //! @name Choosing correct orientation for the split shape //! Checks if the direction of the split shape is opposite to @@ -311,20 +312,19 @@ public: //! @name Choosing correct orientation for the split shape //! @param[in] theShape Original shape //! @param[in] theContext cached geometrical tools //! @param[out] theError Error Status of the operation - Standard_EXPORT static Standard_Boolean IsSplitToReverse( - const TopoDS_Shape& theSplit, - const TopoDS_Shape& theShape, - const Handle(IntTools_Context)& theContext, - Standard_Integer* theError = NULL); + Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Shape& theSplit, + const TopoDS_Shape& theShape, + const occ::handle& theContext, + int* theError = nullptr); //! Add-on for the *IsSplitToReverse()* to check for its errors //! and in case of any add the *BOPAlgo_AlertUnableToOrientTheShape* //! warning to the report. - Standard_EXPORT static Standard_Boolean IsSplitToReverseWithWarn( - const TopoDS_Shape& theSplit, - const TopoDS_Shape& theShape, - const Handle(IntTools_Context)& theContext, - const Handle(Message_Report)& theReport = NULL); + Standard_EXPORT static bool IsSplitToReverseWithWarn( + const TopoDS_Shape& theSplit, + const TopoDS_Shape& theShape, + const occ::handle& theContext, + const occ::handle& theReport = nullptr); //! Checks if the normal direction of the split face is opposite to //! the normal direction of the original face. @@ -346,11 +346,10 @@ public: //! @name Choosing correct orientation for the split shape //! @param[in] theShape Original face //! @param[in] theContext cached geometrical tools //! @param[out] theError Error Status of the operation - Standard_EXPORT static Standard_Boolean IsSplitToReverse( - const TopoDS_Face& theSplit, - const TopoDS_Face& theShape, - const Handle(IntTools_Context)& theContext, - Standard_Integer* theError = NULL); + Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Face& theSplit, + const TopoDS_Face& theShape, + const occ::handle& theContext, + int* theError = nullptr); //! Checks if the tangent vector of the split edge is opposite to //! the tangent vector of the original edge. @@ -372,11 +371,10 @@ public: //! @name Choosing correct orientation for the split shape //! @param[in] theShape Original edge //! @param[in] theContext cached geometrical tools //! @param[out] theError Error Status of the operation - Standard_EXPORT static Standard_Boolean IsSplitToReverse( - const TopoDS_Edge& theSplit, - const TopoDS_Edge& theShape, - const Handle(IntTools_Context)& theContext, - Standard_Integer* theError = NULL); + Standard_EXPORT static bool IsSplitToReverse(const TopoDS_Edge& theSplit, + const TopoDS_Edge& theShape, + const occ::handle& theContext, + int* theError = nullptr); //! Checks if the normals direction of the given faces computed near //! the shared edge coincide. @@ -384,9 +382,9 @@ public: //! @name Choosing correct orientation for the split shape //! * 0 - in case of error (shared edge not found or directions are not collinear) //! * 1 - normal directions coincide; //! * -1 - normal directions are opposite. - Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1, - const TopoDS_Face& theF2, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int Sense(const TopoDS_Face& theF1, + const TopoDS_Face& theF2, + const occ::handle& theContext); public: //! @name Making connexity blocks //! For the list of faces theLS build block @@ -394,19 +392,19 @@ public: //! @name Making connexity blocks //! theMapAvoid - set of edges to avoid for //! the treatment Standard_EXPORT static void MakeConnexityBlock( - TopTools_ListOfShape& theLS, - TopTools_IndexedMapOfShape& theMapAvoid, - TopTools_ListOfShape& theLSCB, - const Handle(NCollection_BaseAllocator)& theAllocator); + NCollection_List& theLS, + NCollection_IndexedMap& theMapAvoid, + NCollection_List& theLSCB, + const occ::handle& theAllocator); //! For the compound builds the blocks (compounds) of //! elements of type connected through the shapes //! of the type . //! The blocks are stored into the list . - Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS, - const TopAbs_ShapeEnum theConnectionType, - const TopAbs_ShapeEnum theElementType, - TopTools_ListOfShape& theLCB); + Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS, + const TopAbs_ShapeEnum theConnectionType, + const TopAbs_ShapeEnum theElementType, + NCollection_List& theLCB); //! For the compound builds the blocks (compounds) of //! elements of type connected through the shapes @@ -414,19 +412,22 @@ public: //! @name Making connexity blocks //! The blocks are stored into the list of lists . //! Returns also the connection map , filled during operation. Standard_EXPORT static void MakeConnexityBlocks( - const TopoDS_Shape& theS, - const TopAbs_ShapeEnum theConnectionType, - const TopAbs_ShapeEnum theElementType, - TopTools_ListOfListOfShape& theLCB, - TopTools_IndexedDataMapOfShapeListOfShape& theConnectionMap); + const TopoDS_Shape& theS, + const TopAbs_ShapeEnum theConnectionType, + const TopAbs_ShapeEnum theElementType, + NCollection_List>& theLCB, + NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theConnectionMap); //! Makes connexity blocks of elements of the given type with the given type of the //! connecting elements. The blocks are checked on regularity (multi-connectivity) //! and stored to the list of blocks . - Standard_EXPORT static void MakeConnexityBlocks(const TopTools_ListOfShape& theLS, - const TopAbs_ShapeEnum theConnectionType, - const TopAbs_ShapeEnum theElementType, - BOPTools_ListOfConnexityBlock& theLCB); + Standard_EXPORT static void MakeConnexityBlocks( + const NCollection_List& theLS, + const TopAbs_ShapeEnum theConnectionType, + const TopAbs_ShapeEnum theElementType, + NCollection_List& theLCB); public: //! @name Orienting elements in container //! Correctly orients edges on the wire @@ -438,61 +439,60 @@ public: //! @name Orienting elements in container public: //! @name Methods for shape validation (correction) //! Provides valid values of tolerances for the shape //! is max value of the tolerance that can be - //! accepted for correction. If real value of the tolerance - //! will be greater than , the correction does not + //! accepted for correction. If real value of the tolerance + //! will be greater than , the correction does not //! perform. Standard_EXPORT static void CorrectTolerances( - const TopoDS_Shape& theS, - const TopTools_IndexedMapOfShape& theMapToAvoid, - const Standard_Real theTolMax = 0.0001, - const Standard_Boolean theRunParallel = Standard_False); + const TopoDS_Shape& theS, + const NCollection_IndexedMap& theMapToAvoid, + const double theTolMax = 0.0001, + const bool theRunParallel = false); //! Provides valid values of tolerances for the shape - //! in terms of BRepCheck_InvalidCurveOnSurface. + //! in terms of BRepCheck_InvalidCurveOnSurface. Standard_EXPORT static void CorrectCurveOnSurface( - const TopoDS_Shape& theS, - const TopTools_IndexedMapOfShape& theMapToAvoid, - const Standard_Real theTolMax = 0.0001, - const Standard_Boolean theRunParallel = Standard_False); + const TopoDS_Shape& theS, + const NCollection_IndexedMap& theMapToAvoid, + const double theTolMax = 0.0001, + const bool theRunParallel = false); //! Provides valid values of tolerances for the shape - //! in terms of BRepCheck_InvalidPointOnCurve. + //! in terms of BRepCheck_InvalidPointOnCurve. Standard_EXPORT static void CorrectPointOnCurve( - const TopoDS_Shape& theS, - const TopTools_IndexedMapOfShape& theMapToAvoid, - const Standard_Real theTolMax = 0.0001, - const Standard_Boolean theRunParallel = Standard_False); + const TopoDS_Shape& theS, + const NCollection_IndexedMap& theMapToAvoid, + const double theTolMax = 0.0001, + const bool theRunParallel = false); //! Corrects tolerance values of the sub-shapes of the shape if needed. Standard_EXPORT static void CorrectShapeTolerances( - const TopoDS_Shape& theS, - const TopTools_IndexedMapOfShape& theMapToAvoid, - const Standard_Boolean theRunParallel = Standard_False); + const TopoDS_Shape& theS, + const NCollection_IndexedMap& theMapToAvoid, + const bool theRunParallel = false); public: //! Checking if the faces are coinciding //! Checks if the given faces are same-domain, i.e. coincide. - Standard_EXPORT static Standard_Boolean AreFacesSameDomain( - const TopoDS_Face& theF1, - const TopoDS_Face& theF2, - const Handle(IntTools_Context)& theContext, - const Standard_Real theFuzz = Precision::Confusion()); + Standard_EXPORT static bool AreFacesSameDomain(const TopoDS_Face& theF1, + const TopoDS_Face& theF2, + const occ::handle& theContext, + const double theFuzz = Precision::Confusion()); public: //! @name Looking for the edge in the face //! Returns True if the face theFace contains //! the edge theEdge but with opposite orientation. - //! If the method returns True theEdgeOff is the + //! If the method returns True theEdgeOff is the //! edge founded - Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace, - TopoDS_Edge& theEdgeOff); + Standard_EXPORT static bool GetEdgeOff(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + TopoDS_Edge& theEdgeOff); //! For the face theFace gets the edge theEdgeOnF //! that is the same as theEdge //! Returns True if such edge exists //! Returns False if there is no such edge - Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace, - TopoDS_Edge& theEdgeOnF); + Standard_EXPORT static bool GetEdgeOnFace(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + TopoDS_Edge& theEdgeOnF); public: //! @name Correction of the edges range //! Correct shrunk range taking into account 3D-curve @@ -513,56 +513,52 @@ public: //! @name Checking edge on micro status //! Checks if it is possible to compute shrunk range for the edge //! Flag defines whether to take into account //! the possibility to split the edge or not. - Standard_EXPORT static Standard_Boolean IsMicroEdge( - const TopoDS_Edge& theEdge, - const Handle(IntTools_Context)& theContext, - const Standard_Boolean theCheckSplittable = Standard_True); + Standard_EXPORT static bool IsMicroEdge(const TopoDS_Edge& theEdge, + const occ::handle& theContext, + const bool theCheckSplittable = true); public: //! @name Solid classification //! Returns true if the solid is inverted - Standard_EXPORT static Standard_Boolean IsInvertedSolid(const TopoDS_Solid& theSolid); + Standard_EXPORT static bool IsInvertedSolid(const TopoDS_Solid& theSolid); public: //! @name Edge/Face Deviation computation //! Computes the necessary value of the tolerance for the edge - Standard_EXPORT static Standard_Boolean ComputeTolerance(const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - Standard_Real& theMaxDist, - Standard_Real& theMaxPar); + Standard_EXPORT static bool ComputeTolerance(const TopoDS_Face& theFace, + const TopoDS_Edge& theEdge, + double& theMaxDist, + double& theMaxPar); public: //! @name Other methods //! Makes empty container of requested type Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType, TopoDS_Shape& theShape); //! Compute a 3D-point on the edge at parameter - Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aEdge, - const Standard_Real aPrm, - gp_Pnt& aP); + Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aEdge, const double aPrm, gp_Pnt& aP); //! Returns TRUE if PaveBlock lays on the face , i.e //! the is IN or ON in 2D of - Standard_EXPORT static Standard_Boolean IsBlockInOnFace(const IntTools_Range& aShR, - const TopoDS_Face& aF, - const TopoDS_Edge& aE, - const Handle(IntTools_Context)& aContext); + Standard_EXPORT static bool IsBlockInOnFace(const IntTools_Range& aShR, + const TopoDS_Face& aF, + const TopoDS_Edge& aE, + const occ::handle& aContext); //! Returns the min and max dimensions of the shape . - Standard_EXPORT static void Dimensions(const TopoDS_Shape& theS, - Standard_Integer& theDMin, - Standard_Integer& theDMax); + Standard_EXPORT static void Dimensions(const TopoDS_Shape& theS, int& theDMin, int& theDMax); //! Returns dimension of the shape . //! If the shape contains elements of different dimension, -1 is returned. - Standard_EXPORT static Standard_Integer Dimension(const TopoDS_Shape& theS); + Standard_EXPORT static int Dimension(const TopoDS_Shape& theS); //! Collects in the output list recursively all non-compound sub-shapes of the first level //! of the given shape theS. The optional map theMap is used to avoid the duplicates in the //! output list, so it will also contain all non-compound sub-shapes. - Standard_EXPORT static void TreatCompound(const TopoDS_Shape& theS, - TopTools_ListOfShape& theList, - TopTools_MapOfShape* theMap = NULL); + Standard_EXPORT static void TreatCompound( + const TopoDS_Shape& theS, + NCollection_List& theList, + NCollection_Map* theMap = nullptr); - //! Returns true if the shell is open - Standard_EXPORT static Standard_Boolean IsOpenShell(const TopoDS_Shell& theShell); + //! Returns true if the shell is open + Standard_EXPORT static bool IsOpenShell(const TopoDS_Shell& theShell); }; #endif // _BOPTools_AlgoTools_HeaderFile diff --git a/opencascade/BOPTools_AlgoTools2D.hxx b/opencascade/BOPTools_AlgoTools2D.hxx index 16cf9e520..9ecdd4f6f 100644 --- a/opencascade/BOPTools_AlgoTools2D.hxx +++ b/opencascade/BOPTools_AlgoTools2D.hxx @@ -38,160 +38,155 @@ class BOPTools_AlgoTools2D public: DEFINE_STANDARD_ALLOC - //! Compute P-Curve for the edge on the face .
- //! Raises exception Standard_ConstructionError if projection algorithm fails.
+ //! Compute P-Curve for the edge on the face . + //! Raises exception Standard_ConstructionError if projection algorithm fails. //! - storage for caching the geometrical tools Standard_EXPORT static void BuildPCurveForEdgeOnFace( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const occ::handle& theContext = occ::handle()); - //! Compute tangent for the edge [in 3D] at parameter - Standard_EXPORT static Standard_Boolean EdgeTangent(const TopoDS_Edge& anE, - const Standard_Real aT, - gp_Vec& Tau); + //! Compute tangent for the edge [in 3D] at parameter + Standard_EXPORT static bool EdgeTangent(const TopoDS_Edge& anE, const double aT, gp_Vec& Tau); //! Compute surface parameters of the face - //! for the point from the edge at parameter .
+ //! for the point from the edge at parameter . //! If has't pcurve on surface, algorithm tries to get it by - //! projection and can - //! raise exception Standard_ConstructionError if projection algorithm fails.
+ //! projection and can raise exception + //! Standard_ConstructionError if projection algorithm fails. //! - storage for caching the geometrical tools Standard_EXPORT static void PointOnSurface( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - Standard_Real& U, - Standard_Real& V, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Get P-Curve for the edge on surface .
- //! If the P-Curve does not exist, build it using Make2D().
+ const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + double& U, + double& V, + const occ::handle& theContext = occ::handle()); + + //! Get P-Curve for the edge on surface . + //! If the P-Curve does not exist, build it using Make2D(). //! [aToler] - reached tolerance - //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
+ //! Raises exception Standard_ConstructionError if algorithm Make2D() fails. //! - storage for caching the geometrical tools Standard_EXPORT static void CurveOnSurface( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC, - Standard_Real& aToler, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Get P-Curve for the edge on surface .
- //! If the P-Curve does not exist, build it using Make2D().
- //! [aFirst, aLast] - range of the P-Curve
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
+ const TopoDS_Edge& aE, + const TopoDS_Face& aF, + occ::handle& aC, + double& aToler, + const occ::handle& theContext = occ::handle()); + + //! Get P-Curve for the edge on surface . + //! If the P-Curve does not exist, build it using Make2D(). + //! [aFirst, aLast] - range of the P-Curve + //! [aToler] - reached tolerance + //! Raises exception Standard_ConstructionError if algorithm Make2D() fails. //! - storage for caching the geometrical tools Standard_EXPORT static void CurveOnSurface( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Returns TRUE if the edge has P-Curve - //! on surface . + const TopoDS_Edge& aE, + const TopoDS_Face& aF, + occ::handle& aC, + double& aFirst, + double& aLast, + double& aToler, + const occ::handle& theContext = occ::handle()); + + //! Returns TRUE if the edge has P-Curve + //! on surface . //! [aFirst, aLast] - range of the P-Curve //! [aToler] - reached tolerance //! If the P-Curve does not exist, aC.IsNull()=TRUE. - Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler); - - //! Returns TRUE if the edge has P-Curve - //! on surface . + Standard_EXPORT static bool HasCurveOnSurface(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + occ::handle& aC, + double& aFirst, + double& aLast, + double& aToler); + + //! Returns TRUE if the edge has P-Curve + //! on surface . //! If the P-Curve does not exist, aC.IsNull()=TRUE. - Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE, - const TopoDS_Face& aF); + Standard_EXPORT static bool HasCurveOnSurface(const TopoDS_Edge& aE, const TopoDS_Face& aF); - //! Adjust P-Curve (3D-curve ) on surface of the face .
+ //! Adjust P-Curve (3D-curve ) on surface of the face . //! - storage for caching the geometrical tools Standard_EXPORT static void AdjustPCurveOnFace( - const TopoDS_Face& theF, - const Handle(Geom_Curve)& theC3D, - const Handle(Geom2d_Curve)& theC2D, - Handle(Geom2d_Curve)& theC2DA, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Adjust P-Curve (3D-curve ) on surface .
- //! [aT1, aT2] - range to adjust
+ const TopoDS_Face& theF, + const occ::handle& theC3D, + const occ::handle& theC2D, + occ::handle& theC2DA, + const occ::handle& theContext = occ::handle()); + + //! Adjust P-Curve (3D-curve ) on surface . + //! [aT1, aT2] - range to adjust //! - storage for caching the geometrical tools Standard_EXPORT static void AdjustPCurveOnFace( - const TopoDS_Face& theF, - const Standard_Real theFirst, - const Standard_Real theLast, - const Handle(Geom2d_Curve)& theC2D, - Handle(Geom2d_Curve)& theC2DA, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Adjust P-Curve (3D-curve ) on surface . - //! [aT1, aT2] - range to adjust - Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface& aF, - const Standard_Real aT1, - const Standard_Real aT2, - const Handle(Geom2d_Curve)& aC2D, - Handle(Geom2d_Curve)& aC2DA); - - //! Compute intermediate value in between [aFirst, aLast] . - Standard_EXPORT static Standard_Real IntermediatePoint(const Standard_Real aFirst, - const Standard_Real aLast); + const TopoDS_Face& theF, + const double theFirst, + const double theLast, + const occ::handle& theC2D, + occ::handle& theC2DA, + const occ::handle& theContext = occ::handle()); + + //! Adjust P-Curve (3D-curve ) on surface . + //! [aT1, aT2] - range to adjust + Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface& aF, + const double aT1, + const double aT2, + const occ::handle& aC2D, + occ::handle& aC2DA); + + //! Compute intermediate value in between [aFirst, aLast]. + Standard_EXPORT static double IntermediatePoint(const double aFirst, const double aLast); //! Compute intermediate value of parameter for the edge . - Standard_EXPORT static Standard_Real IntermediatePoint(const TopoDS_Edge& anE); + Standard_EXPORT static double IntermediatePoint(const TopoDS_Edge& anE); - //! Make P-Curve for the edge on surface .
- //! [aFirst, aLast] - range of the P-Curve
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if algorithm fails.
+ //! Make P-Curve for the edge on surface . + //! [aFirst, aLast] - range of the P-Curve + //! [aToler] - reached tolerance + //! Raises exception Standard_ConstructionError if algorithm fails. //! - storage for caching the geometrical tools Standard_EXPORT static void Make2D( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Make P-Curve for the 3D-curve on surface .
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if projection algorithm fails.
+ const TopoDS_Edge& aE, + const TopoDS_Face& aF, + occ::handle& aC, + double& aFirst, + double& aLast, + double& aToler, + const occ::handle& theContext = occ::handle()); + + //! Make P-Curve for the 3D-curve on surface . + //! [aToler] - reached tolerance + //! Raises exception Standard_ConstructionError if projection algorithm fails. //! - storage for caching the geometrical tools Standard_EXPORT static void MakePCurveOnFace( - const TopoDS_Face& aF, - const Handle(Geom_Curve)& C3D, - Handle(Geom2d_Curve)& aC, - Standard_Real& aToler, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); - - //! Make P-Curve for the 3D-curve on surface .
- //! [aT1, aT2] - range to build
- //! [aToler] - reached tolerance
- //! Raises exception Standard_ConstructionError if projection algorithm fails.
+ const TopoDS_Face& aF, + const occ::handle& C3D, + occ::handle& aC, + double& aToler, + const occ::handle& theContext = occ::handle()); + + //! Make P-Curve for the 3D-curve on surface . + //! [aT1, aT2] - range to build + //! [aToler] - reached tolerance + //! Raises exception Standard_ConstructionError if projection algorithm fails. //! - storage for caching the geometrical tools Standard_EXPORT static void MakePCurveOnFace( - const TopoDS_Face& aF, - const Handle(Geom_Curve)& C3D, - const Standard_Real aT1, - const Standard_Real aT2, - Handle(Geom2d_Curve)& aC, - Standard_Real& aToler, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + const TopoDS_Face& aF, + const occ::handle& C3D, + const double aT1, + const double aT2, + occ::handle& aC, + double& aToler, + const occ::handle& theContext = occ::handle()); //! Attach P-Curve from the edge on surface //! to the edge //! Returns 0 in case of success - Standard_EXPORT static Standard_Integer AttachExistingPCurve( - const TopoDS_Edge& aEold, - const TopoDS_Edge& aEnew, - const TopoDS_Face& aF, - const Handle(IntTools_Context)& aCtx); + Standard_EXPORT static int AttachExistingPCurve(const TopoDS_Edge& aEold, + const TopoDS_Edge& aEnew, + const TopoDS_Face& aF, + const occ::handle& aCtx); //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface. //! Sets corresponding values for isTheUIso and isTheVIso variables. @@ -206,8 +201,8 @@ public: //! false classification some p-curves as isoline (e.g. circle on a plane). Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE, const TopoDS_Face& theF, - Standard_Boolean& isTheUIso, - Standard_Boolean& isTheVIso); + bool& isTheUIso, + bool& isTheVIso); }; #endif // _BOPTools_AlgoTools2D_HeaderFile diff --git a/opencascade/BOPTools_AlgoTools3D.hxx b/opencascade/BOPTools_AlgoTools3D.hxx index c09b985b8..bc664f80d 100644 --- a/opencascade/BOPTools_AlgoTools3D.hxx +++ b/opencascade/BOPTools_AlgoTools3D.hxx @@ -40,183 +40,183 @@ public: //! Makes the edge seam edge for the face basing on the surface properties //! (U and V periods) - Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace(const TopoDS_Edge& theESplit, - const TopoDS_Face& theFace); + Standard_EXPORT static bool DoSplitSEAMOnFace(const TopoDS_Edge& theESplit, + const TopoDS_Face& theFace); //! Makes the split edge seam edge for the face basing on the positions //! of 2d curves of the original edge . - Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace(const TopoDS_Edge& theEOrigin, - const TopoDS_Edge& theESplit, - const TopoDS_Face& theFace); + Standard_EXPORT static bool DoSplitSEAMOnFace(const TopoDS_Edge& theEOrigin, + const TopoDS_Edge& theESplit, + const TopoDS_Face& theFace); //! Computes normal to the face for the point on the edge - //! at parameter .
+ //! at parameter . //! - storage for caching the geometrical tools Standard_EXPORT static void GetNormalToFaceOnEdge( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - gp_Dir& aD, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + gp_Dir& aD, + const occ::handle& theContext = occ::handle()); //! Computes normal to the face for the point on the edge - //! at arbitrary intermediate parameter.
+ //! at arbitrary intermediate parameter. //! - storage for caching the geometrical tools Standard_EXPORT static void GetNormalToFaceOnEdge( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - gp_Dir& aD, - const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); + const TopoDS_Edge& aE, + const TopoDS_Face& aF, + gp_Dir& aD, + const occ::handle& theContext = occ::handle()); - //! Returns 1 if scalar product aNF1* aNF2>0.
- //! Returns 0 if directions aNF1 aNF2 coincide
+ //! Returns 1 if scalar product aNF1* aNF2>0. + //! Returns 0 if directions aNF1 aNF2 coincide //! Returns -1 if scalar product aNF1* aNF2<0. - Standard_EXPORT static Standard_Integer SenseFlag(const gp_Dir& aNF1, const gp_Dir& aNF2); + Standard_EXPORT static int SenseFlag(const gp_Dir& aNF1, const gp_Dir& aNF2); //! Compute normal to surface in point (U,V) //! Returns TRUE if directions aD1U, aD1V coincide - Standard_EXPORT static Standard_Boolean GetNormalToSurface(const Handle(Geom_Surface)& aS, - const Standard_Real U, - const Standard_Real V, - gp_Dir& aD); + Standard_EXPORT static bool GetNormalToSurface(const occ::handle& aS, + const double U, + const double V, + gp_Dir& aD); //! Computes normal to the face for the 3D-point that - //! belongs to the edge at parameter .
- //! Output:
- //! aPx - the 3D-point where the normal computed
- //! aD - the normal;
- //! Warning:
+ //! belongs to the edge at parameter . + //! Output: + //! aPx - the 3D-point where the normal computed + //! aD - the normal; + //! Warning: //! The normal is computed not exactly in the point on the //! edge, but in point that is near to the edge towards to - //! the face material (so, we'll have approx. normal);
+ //! the face material (so, we'll have approx. normal); //! The point is computed using PointNearEdge function, //! with the shifting value BOPTools_AlgoTools3D::MinStepIn2d(), //! from the edge, but if this value is too big, - //! the point will be computed using Hatcher (PointInFace function).
+ //! the point will be computed using Hatcher (PointInFace function). //! Returns TRUE in case of success. - Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge( - const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - gp_Pnt& aPx, - gp_Dir& aD, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static bool GetApproxNormalToFaceOnEdge( + const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + gp_Pnt& aPx, + gp_Dir& aD, + const occ::handle& theContext); //! Computes normal to the face for the 3D-point that - //! belongs to the edge at parameter .
- //! Output:
- //! aPx - the 3D-point where the normal computed
- //! aD - the normal;
- //! Warning:
+ //! belongs to the edge at parameter . + //! Output: + //! aPx - the 3D-point where the normal computed + //! aD - the normal; + //! Warning: //! The normal is computed not exactly in the point on the //! edge, but in point that is near to the edge towards to - //! the face material (so, we'll have approx. normal);
+ //! the face material (so, we'll have approx. normal); //! The point is computed using PointNearEdge function - //! with the shifting value from the edge;
- //! No checks on this value will be done.
+ //! with the shifting value from the edge; + //! No checks on this value will be done. //! Returns TRUE in case of success. - Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge(const TopoDS_Edge& theE, - const TopoDS_Face& theF, - const Standard_Real aT, - gp_Pnt& aP, - gp_Dir& aDNF, - const Standard_Real aDt2D); + Standard_EXPORT static bool GetApproxNormalToFaceOnEdge(const TopoDS_Edge& theE, + const TopoDS_Face& theF, + const double aT, + gp_Pnt& aP, + gp_Dir& aDNF, + const double aDt2D); //! Computes normal to the face for the 3D-point that - //! belongs to the edge at parameter .
- //! Output:
- //! aPx - the 3D-point where the normal computed
- //! aD - the normal;
- //! Warning:
+ //! belongs to the edge at parameter . + //! Output: + //! aPx - the 3D-point where the normal computed + //! aD - the normal; + //! Warning: //! The normal is computed not exactly in the point on the //! edge, but in point that is near to the edge towards to - //! the face material (so, we'll have approx. normal);
+ //! the face material (so, we'll have approx. normal); //! The point is computed using PointNearEdge function //! with the shifting value from the edge, //! but if this value is too big the point will be - //! computed using Hatcher (PointInFace function).
+ //! computed using Hatcher (PointInFace function). //! Returns TRUE in case of success. - Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge( - const TopoDS_Edge& theE, - const TopoDS_Face& theF, - const Standard_Real aT, - const Standard_Real aDt2D, - gp_Pnt& aP, - gp_Dir& aDNF, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static bool GetApproxNormalToFaceOnEdge( + const TopoDS_Edge& theE, + const TopoDS_Face& theF, + const double aT, + const double aDt2D, + gp_Pnt& aP, + gp_Dir& aDNF, + const occ::handle& theContext); - //! Compute the point , () that is near to - //! the edge at parameter towards to the + //! Compute the point , () that is near to + //! the edge at parameter towards to the //! material of the face . The value of shifting in - //! 2D is
+ //! 2D is //! If the value of shifting is too big the point - //! will be computed using Hatcher (PointInFace function).
- //! Returns error status:
- //! 0 - in case of success;
- //! 1 - does not have 2d curve on the face ;
+ //! will be computed using Hatcher (PointInFace function). + //! Returns error status: + //! 0 - in case of success; + //! 1 - does not have 2d curve on the face ; //! 2 - the computed point is out of the face. - Standard_EXPORT static Standard_Integer PointNearEdge(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - const Standard_Real aDt2D, - gp_Pnt2d& aP2D, - gp_Pnt& aPx, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int PointNearEdge(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + const double aDt2D, + gp_Pnt2d& aP2D, + gp_Pnt& aPx, + const occ::handle& theContext); - //! Compute the point , () that is near to - //! the edge at parameter towards to the + //! Compute the point , () that is near to + //! the edge at parameter towards to the //! material of the face . The value of shifting in - //! 2D is . No checks on this value will be done.
- //! Returns error status:
- //! 0 - in case of success;
+ //! 2D is . No checks on this value will be done. + //! Returns error status: + //! 0 - in case of success; //! 1 - does not have 2d curve on the face . - Standard_EXPORT static Standard_Integer PointNearEdge(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - const Standard_Real aDt2D, - gp_Pnt2d& aP2D, - gp_Pnt& aPx); + Standard_EXPORT static int PointNearEdge(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + const double aDt2D, + gp_Pnt2d& aP2D, + gp_Pnt& aPx); - //! Computes the point , () that is near to - //! the edge at parameter towards to the + //! Computes the point , () that is near to + //! the edge at parameter towards to the //! material of the face . The value of shifting in - //! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d()
+ //! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d() //! If the value of shifting is too big the point will be computed - //! using Hatcher (PointInFace function).
- //! Returns error status:
- //! 0 - in case of success;
- //! 1 - does not have 2d curve on the face ;
+ //! using Hatcher (PointInFace function). + //! Returns error status: + //! 0 - in case of success; + //! 1 - does not have 2d curve on the face ; //! 2 - the computed point is out of the face. - Standard_EXPORT static Standard_Integer PointNearEdge(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aT, - gp_Pnt2d& aP2D, - gp_Pnt& aPx, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int PointNearEdge(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const double aT, + gp_Pnt2d& aP2D, + gp_Pnt& aPx, + const occ::handle& theContext); - //! Compute the point , () that is near to - //! the edge at arbitrary parameter towards to the + //! Compute the point , () that is near to + //! the edge at arbitrary parameter towards to the //! material of the face . The value of shifting in - //! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d().
+ //! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d(). //! If the value of shifting is too big the point will be computed - //! using Hatcher (PointInFace function).
- //! Returns error status:
- //! 0 - in case of success;
- //! 1 - does not have 2d curve on the face ;
+ //! using Hatcher (PointInFace function). + //! Returns error status: + //! 0 - in case of success; + //! 1 - does not have 2d curve on the face ; //! 2 - the computed point is out of the face. - Standard_EXPORT static Standard_Integer PointNearEdge(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - gp_Pnt2d& aP2D, - gp_Pnt& aPx, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int PointNearEdge(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + gp_Pnt2d& aP2D, + gp_Pnt& aPx, + const occ::handle& theContext); //! Returns simple step value that is used in 2D-computations //! = 1.e-5 - Standard_EXPORT static Standard_Real MinStepIn2d(); + Standard_EXPORT static double MinStepIn2d(); //! Returns TRUE if the shape does not contain - //! geometry information (e.g. empty compound) - Standard_EXPORT static Standard_Boolean IsEmptyShape(const TopoDS_Shape& aS); + //! geometry information (e.g. empty compound) + Standard_EXPORT static bool IsEmptyShape(const TopoDS_Shape& aS); //! Get the edge from the face that is the same as //! the edge @@ -224,46 +224,43 @@ public: const TopoDS_Face& aF, TopoDS_Edge& aER); - //! Computes arbitrary point inside the face .
- //! - 2D representation of - //! on the surface of
+ //! Computes arbitrary point inside the face . + //! - 2D representation of + //! on the surface of //! Returns 0 in case of success. - Standard_EXPORT static Standard_Integer PointInFace(const TopoDS_Face& theF, - gp_Pnt& theP, - gp_Pnt2d& theP2D, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int PointInFace(const TopoDS_Face& theF, + gp_Pnt& theP, + gp_Pnt2d& theP2D, + const occ::handle& theContext); //! Computes a point inside the face //! using starting point taken by the parameter //! from the 2d curve of the edge on the face //! in the direction perpendicular to the tangent vector - //! of the 2d curve of the edge.
+ //! of the 2d curve of the edge. //! The point will be distanced on from the 2d curve. - //! - 2D representation of - //! on the surface of
+ //! - 2D representation of + //! on the surface of //! Returns 0 in case of success. - Standard_EXPORT static Standard_Integer PointInFace(const TopoDS_Face& theF, - const TopoDS_Edge& theE, - const Standard_Real theT, - const Standard_Real theDt2D, - gp_Pnt& theP, - gp_Pnt2d& theP2D, - const Handle(IntTools_Context)& theContext); + Standard_EXPORT static int PointInFace(const TopoDS_Face& theF, + const TopoDS_Edge& theE, + const double theT, + const double theDt2D, + gp_Pnt& theP, + gp_Pnt2d& theP2D, + const occ::handle& theContext); //! Computes a point inside the face //! using the line so that 2D point //! , 2D representation of - //! on the surface of , lies on that line.
+ //! on the surface of , lies on that line. //! Returns 0 in case of success. - Standard_EXPORT static Standard_Integer PointInFace(const TopoDS_Face& theF, - const Handle(Geom2d_Curve)& theL, - gp_Pnt& theP, - gp_Pnt2d& theP2D, - const Handle(IntTools_Context)& theContext, - const Standard_Real theDt2D = 0.0); - -protected: -private: + Standard_EXPORT static int PointInFace(const TopoDS_Face& theF, + const occ::handle& theL, + gp_Pnt& theP, + gp_Pnt2d& theP2D, + const occ::handle& theContext, + const double theDt2D = 0.0); }; #endif // _BOPTools_AlgoTools3D_HeaderFile diff --git a/opencascade/BOPTools_BoxSelector.hxx b/opencascade/BOPTools_BoxSelector.hxx index 2ec4fe220..81bced7c9 100644 --- a/opencascade/BOPTools_BoxSelector.hxx +++ b/opencascade/BOPTools_BoxSelector.hxx @@ -19,71 +19,61 @@ #include #include -#include +#include //! Template Selector for elements selection from BVH tree. template class BOPTools_BoxSelector - : public BVH_Traverse, - Standard_Boolean> + : public BVH_Traverse, bool> { public: - typedef typename BVH::VectorType::Type BVH_VecNd; + typedef typename BVH::VectorType::Type BVH_VecNd; public: //! @name Constructor //! Empty constructor - BOPTools_BoxSelector() {}; + BOPTools_BoxSelector() = default; public: //! @name public interfaces //! Clears the indices void Clear() { myIndices.Clear(); } //! Sets the box - void SetBox(const BVH_Box& theBox) { myBox = theBox; } + void SetBox(const BVH_Box& theBox) { myBox = theBox; } //! Returns the list of accepted indices - const TColStd_ListOfInteger& Indices() const { return myIndices; } + const NCollection_List& Indices() const { return myIndices; } public: //! @name Rejection/Acceptance rules //! Checks if the box should be rejected - virtual Standard_Boolean RejectNode(const BVH_VecNd& theCMin, - const BVH_VecNd& theCMax, - Standard_Boolean& theIsInside) const Standard_OVERRIDE + bool RejectNode(const BVH_VecNd& theCMin, + const BVH_VecNd& theCMax, + bool& theIsInside) const override { - Standard_Boolean hasOverlap; + bool hasOverlap; theIsInside = myBox.Contains(theCMin, theCMax, hasOverlap); return !hasOverlap; } //! Checks if the element should be rejected - Standard_Boolean RejectElement(const Standard_Integer theIndex) - { - return myBox.IsOut(this->myBVHSet->Box(theIndex)); - } + bool RejectElement(const int theIndex) { return myBox.IsOut(this->myBVHSet->Box(theIndex)); } //! Checks if the metric of the node may be accepted - virtual Standard_Boolean AcceptMetric(const Standard_Boolean& theIsInside) const Standard_OVERRIDE - { - return theIsInside; - } + bool AcceptMetric(const bool& theIsInside) const override { return theIsInside; } //! Accepts the element with the index in BVH tree - virtual Standard_Boolean Accept(const Standard_Integer theIndex, - const Standard_Boolean& theIsInside) Standard_OVERRIDE + bool Accept(const int theIndex, const bool& theIsInside) override { if (theIsInside || !RejectElement(theIndex)) { myIndices.Append(this->myBVHSet->Element(theIndex)); - return Standard_True; + return true; } - return Standard_False; + return false; } -protected: //! @name Fields - BVH_Box myBox; //!< Selection box - TColStd_ListOfInteger myIndices; //!< Selected indices +protected: //! @name Fields + BVH_Box myBox; //!< Selection box + NCollection_List myIndices; //!< Selected indices }; #endif diff --git a/opencascade/BOPTools_BoxTree.hxx b/opencascade/BOPTools_BoxTree.hxx index 78bcdcc51..a20358169 100644 --- a/opencascade/BOPTools_BoxTree.hxx +++ b/opencascade/BOPTools_BoxTree.hxx @@ -27,7 +27,7 @@ class BOPTools_BoxSet : public BVH_BoxSet { public: //! @name Constructors //! Empty constructor for use the default BVH_Builder - BOPTools_BoxSet(const opencascade::handle>& theBuilder = NULL) + BOPTools_BoxSet(const opencascade::handle>& theBuilder = nullptr) : BVH_BoxSet( theBuilder.IsNull() ? new BVH_LinearBuilder() : theBuilder) { @@ -35,13 +35,13 @@ public: //! @name Constructors }; //! 2D definitions -typedef BOPTools_BoxSet BOPTools_Box2dTree; -typedef BOPTools_BoxSelector<2> BOPTools_Box2dTreeSelector; -typedef BOPTools_PairSelector<2> BOPTools_Box2dPairSelector; +typedef BOPTools_BoxSet BOPTools_Box2dTree; +typedef BOPTools_BoxSelector<2> BOPTools_Box2dTreeSelector; +typedef BOPTools_PairSelector<2> BOPTools_Box2dPairSelector; //! 3D definitions -typedef BOPTools_BoxSet BOPTools_BoxTree; -typedef BOPTools_BoxSelector<3> BOPTools_BoxTreeSelector; -typedef BOPTools_PairSelector<3> BOPTools_BoxPairSelector; +typedef BOPTools_BoxSet BOPTools_BoxTree; +typedef BOPTools_BoxSelector<3> BOPTools_BoxTreeSelector; +typedef BOPTools_PairSelector<3> BOPTools_BoxPairSelector; #endif diff --git a/opencascade/BOPTools_ConnexityBlock.hxx b/opencascade/BOPTools_ConnexityBlock.hxx index b0e3009d4..f677f0ed6 100644 --- a/opencascade/BOPTools_ConnexityBlock.hxx +++ b/opencascade/BOPTools_ConnexityBlock.hxx @@ -16,51 +16,50 @@ #define BOPTools_ConnexityBlock_HeaderFile #include -#include +#include +#include + +//================================================================================================= -//======================================================================= -// class : ConnexityBlock -// purpose : -//======================================================================= class BOPTools_ConnexityBlock { public: BOPTools_ConnexityBlock() : myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()), - myRegular(Standard_True), + myRegular(true), myShapes(myAllocator), myLoops(myAllocator) {}; // - BOPTools_ConnexityBlock(const Handle(NCollection_BaseAllocator)& theAllocator) + BOPTools_ConnexityBlock(const occ::handle& theAllocator) : myAllocator(theAllocator), - myRegular(Standard_True), + myRegular(true), myShapes(myAllocator), myLoops(myAllocator) {}; // - const TopTools_ListOfShape& Shapes() const { return myShapes; }; + const NCollection_List& Shapes() const { return myShapes; }; // - TopTools_ListOfShape& ChangeShapes() { return myShapes; }; + NCollection_List& ChangeShapes() { return myShapes; }; // - void SetRegular(const Standard_Boolean theFlag) { myRegular = theFlag; } + void SetRegular(const bool theFlag) { myRegular = theFlag; } // - Standard_Boolean IsRegular() const { return myRegular; } + bool IsRegular() const { return myRegular; } // - const TopTools_ListOfShape& Loops() const { return myLoops; }; + const NCollection_List& Loops() const { return myLoops; }; // - TopTools_ListOfShape& ChangeLoops() { return myLoops; }; + NCollection_List& ChangeLoops() { return myLoops; }; // protected: - Handle(NCollection_BaseAllocator) myAllocator; - Standard_Boolean myRegular; - TopTools_ListOfShape myShapes; - TopTools_ListOfShape myLoops; + occ::handle myAllocator; + bool myRegular; + NCollection_List myShapes; + NCollection_List myLoops; }; #endif diff --git a/opencascade/BOPTools_CoupleOfShape.hxx b/opencascade/BOPTools_CoupleOfShape.hxx index 8ac9d89e8..1c132d99d 100644 --- a/opencascade/BOPTools_CoupleOfShape.hxx +++ b/opencascade/BOPTools_CoupleOfShape.hxx @@ -17,16 +17,14 @@ #include -//======================================================================= -// class : -// purpose : -//======================================================================= +//================================================================================================= + class BOPTools_CoupleOfShape { public: - BOPTools_CoupleOfShape() {}; + BOPTools_CoupleOfShape() = default; // - ~BOPTools_CoupleOfShape() {}; + ~BOPTools_CoupleOfShape() = default; // void SetShape1(const TopoDS_Shape& theShape) { myShape1 = theShape; } diff --git a/opencascade/BOPTools_IndexedDataMapOfSetShape.hxx b/opencascade/BOPTools_IndexedDataMapOfSetShape.hxx index 5ad63044f..84c77bccd 100644 --- a/opencascade/BOPTools_IndexedDataMapOfSetShape.hxx +++ b/opencascade/BOPTools_IndexedDataMapOfSetShape.hxx @@ -1,5 +1,4 @@ -// Created by: Eugeny MALTCHIKOV -// Copyright (c) 2017 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,24 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPTools_IndexedDataMapOfSetShape_HeaderFile -#define BOPTools_IndexedDataMapOfSetShape_HeaderFile +//! @file BOPTools_IndexedDataMapOfSetShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap directly instead. +#ifndef _BOPTools_IndexedDataMapOfSetShape_hxx +#define _BOPTools_IndexedDataMapOfSetShape_hxx + +#include #include #include #include +Standard_HEADER_DEPRECATED("BOPTools_IndexedDataMapOfSetShape.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_IndexedDataMap directly.") + + Standard_DEPRECATED("BOPTools_IndexedDataMapOfSetShape is deprecated, use " + "NCollection_IndexedDataMap directly") typedef NCollection_IndexedDataMap BOPTools_IndexedDataMapOfSetShape; -#endif +#endif // _BOPTools_IndexedDataMapOfSetShape_hxx diff --git a/opencascade/BOPTools_ListOfConnexityBlock.hxx b/opencascade/BOPTools_ListOfConnexityBlock.hxx index e84c52eee..4273b1831 100644 --- a/opencascade/BOPTools_ListOfConnexityBlock.hxx +++ b/opencascade/BOPTools_ListOfConnexityBlock.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,27 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPTools_ListOfConnexityBlock_HeaderFile -#define BOPTools_ListOfConnexityBlock_HeaderFile +//! @file BOPTools_ListOfConnexityBlock.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPTools_ListOfConnexityBlock_hxx +#define _BOPTools_ListOfConnexityBlock_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BOPTools_ListOfConnexityBlock.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection types directly.") + + Standard_DEPRECATED("BOPTools_ListOfConnexityBlock is deprecated, use " + "NCollection_List directly") typedef NCollection_List BOPTools_ListOfConnexityBlock; -typedef BOPTools_ListOfConnexityBlock::Iterator BOPTools_ListIteratorOfListOfConnexityBlock; +Standard_DEPRECATED("BOPTools_ListIteratorOfListOfConnexityBlock is deprecated, use " + "NCollection_List::Iterator directly") +typedef NCollection_List::Iterator + BOPTools_ListIteratorOfListOfConnexityBlock; -#endif +#endif // _BOPTools_ListOfConnexityBlock_hxx diff --git a/opencascade/BOPTools_ListOfCoupleOfShape.hxx b/opencascade/BOPTools_ListOfCoupleOfShape.hxx index 99158839a..82e75cc71 100644 --- a/opencascade/BOPTools_ListOfCoupleOfShape.hxx +++ b/opencascade/BOPTools_ListOfCoupleOfShape.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,13 +11,27 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPTools_ListOfCoupleOfShape_HeaderFile -#define BOPTools_ListOfCoupleOfShape_HeaderFile +//! @file BOPTools_ListOfCoupleOfShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BOPTools_ListOfCoupleOfShape_hxx +#define _BOPTools_ListOfCoupleOfShape_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BOPTools_ListOfCoupleOfShape.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection types directly.") + + Standard_DEPRECATED("BOPTools_ListOfCoupleOfShape is deprecated, use " + "NCollection_List directly") typedef NCollection_List BOPTools_ListOfCoupleOfShape; -typedef BOPTools_ListOfCoupleOfShape::Iterator BOPTools_ListIteratorOfListOfCoupleOfShape; +Standard_DEPRECATED("BOPTools_ListIteratorOfListOfCoupleOfShape is deprecated, use " + "NCollection_List::Iterator directly") +typedef NCollection_List::Iterator + BOPTools_ListIteratorOfListOfCoupleOfShape; -#endif +#endif // _BOPTools_ListOfCoupleOfShape_hxx diff --git a/opencascade/BOPTools_MapOfSet.hxx b/opencascade/BOPTools_MapOfSet.hxx index 9b92ad68c..c3f5b7ab2 100644 --- a/opencascade/BOPTools_MapOfSet.hxx +++ b/opencascade/BOPTools_MapOfSet.hxx @@ -1,5 +1,4 @@ -// Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -12,14 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BOPTools_MapOfSet_HeaderFile -#define BOPTools_MapOfSet_HeaderFile +//! @file BOPTools_MapOfSet.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. -#include +#ifndef _BOPTools_MapOfSet_hxx +#define _BOPTools_MapOfSet_hxx +#include +#include #include +Standard_HEADER_DEPRECATED( + "BOPTools_MapOfSet.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BOPTools_MapOfSet is deprecated, use NCollection_Map directly") typedef NCollection_Map BOPTools_MapOfSet; -typedef BOPTools_MapOfSet::Iterator BOPTools_MapIteratorOfMapOfSet; +Standard_DEPRECATED("BOPTools_MapIteratorOfMapOfSet is deprecated, use " + "NCollection_Map::Iterator directly") +typedef NCollection_Map::Iterator BOPTools_MapIteratorOfMapOfSet; -#endif +#endif // _BOPTools_MapOfSet_hxx diff --git a/opencascade/BOPTools_PairSelector.hxx b/opencascade/BOPTools_PairSelector.hxx index 7a20a3e3b..2bd7ccbd1 100644 --- a/opencascade/BOPTools_PairSelector.hxx +++ b/opencascade/BOPTools_PairSelector.hxx @@ -17,48 +17,46 @@ #include #include +#include -#include #include //! Template Selector for selection of the elements from two BVH trees. template class BOPTools_PairSelector - : public BVH_PairTraverse> + : public BVH_PairTraverse> { public: //! @name public types //! Auxiliary structure to keep the pair of indices struct PairIDs { - PairIDs(const Standard_Integer theId1 = -1, const Standard_Integer theId2 = -1) + PairIDs(const int theId1 = -1, const int theId2 = -1) : ID1(theId1), ID2(theId2) { } - Standard_Boolean operator<(const PairIDs& theOther) const + bool operator<(const PairIDs& theOther) const { return ID1 < theOther.ID1 || (ID1 == theOther.ID1 && ID2 < theOther.ID2); } - Standard_Integer ID1; - Standard_Integer ID2; + int ID1; + int ID2; }; - typedef typename BVH::VectorType::Type BVH_VecNd; + typedef typename BVH::VectorType::Type BVH_VecNd; public: //! @name Constructor //! Empty constructor BOPTools_PairSelector() - : mySameBVHs(Standard_False) + : mySameBVHs(false) { } public: //! @name public interfaces //! Clears the indices - void Clear() { myPairs.clear(); } + void Clear() { myPairs.Clear(); } //! Sorts the indices void Sort() { std::sort(myPairs.begin(), myPairs.end()); } @@ -70,45 +68,43 @@ public: //! @name public interfaces //! not contain pairs in which IDs are the same (pair (1, 1) will be rejected). //! If it is required to have a full vector of pairs even //! for the same BVH trees, just keep the false value of this flag. - void SetSame(const Standard_Boolean theIsSame) { mySameBVHs = theIsSame; } + void SetSame(const bool theIsSame) { mySameBVHs = theIsSame; } //! Returns the list of accepted indices - const std::vector& Pairs() const { return myPairs; } + const NCollection_LinearVector& Pairs() const { return myPairs; } public: //! @name Rejection/Acceptance rules //! Basing on the bounding boxes of the nodes checks if the pair of nodes should be rejected. - virtual Standard_Boolean RejectNode(const BVH_VecNd& theCMin1, - const BVH_VecNd& theCMax1, - const BVH_VecNd& theCMin2, - const BVH_VecNd& theCMax2, - Standard_Real&) const Standard_OVERRIDE + bool RejectNode(const BVH_VecNd& theCMin1, + const BVH_VecNd& theCMax1, + const BVH_VecNd& theCMin2, + const BVH_VecNd& theCMax2, + double&) const override { - return BVH_Box(theCMin1, theCMax1).IsOut(theCMin2, theCMax2); + return BVH_Box(theCMin1, theCMax1).IsOut(theCMin2, theCMax2); } //! Checks if the pair of elements should be rejected. - Standard_Boolean RejectElement(const Standard_Integer theID1, const Standard_Integer theID2) + bool RejectElement(const int theID1, const int theID2) { return (mySameBVHs && theID1 >= theID2) || this->myBVHSet1->Box(theID1).IsOut(this->myBVHSet2->Box(theID2)); } //! Checks and accepts the pair of elements. - virtual Standard_Boolean Accept(const Standard_Integer theID1, - const Standard_Integer theID2) Standard_OVERRIDE + bool Accept(const int theID1, const int theID2) override { if (!RejectElement(theID1, theID2)) { - myPairs.push_back( - PairIDs(this->myBVHSet1->Element(theID1), this->myBVHSet2->Element(theID2))); - return Standard_True; + myPairs.Append(PairIDs(this->myBVHSet1->Element(theID1), this->myBVHSet2->Element(theID2))); + return true; } - return Standard_False; + return false; } -protected: //! @name Fields - std::vector myPairs; //!< Selected pairs of indices - Standard_Boolean mySameBVHs; //!< Selection is performed from the same BVH trees +protected: //! @name Fields + NCollection_LinearVector myPairs; //!< Selected pairs of indices + bool mySameBVHs; //!< Selection is performed from the same BVH trees }; #endif diff --git a/opencascade/BOPTools_Parallel.hxx b/opencascade/BOPTools_Parallel.hxx index 0208d5c99..f20d5022a 100644 --- a/opencascade/BOPTools_Parallel.hxx +++ b/opencascade/BOPTools_Parallel.hxx @@ -18,9 +18,10 @@ #include #include #include -#include #include +#include + //! Implementation of Functors/Starters class BOPTools_Parallel { @@ -35,15 +36,15 @@ class BOPTools_Parallel } //! Defines functor interface. - void operator()(const Standard_Integer theIndex) const + void operator()(const int theIndex) const { typename TypeSolverVector::value_type& aSolver = mySolvers[theIndex]; aSolver.Perform(); } private: - Functor(const Functor&); - Functor& operator=(const Functor&); + Functor(const Functor&) = delete; + Functor& operator=(const Functor&) = delete; private: TypeSolverVector& mySolvers; @@ -82,13 +83,13 @@ class BOPTools_Parallel opencascade::handle aContext = new TypeContext(NCollection_BaseAllocator::CommonBaseAllocator()); - Standard_Mutex::Sentry aLocker(myMutex); + std::lock_guard aLock(myMutex); myContextMap.Bind(aThreadID, aContext); return myContextMap(aThreadID); } //! Defines functor interface - void operator()(const Standard_Integer theIndex) const + void operator()(const int theIndex) const { const opencascade::handle& aContext = GetThreadContext(); typename TypeSolverVector::value_type& aSolver = mySolverVector[theIndex]; @@ -98,13 +99,13 @@ class BOPTools_Parallel } private: - ContextFunctor(const ContextFunctor&); - ContextFunctor& operator=(const ContextFunctor&); + ContextFunctor(const ContextFunctor&) = delete; + ContextFunctor& operator=(const ContextFunctor&) = delete; private: TypeSolverVector& mySolverVector; mutable NCollection_DataMap> myContextMap; - mutable Standard_Mutex myMutex; + mutable std::mutex myMutex; }; //! Functor storing array of algorithm contexts per thread in pool @@ -142,8 +143,8 @@ class BOPTools_Parallel } private: - ContextFunctor2(const ContextFunctor2&); - ContextFunctor2& operator=(const ContextFunctor2&); + ContextFunctor2(const ContextFunctor2&) = delete; + ContextFunctor2& operator=(const ContextFunctor2&) = delete; private: TypeSolverVector& mySolverVector; @@ -153,7 +154,7 @@ class BOPTools_Parallel public: //! Pure version template - static void Perform(Standard_Boolean theIsRunParallel, TypeSolverVector& theSolverVector) + static void Perform(bool theIsRunParallel, TypeSolverVector& theSolverVector) { Functor aFunctor(theSolverVector); OSD_Parallel::For(0, theSolverVector.Length(), aFunctor, !theIsRunParallel); @@ -161,13 +162,13 @@ public: //! Context dependent version template - static void Perform(Standard_Boolean theIsRunParallel, + static void Perform(bool theIsRunParallel, TypeSolverVector& theSolverVector, opencascade::handle& theContext) { if (OSD_Parallel::ToUseOcctThreads()) { - const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool(); + const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); OSD_ThreadPool::Launcher aPoolLauncher(*aThreadPool, theIsRunParallel ? theSolverVector.Length() : 0); ContextFunctor2 aFunctor(theSolverVector, aPoolLauncher); diff --git a/opencascade/BOPTools_Set.hxx b/opencascade/BOPTools_Set.hxx index e9485162d..50e92052d 100644 --- a/opencascade/BOPTools_Set.hxx +++ b/opencascade/BOPTools_Set.hxx @@ -22,7 +22,7 @@ #include #include #include -#include +#include class BOPTools_Set { @@ -32,7 +32,7 @@ public: Standard_EXPORT BOPTools_Set(); Standard_EXPORT virtual ~BOPTools_Set(); - Standard_EXPORT BOPTools_Set(const Handle(NCollection_BaseAllocator)& theAllocator); + Standard_EXPORT BOPTools_Set(const occ::handle& theAllocator); //! Copy constructor. Standard_EXPORT BOPTools_Set(const BOPTools_Set& theOther); @@ -45,9 +45,9 @@ public: Standard_EXPORT void Add(const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType); - Standard_EXPORT Standard_Integer NbShapes() const; + Standard_EXPORT int NbShapes() const; - Standard_EXPORT Standard_Boolean IsEqual(const BOPTools_Set& aOther) const; + Standard_EXPORT bool IsEqual(const BOPTools_Set& aOther) const; bool operator==(const BOPTools_Set& theOther) const { return IsEqual(theOther); } @@ -56,12 +56,12 @@ public: protected: Standard_EXPORT void Clear(); - Handle(NCollection_BaseAllocator) myAllocator; - TopTools_ListOfShape myShapes; - TopoDS_Shape myShape; - Standard_Integer myNbShapes; - size_t mySum; - Standard_Integer myUpper; + occ::handle myAllocator; + NCollection_DynamicArray myShapes; + TopoDS_Shape myShape; + int myNbShapes; + size_t mySum; + int myUpper; }; namespace std diff --git a/opencascade/BRepAdaptor_Array1OfCurve.hxx b/opencascade/BRepAdaptor_Array1OfCurve.hxx index acdfc19e6..86fb48050 100644 --- a/opencascade/BRepAdaptor_Array1OfCurve.hxx +++ b/opencascade/BRepAdaptor_Array1OfCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-02-19 -// Created by: Remi LEQUETTE -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepAdaptor_Array1OfCurve_HeaderFile -#define BRepAdaptor_Array1OfCurve_HeaderFile +//! @file BRepAdaptor_Array1OfCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Array1 directly instead. +#ifndef _BRepAdaptor_Array1OfCurve_hxx +#define _BRepAdaptor_Array1OfCurve_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepAdaptor_Array1OfCurve.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Array1 directly.") + + Standard_DEPRECATED( + "BRepAdaptor_Array1OfCurve is deprecated, use NCollection_Array1 directly") typedef NCollection_Array1 BRepAdaptor_Array1OfCurve; -#endif +#endif // _BRepAdaptor_Array1OfCurve_hxx diff --git a/opencascade/BRepAdaptor_CompCurve.hxx b/opencascade/BRepAdaptor_CompCurve.hxx index a8006b256..d2b78f1ee 100644 --- a/opencascade/BRepAdaptor_CompCurve.hxx +++ b/opencascade/BRepAdaptor_CompCurve.hxx @@ -23,13 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include #include class TopoDS_Edge; @@ -43,11 +43,9 @@ class gp_Parab; class Geom_BezierCurve; class Geom_BSplineCurve; -DEFINE_STANDARD_HANDLE(BRepAdaptor_CompCurve, Adaptor3d_Curve) - //! The Curve from BRepAdaptor allows to use a Wire //! of the BRep topology like a 3D curve. -//! Warning: With this class of curve, C0 and C1 continuities +//! Warning: With this class of curve, C0 and C1 continuities //! are not assumed. So be careful with some algorithm! //! Please note that BRepAdaptor_CompCurve cannot be //! periodic curve at all (even if it contains single @@ -62,154 +60,129 @@ public: //! Creates an undefined Curve with no Wire loaded. Standard_EXPORT BRepAdaptor_CompCurve(); - Standard_EXPORT BRepAdaptor_CompCurve( - const TopoDS_Wire& W, - const Standard_Boolean KnotByCurvilinearAbcissa = Standard_False); + Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, + const bool KnotByCurvilinearAbcissa = false); - //! Creates a Curve to access the geometry of edge - //! . - Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, - const Standard_Boolean KnotByCurvilinearAbcissa, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + //! Creates a Curve to access the geometry of edge . + Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, + const bool KnotByCurvilinearAbcissa, + const double First, + const double Last, + const double Tol); - //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE; + //! Shallow copy of adaptor. + Standard_EXPORT occ::handle ShallowCopy() const override; - //! Sets the wire . - Standard_EXPORT void Initialize(const TopoDS_Wire& W, - const Standard_Boolean KnotByCurvilinearAbcissa); + //! Sets the wire . + Standard_EXPORT void Initialize(const TopoDS_Wire& W, const bool KnotByCurvilinearAbcissa); - //! Sets wire and trimmed parameter. - Standard_EXPORT void Initialize(const TopoDS_Wire& W, - const Standard_Boolean KnotByCurvilinearAbcissa, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + //! Sets wire and trimmed parameter. + Standard_EXPORT void Initialize(const TopoDS_Wire& W, + const bool KnotByCurvilinearAbcissa, + const double First, + const double Last, + const double Tol); //! Returns the wire. Standard_EXPORT const TopoDS_Wire& Wire() const; - //! returns an edge and one parameter on them + //! returns an edge and one parameter on them //! corresponding to the parameter U. - Standard_EXPORT void Edge(const Standard_Real U, TopoDS_Edge& E, Standard_Real& UonE) const; + Standard_EXPORT void Edge(const double U, TopoDS_Edge& E, double& UonE) const; - Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; + Standard_EXPORT double FirstParameter() const override; - Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; + Standard_EXPORT double LastParameter() const override; - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity() const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. //! If >= - Standard_EXPORT Handle(Adaptor3d_Curve) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve - Standard_EXPORT gp_Pnt Value(const Standard_Real U) const Standard_OVERRIDE; - - //! Computes the point of parameter U. - Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve - //! with its first derivative. - //! Raised if the continuity of the current interval - //! is not C1. - Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first and second - //! derivatives V1 and V2. - //! Raised if the continuity of the current interval - //! is not C2. - Standard_EXPORT void D2(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first, the second - //! and the third derivative. - //! Raised if the continuity of the current interval - //! is not C3. - Standard_EXPORT void D3(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) const Standard_OVERRIDE; - - //! The returned vector gives the value of the derivative for the - //! order of derivation N. - //! Raised if the continuity of the current interval - //! is not CN. - //! Raised if N < 1. - Standard_EXPORT gp_Vec DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; + + Standard_EXPORT bool IsClosed() const override; + + Standard_EXPORT bool IsPeriodic() const override; + + Standard_EXPORT double Period() const override; + + //! Computes the point of parameter theU on the curve. + [[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(const double theU) const final; + + //! Computes the point of parameter theU on the curve with its first derivative. + //! Raised if the continuity of the current interval is not C1. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double theU) const final; + + //! Returns the point and the first and second derivatives at parameter theU. + //! Raised if the continuity of the current interval is not C2. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double theU) const final; + + //! Returns the point and the first, second and third derivatives at parameter theU. + //! Raised if the continuity of the current interval is not C3. + [[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double theU) const final; + + //! Returns the derivative of order theN at parameter theU. + //! Raised if the continuity of the current interval is not CN. + //! Raised if theN < 1. + [[nodiscard]] Standard_EXPORT gp_Vec EvalDN(const double theU, const int theN) const final; //! returns the parametric resolution - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; + Standard_EXPORT double Resolution(const double R3d) const override; - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; + Standard_EXPORT GeomAbs_CurveType GetType() const override; - Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; + Standard_EXPORT gp_Lin Line() const override; - Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; + Standard_EXPORT gp_Circ Circle() const override; - Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; + Standard_EXPORT gp_Elips Ellipse() const override; - Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; + Standard_EXPORT gp_Hypr Hyperbola() const override; - Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; + Standard_EXPORT gp_Parab Parabola() const override; - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; + Standard_EXPORT int Degree() const override; - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; + Standard_EXPORT int NbPoles() const override; - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; + Standard_EXPORT int NbKnots() const override; - Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Bezier() const override; - Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; + Standard_EXPORT occ::handle BSpline() const override; -protected: private: - Standard_EXPORT void Prepare(Standard_Real& W, Standard_Real& D, Standard_Integer& ind) const; - - Standard_EXPORT void InvPrepare(const Standard_Integer ind, - Standard_Real& F, - Standard_Real& D) const; - - TopoDS_Wire myWire; - Standard_Real TFirst; - Standard_Real TLast; - Standard_Real PTol; - Handle(BRepAdaptor_HArray1OfCurve) myCurves; - Handle(TColStd_HArray1OfReal) myKnots; - Standard_Integer CurIndex; - Standard_Boolean Forward; - Standard_Boolean IsbyAC; + Standard_EXPORT void Prepare(double& W, double& D, int& ind) const; + + Standard_EXPORT void InvPrepare(const int ind, double& F, double& D) const; + + TopoDS_Wire myWire; + double TFirst; + double TLast; + double PTol; + occ::handle> myCurves; + occ::handle> myKnots; + int CurIndex; + bool Forward; + bool IsbyAC; }; #endif // _BRepAdaptor_CompCurve_HeaderFile diff --git a/opencascade/BRepAdaptor_Curve.hxx b/opencascade/BRepAdaptor_Curve.hxx index 663dff395..15dabfbeb 100644 --- a/opencascade/BRepAdaptor_Curve.hxx +++ b/opencascade/BRepAdaptor_Curve.hxx @@ -17,213 +17,84 @@ #ifndef _BRepAdaptor_Curve_HeaderFile #define _BRepAdaptor_Curve_HeaderFile -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include class TopoDS_Face; -class Adaptor3d_CurveOnSurface; -class gp_Pnt; -class gp_Vec; -class gp_Lin; -class gp_Circ; -class gp_Elips; -class gp_Hypr; -class gp_Parab; -class Geom_BezierCurve; -class Geom_BSplineCurve; -class Geom_OffsetCurve; - -DEFINE_STANDARD_HANDLE(BRepAdaptor_Curve, Adaptor3d_Curve) - -//! The Curve from BRepAdaptor allows to use an Edge + +//! The Curve from BRepAdaptor allows to use an Edge //! of the BRep topology like a 3D curve. //! //! It has the methods the class Curve from Adaptor3d. //! -//! It is created or Initialized with an Edge. It -//! takes into account local coordinate systems. If -//! the Edge has a 3D curve it is use with priority. -//! If the edge has no 3D curve one of the curves on +//! It is created or Initialized with an Edge. It +//! takes into account local coordinate systems. If +//! the Edge has a 3D curve it is use with priority. +//! If the edge has no 3D curve one of the curves on //! surface is used. It is possible to enforce using a -//! curve on surface by creating or initialising with +//! curve on surface by creating or initialising with //! an Edge and a Face. -class BRepAdaptor_Curve : public Adaptor3d_Curve +class BRepAdaptor_Curve : public GeomAdaptor_TransformedCurve { - DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Curve, Adaptor3d_Curve) + DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Curve, GeomAdaptor_TransformedCurve) public: //! Creates an undefined Curve with no Edge loaded. Standard_EXPORT BRepAdaptor_Curve(); - //! Creates a Curve to access the geometry of edge - //! . + //! Creates a Curve to access the geometry of edge . Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E); - //! Creates a Curve to access the geometry of edge - //! . The geometry will be computed using the - //! parametric curve of on the face . An Error - //! is raised if the edge does not have a pcurve on + //! Creates a Curve to access the geometry of edge + //! . The geometry will be computed using the + //! parametric curve of on the face . An Error + //! is raised if the edge does not have a pcurve on //! the face. Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F); //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ShallowCopy() const override; //! Reset currently loaded curve (undone Load()). Standard_EXPORT void Reset(); - //! Sets the Curve to access the geometry of + //! Sets the Curve to access the geometry of //! edge . Standard_EXPORT void Initialize(const TopoDS_Edge& E); - //! Sets the Curve to access the geometry of - //! edge . The geometry will be computed using the - //! parametric curve of on the face . An Error - //! is raised if the edge does not have a pcurve on + //! Sets the Curve to access the geometry of + //! edge . The geometry will be computed using the + //! parametric curve of on the face . An Error + //! is raised if the edge does not have a pcurve on //! the face. Standard_EXPORT void Initialize(const TopoDS_Edge& E, const TopoDS_Face& F); - //! Returns the coordinate system of the curve. - Standard_EXPORT const gp_Trsf& Trsf() const; - - //! Returns True if the edge geometry is computed from - //! a 3D curve. - Standard_EXPORT Standard_Boolean Is3DCurve() const; - - //! Returns True if the edge geometry is computed from - //! a pcurve on a surface. - Standard_EXPORT Standard_Boolean IsCurveOnSurface() const; - - //! Returns the Curve of the edge. - Standard_EXPORT const GeomAdaptor_Curve& Curve() const; - - //! Returns the CurveOnSurface of the edge. - Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const; - //! Returns the edge. Standard_EXPORT const TopoDS_Edge& Edge() const; //! Returns the edge tolerance. - Standard_EXPORT Standard_Real Tolerance() const; - - Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; - - Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + Standard_EXPORT double Tolerance() const; - //! Returns the number of intervals for continuity - //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Stores in the parameters bounding the intervals - //! of continuity . - //! - //! The array must provide enough room to accommodate - //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Returns a curve equivalent of between - //! parameters and . is used to + //! Returns a curve equivalent of between + //! parameters and . is used to //! test for 3d points confusion. - //! If >= - Standard_EXPORT Handle(Adaptor3d_Curve) Trim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve - Standard_EXPORT gp_Pnt Value(const Standard_Real U) const Standard_OVERRIDE; - - //! Computes the point of parameter U. - Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; - - //! Computes the point of parameter U on the curve - //! with its first derivative. - //! Raised if the continuity of the current interval - //! is not C1. - Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first and second - //! derivatives V1 and V2. - //! Raised if the continuity of the current interval - //! is not C2. - Standard_EXPORT void D2(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2) const Standard_OVERRIDE; - - //! Returns the point P of parameter U, the first, the second - //! and the third derivative. - //! Raised if the continuity of the current interval - //! is not C3. - Standard_EXPORT void D3(const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) const Standard_OVERRIDE; - - //! The returned vector gives the value of the derivative for the - //! order of derivation N. - //! Raised if the continuity of the current interval - //! is not CN. - //! Raised if N < 1. - Standard_EXPORT gp_Vec DN(const Standard_Real U, - const Standard_Integer N) const Standard_OVERRIDE; - - //! returns the parametric resolution - Standard_EXPORT Standard_Real Resolution(const Standard_Real R3d) const Standard_OVERRIDE; - - Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; - - Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; - - Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; - - Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; - - Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; - - Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; - - //! Warning: - //! This will make a copy of the Bezier Curve since it applies to it myTsrf. - //! Be careful when using this method. - Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; - - //! Warning: - //! This will make a copy of the BSpline Curve since it applies to it myTsrf. - //! Be careful when using this method. - Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; - - Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE; + Standard_EXPORT occ::handle Trim(const double First, + const double Last, + const double Tol) const override; + + // Note: Most methods are inherited from GeomAdaptor_TransformedCurve. + // The following methods provide access to the underlying curve/transformation: + // - Curve() - returns const GeomAdaptor_Curve& + // - ChangeCurve() - returns GeomAdaptor_Curve& + // - Trsf() - returns const gp_Trsf& + // - Is3DCurve() - returns true if 3D curve is used + // - IsCurveOnSurface() - returns true if COS is used + // - CurveOnSurface() - returns const Adaptor3d_CurveOnSurface& + // + // Value, D0, D1, D2, D3, DN methods are inherited and marked as final. + // They apply the transformation automatically. private: - gp_Trsf myTrsf; - GeomAdaptor_Curve myCurve; - Handle(Adaptor3d_CurveOnSurface) myConSurf; - TopoDS_Edge myEdge; + TopoDS_Edge myEdge; }; #endif // _BRepAdaptor_Curve_HeaderFile diff --git a/opencascade/BRepAdaptor_Curve2d.hxx b/opencascade/BRepAdaptor_Curve2d.hxx index 3cd0a0a2b..4b957466e 100644 --- a/opencascade/BRepAdaptor_Curve2d.hxx +++ b/opencascade/BRepAdaptor_Curve2d.hxx @@ -26,14 +26,14 @@ #include //! The Curve2d from BRepAdaptor allows to use an Edge -//! on a Face like a 2d curve. (curve in the -//! parametric space). +//! on a Face like a 2d curve (curve in the parametric +//! space). //! -//! It has the methods of the class Curve2d from +//! It has the methods of the class Curve2d from //! Adpator. //! -//! It is created or initialized with a Face and an -//! Edge. The methods are inherited from Curve from +//! It is created or initialized with a Face and an +//! Edge. The methods are inherited from Curve from //! Geom2dAdaptor. class BRepAdaptor_Curve2d : public Geom2dAdaptor_Curve { @@ -46,7 +46,7 @@ public: Standard_EXPORT BRepAdaptor_Curve2d(const TopoDS_Edge& E, const TopoDS_Face& F); //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ShallowCopy() const override; //! Initialize with the pcurve of on . Standard_EXPORT void Initialize(const TopoDS_Edge& E, const TopoDS_Face& F); @@ -62,6 +62,4 @@ private: TopoDS_Face myFace; }; -DEFINE_STANDARD_HANDLE(BRepAdaptor_Curve2d, Geom2dAdaptor_Curve) - #endif // _BRepAdaptor_Curve2d_HeaderFile diff --git a/opencascade/BRepAdaptor_HArray1OfCurve.hxx b/opencascade/BRepAdaptor_HArray1OfCurve.hxx index 28110b2de..9492db3f3 100644 --- a/opencascade/BRepAdaptor_HArray1OfCurve.hxx +++ b/opencascade/BRepAdaptor_HArray1OfCurve.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-02-19 -// Created by: Remi LEQUETTE -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepAdaptor_HArray1OfCurve_HeaderFile -#define BRepAdaptor_HArray1OfCurve_HeaderFile +//! @file BRepAdaptor_HArray1OfCurve.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_HArray1 directly instead. +#ifndef _BRepAdaptor_HArray1OfCurve_hxx +#define _BRepAdaptor_HArray1OfCurve_hxx + +#include #include -#include +#include + +Standard_HEADER_DEPRECATED("BRepAdaptor_HArray1OfCurve.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_HArray1 directly.") -DEFINE_HARRAY1(BRepAdaptor_HArray1OfCurve, BRepAdaptor_Array1OfCurve) + Standard_DEPRECATED( + "BRepAdaptor_HArray1OfCurve is deprecated, use NCollection_HArray1 directly") +typedef NCollection_HArray1 BRepAdaptor_HArray1OfCurve; -#endif +#endif // _BRepAdaptor_HArray1OfCurve_hxx diff --git a/opencascade/BRepAdaptor_Surface.hxx b/opencascade/BRepAdaptor_Surface.hxx index 2c7dec88d..3c83bc892 100644 --- a/opencascade/BRepAdaptor_Surface.hxx +++ b/opencascade/BRepAdaptor_Surface.hxx @@ -17,15 +17,12 @@ #ifndef _BRepAdaptor_Surface_HeaderFile #define _BRepAdaptor_Surface_HeaderFile -#include +#include #include #include -#include -#include +#include #include -class gp_Pnt; -class gp_Vec; class gp_Pln; class gp_Cylinder; class gp_Cone; @@ -36,261 +33,53 @@ class Geom_BSplineSurface; class gp_Ax1; class gp_Dir; -DEFINE_STANDARD_HANDLE(BRepAdaptor_Surface, Adaptor3d_Surface) - -//! The Surface from BRepAdaptor allows to use a Face +//! The Surface from BRepAdaptor allows to use a Face //! of the BRep topology look like a 3D surface. //! -//! It has the methods of the class Surface from +//! It has the methods of the class Surface from //! Adaptor3d. //! //! It is created or initialized with a Face. It takes //! into account the local coordinates system. //! -//! The u,v parameter range is the minmax value for -//! the restriction, unless the flag restriction is +//! The u,v parameter range is the minmax value for +//! the restriction, unless the flag restriction is //! set to false. -class BRepAdaptor_Surface : public Adaptor3d_Surface +class BRepAdaptor_Surface : public GeomAdaptor_TransformedSurface { - DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Surface, Adaptor3d_Surface) + DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Surface, GeomAdaptor_TransformedSurface) public: //! Creates an undefined surface with no face loaded. Standard_EXPORT BRepAdaptor_Surface(); - //! Creates a surface to access the geometry of . - //! If is true the parameter range is - //! the parameter range in the UV space of the + //! Creates a surface to access the geometry of . + //! If is true the parameter range is + //! the parameter range in the UV space of the //! restriction. - Standard_EXPORT BRepAdaptor_Surface(const TopoDS_Face& F, - const Standard_Boolean R = Standard_True); + Standard_EXPORT BRepAdaptor_Surface(const TopoDS_Face& F, const bool R = true); - //! Shallow copy of adaptor - Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE; + //! Shallow copy of adaptor. + Standard_EXPORT occ::handle ShallowCopy() const override; //! Sets the surface to the geometry of . - Standard_EXPORT void Initialize(const TopoDS_Face& F, - const Standard_Boolean Restriction = Standard_True); - - //! Returns the surface. - Standard_EXPORT const GeomAdaptor_Surface& Surface() const; - - //! Returns the surface. - Standard_EXPORT GeomAdaptor_Surface& ChangeSurface(); - - //! Returns the surface coordinate system. - Standard_EXPORT const gp_Trsf& Trsf() const; + Standard_EXPORT void Initialize(const TopoDS_Face& F, const bool Restriction = true); //! Returns the face. Standard_EXPORT const TopoDS_Face& Face() const; //! Returns the face tolerance. - Standard_EXPORT Standard_Real Tolerance() const; - - virtual Standard_Real FirstUParameter() const Standard_OVERRIDE - { - return mySurf.FirstUParameter(); - } - - virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return mySurf.LastUParameter(); } - - virtual Standard_Real FirstVParameter() const Standard_OVERRIDE - { - return mySurf.FirstVParameter(); - } - - virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return mySurf.LastVParameter(); } - - virtual GeomAbs_Shape UContinuity() const Standard_OVERRIDE { return mySurf.UContinuity(); } - - virtual GeomAbs_Shape VContinuity() const Standard_OVERRIDE { return mySurf.VContinuity(); } - - //! If necessary, breaks the surface in U intervals of - //! continuity . And returns the number of - //! intervals. - virtual Standard_Integer NbUIntervals(const GeomAbs_Shape theSh) const Standard_OVERRIDE - { - return mySurf.NbUIntervals(theSh); - } - - //! If necessary, breaks the surface in V intervals of - //! continuity . And returns the number of - //! intervals. - virtual Standard_Integer NbVIntervals(const GeomAbs_Shape theSh) const Standard_OVERRIDE - { - return mySurf.NbVIntervals(theSh); - } - - //! Returns the intervals with the requested continuity - //! in the U direction. - Standard_EXPORT void UIntervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Returns the intervals with the requested continuity - //! in the V direction. - Standard_EXPORT void VIntervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; - - //! Returns a surface trimmed in the U direction - //! equivalent of between - //! parameters and . is used to - //! test for 3d points confusion. - //! If >= - Standard_EXPORT Handle(Adaptor3d_Surface) UTrim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - //! Returns a surface trimmed in the V direction between - //! parameters and . is used to - //! test for 3d points confusion. - //! If >= - Standard_EXPORT Handle(Adaptor3d_Surface) VTrim(const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol) const Standard_OVERRIDE; - - virtual Standard_Boolean IsUClosed() const Standard_OVERRIDE { return mySurf.IsUClosed(); } - - virtual Standard_Boolean IsVClosed() const Standard_OVERRIDE { return mySurf.IsVClosed(); } - - virtual Standard_Boolean IsUPeriodic() const Standard_OVERRIDE { return mySurf.IsUPeriodic(); } - - virtual Standard_Real UPeriod() const Standard_OVERRIDE { return mySurf.UPeriod(); } - - virtual Standard_Boolean IsVPeriodic() const Standard_OVERRIDE { return mySurf.IsVPeriodic(); } - - virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); } - - //! Computes the point of parameters U,V on the surface. - //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. - Standard_EXPORT gp_Pnt Value(const Standard_Real U, - const Standard_Real V) const Standard_OVERRIDE; - - //! Computes the point of parameters U,V on the surface. - Standard_EXPORT void D0(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P) const Standard_OVERRIDE; - - //! Computes the point and the first derivatives on the surface. - //! Raised if the continuity of the current intervals is not C1. - //! - //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point. - Standard_EXPORT void D1(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V) const Standard_OVERRIDE; - - //! Computes the point, the first and second - //! derivatives on the surface. - //! Raised if the continuity of the current - //! intervals is not C2. - Standard_EXPORT void D2(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV) const Standard_OVERRIDE; - - //! Computes the point, the first, second and third - //! derivatives on the surface. - //! Raised if the continuity of the current - //! intervals is not C3. - Standard_EXPORT void D3(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& D1U, - gp_Vec& D1V, - gp_Vec& D2U, - gp_Vec& D2V, - gp_Vec& D2UV, - gp_Vec& D3U, - gp_Vec& D3V, - gp_Vec& D3UUV, - gp_Vec& D3UVV) const Standard_OVERRIDE; - - //! Computes the derivative of order Nu in the direction - //! U and Nv in the direction V at the point P(U, V). - //! Raised if the current U interval is not not CNu - //! and the current V interval is not CNv. - //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. - Standard_EXPORT gp_Vec DN(const Standard_Real U, - const Standard_Real V, - const Standard_Integer Nu, - const Standard_Integer Nv) const Standard_OVERRIDE; - - //! Returns the parametric U resolution corresponding - //! to the real space resolution . - virtual Standard_Real UResolution(const Standard_Real theR3d) const Standard_OVERRIDE - { - return mySurf.UResolution(theR3d); - } - - //! Returns the parametric V resolution corresponding - //! to the real space resolution . - virtual Standard_Real VResolution(const Standard_Real theR3d) const Standard_OVERRIDE - { - return mySurf.VResolution(theR3d); - } - - //! Returns the type of the surface : Plane, Cylinder, - //! Cone, Sphere, Torus, BezierSurface, - //! BSplineSurface, SurfaceOfRevolution, - //! SurfaceOfExtrusion, OtherSurface - virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurf.GetType(); } - - Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE; - - Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE; - - Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE; - - Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE; - - Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE; - - virtual Standard_Integer UDegree() const Standard_OVERRIDE { return mySurf.UDegree(); } - - virtual Standard_Integer NbUPoles() const Standard_OVERRIDE { return mySurf.NbUPoles(); } - - virtual Standard_Integer VDegree() const Standard_OVERRIDE { return mySurf.VDegree(); } - - virtual Standard_Integer NbVPoles() const Standard_OVERRIDE { return mySurf.NbVPoles(); } - - virtual Standard_Integer NbUKnots() const Standard_OVERRIDE { return mySurf.NbUKnots(); } - - virtual Standard_Integer NbVKnots() const Standard_OVERRIDE { return mySurf.NbVKnots(); } - - virtual Standard_Boolean IsURational() const Standard_OVERRIDE { return mySurf.IsURational(); } - - virtual Standard_Boolean IsVRational() const Standard_OVERRIDE { return mySurf.IsVRational(); } - - Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE; - - //! Warning : this will make a copy of the - //! BSpline Surface since it applies - //! to it the myTsrf transformation - //! Be Careful when using this method - Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE; - - Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE; - - Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE; - - //! only for SurfaceOfExtrusion and SurfaceOfRevolution - //! Warning: this will make a copy of the underlying curve - //! since it applies to it the transformation - //! myTrsf. Be careful when using this method. - Standard_EXPORT Handle(Adaptor3d_Curve) BasisCurve() const Standard_OVERRIDE; - - Standard_EXPORT Handle(Adaptor3d_Surface) BasisSurface() const Standard_OVERRIDE; + Standard_EXPORT double Tolerance() const; - Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE; + // Note: Most methods are inherited from GeomAdaptor_TransformedSurface. + // The following methods provide access to the underlying surface/transformation: + // - Surface() - returns const GeomAdaptor_Surface& + // - Trsf() - returns const gp_Trsf& + // + // Value, D0, D1, D2, D3, DN methods are inherited and marked as final. + // They apply the transformation automatically. private: - GeomAdaptor_Surface mySurf; - gp_Trsf myTrsf; - TopoDS_Face myFace; + TopoDS_Face myFace; }; #endif // _BRepAdaptor_Surface_HeaderFile diff --git a/opencascade/BRepAlgo.hxx b/opencascade/BRepAlgo.hxx index 77ce75b7b..09575a16b 100644 --- a/opencascade/BRepAlgo.hxx +++ b/opencascade/BRepAlgo.hxx @@ -18,7 +18,8 @@ #define _BRepAlgo_HeaderFile #include -#include +#include +#include class TopoDS_Wire; class TopoDS_Edge; class TopoDS_Face; @@ -36,7 +37,7 @@ public: //! Option can be G1 or C1. Standard_EXPORT static TopoDS_Wire ConcatenateWire(const TopoDS_Wire& Wire, const GeomAbs_Shape Option, - const Standard_Real AngularTolerance = 1.0e-4); + const double AngularTolerance = 1.0e-4); //! this method makes an edge from a wire. //! Junction points between edges of wire may be sharp, @@ -54,38 +55,37 @@ public: //! The new TopoDS_Wire object consisting of edges each representing an arc //! of circle or a linear segment. The accuracy of conversion is defined //! as the maximal tolerance of edges in theWire. - static Standard_EXPORT TopoDS_Wire ConvertWire(const TopoDS_Wire& theWire, - const Standard_Real theAngleTolerance, - const TopoDS_Face& theFace); + static Standard_EXPORT TopoDS_Wire ConvertWire(const TopoDS_Wire& theWire, + const double theAngleTolerance, + const TopoDS_Face& theFace); //! Method of face conversion. The API corresponds to the method ConvertWire. //! This is a shortcut for calling ConvertWire() for each wire in theFace. - static Standard_EXPORT TopoDS_Face ConvertFace(const TopoDS_Face& theFace, - const Standard_Real theAngleTolerance); + static Standard_EXPORT TopoDS_Face ConvertFace(const TopoDS_Face& theFace, + const double theAngleTolerance); - //! Checks if the shape is "correct". If not, returns - //! , else returns . - Standard_EXPORT static Standard_Boolean IsValid(const TopoDS_Shape& S); + //! Checks if the shape is "correct". If not, returns + //! , else returns . + Standard_EXPORT static bool IsValid(const TopoDS_Shape& S); - //! Checks if the Generated and Modified Faces from - //! the shapes in the shape are - //! "correct". The args may be empty, then all faces + //! Checks if the Generated and Modified Faces from + //! the shapes in the shape are + //! "correct". The args may be empty, then all faces //! will be checked. - //! If is True, only closed shape are valid. - //! If is False the geometry of new - //! vertices and edges are not verified and the + //! If is True, only closed shape are valid. + //! If is False the geometry of new + //! vertices and edges are not verified and the //! auto-intersection of new wires are not searched. - Standard_EXPORT static Standard_Boolean IsValid( - const TopTools_ListOfShape& theArgs, - const TopoDS_Shape& theResult, - const Standard_Boolean closedSolid = Standard_False, - const Standard_Boolean GeomCtrl = Standard_True); + Standard_EXPORT static bool IsValid(const NCollection_List& theArgs, + const TopoDS_Shape& theResult, + const bool closedSolid = false, + const bool GeomCtrl = true); //! Checks if the shape is "correct". //! If not, returns FALSE, else returns TRUE. //! This method differs from the previous one in the fact that no geometric controls //! (intersection of wires, pcurve validity) are performed. - Standard_EXPORT static Standard_Boolean IsTopologicallyValid(const TopoDS_Shape& S); + Standard_EXPORT static bool IsTopologicallyValid(const TopoDS_Shape& S); }; #endif // _BRepAlgo_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Algo.hxx b/opencascade/BRepAlgoAPI_Algo.hxx index 0e747260d..4a5b4382f 100644 --- a/opencascade/BRepAlgoAPI_Algo.hxx +++ b/opencascade/BRepAlgoAPI_Algo.hxx @@ -34,7 +34,7 @@ public: //! Returns a shape built by the shape construction algorithm. //! Does not check if the shape is built. - Standard_EXPORT virtual const TopoDS_Shape& Shape() Standard_OVERRIDE; + Standard_EXPORT const TopoDS_Shape& Shape() override; // Provide access to methods of protected base class BOPAlgo_Options // (inherited as protected to avoid problems with SWIG wrapper) @@ -58,12 +58,10 @@ protected: Standard_EXPORT BRepAlgoAPI_Algo(); //! Destructor - Standard_EXPORT virtual ~BRepAlgoAPI_Algo(); + Standard_EXPORT ~BRepAlgoAPI_Algo() override; //! Empty constructor - Standard_EXPORT BRepAlgoAPI_Algo(const Handle(NCollection_BaseAllocator)& theAllocator); - -private: + Standard_EXPORT BRepAlgoAPI_Algo(const occ::handle& theAllocator); }; #endif // _BRepAlgoAPI_Algo_HeaderFile diff --git a/opencascade/BRepAlgoAPI_BooleanOperation.hxx b/opencascade/BRepAlgoAPI_BooleanOperation.hxx index b40170fc2..170747f95 100644 --- a/opencascade/BRepAlgoAPI_BooleanOperation.hxx +++ b/opencascade/BRepAlgoAPI_BooleanOperation.hxx @@ -46,8 +46,8 @@ class TopoDS_Shape; //! - For Boolean operation *SECTION* the arguments can be of any type. //! //! Additionally to the errors of the base class the algorithm returns -//! the following Errors:
-//! - *BOPAlgo_AlertBOPNotSet* - in case the type of Boolean Operation is not set.
+//! the following Errors: +//! - *BOPAlgo_AlertBOPNotSet* - in case the type of Boolean Operation is not set. class BRepAlgoAPI_BooleanOperation : public BRepAlgoAPI_BuilderAlgo { public: @@ -70,10 +70,10 @@ public: //! @name Setting/getting arguments const TopoDS_Shape& Shape2() const { return myTools.First(); } //! Sets the Tool arguments - void SetTools(const TopTools_ListOfShape& theLS) { myTools = theLS; } + void SetTools(const NCollection_List& theLS) { myTools = theLS; } //! Returns the Tools arguments - const TopTools_ListOfShape& Tools() const { return myTools; } + const NCollection_List& Tools() const { return myTools; } public: //! @name Setting/Getting the type of Boolean operation //! Sets the type of Boolean operation @@ -84,8 +84,8 @@ public: //! @name Setting/Getting the type of Boolean operation public: //! @name Performing the operation //! Performs the Boolean operation. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; protected: //! @name Constructors //! Constructor to perform Boolean operation on only two arguments. @@ -102,9 +102,9 @@ protected: //! @name Constructors const BOPAlgo_PaveFiller& thePF, const BOPAlgo_Operation theOperation); -protected: //! @name Fields - TopTools_ListOfShape myTools; //!< Tool arguments of operation - BOPAlgo_Operation myOperation; //!< Type of Boolean Operation +protected: //! @name Fields + NCollection_List myTools; //!< Tool arguments of operation + BOPAlgo_Operation myOperation; //!< Type of Boolean Operation }; #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile diff --git a/opencascade/BRepAlgoAPI_BuilderAlgo.hxx b/opencascade/BRepAlgoAPI_BuilderAlgo.hxx index abc56d6fd..4c0c10fc0 100644 --- a/opencascade/BRepAlgoAPI_BuilderAlgo.hxx +++ b/opencascade/BRepAlgoAPI_BuilderAlgo.hxx @@ -26,12 +26,13 @@ #include #include #include -#include +#include +#include -//! The class contains API level of the General Fuse algorithm.
+//! The class contains API level of the General Fuse algorithm. //! //! Additionally to the options defined in the base class, the algorithm has -//! the following options:
+//! the following options: //! - *Safe processing mode* - allows to avoid modification of the input //! shapes during the operation (by default it is off); //! - *Gluing options* - allows to speed up the calculation of the intersections @@ -43,12 +44,12 @@ //! - *Disabling history collection* - allows disabling the collection of the history //! of shapes modifications during the operation. //! -//! It returns the following Error statuses:
-//! - 0 - in case of success;
+//! It returns the following Error statuses: +//! - 0 - in case of success; //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to perform the -//! operation;
-//! - *BOPAlgo_AlertIntersectionFailed* - in case the intersection of the arguments has failed;
-//! - *BOPAlgo_AlertBuilderFailed* - in case building of the result shape has failed.
+//! operation; +//! - *BOPAlgo_AlertIntersectionFailed* - in case the intersection of the arguments has failed; +//! - *BOPAlgo_AlertBuilderFailed* - in case building of the result shape has failed. //! //! Warnings statuses from underlying DS Filler and Builder algorithms //! are collected in the report. @@ -65,28 +66,40 @@ public: public: //! @name Constructors //! Empty constructor Standard_EXPORT BRepAlgoAPI_BuilderAlgo(); - Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo(); + Standard_EXPORT ~BRepAlgoAPI_BuilderAlgo() override; //! Constructor with prepared Filler object Standard_EXPORT BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& thePF); + //! Copy constructor is not allowed + BRepAlgoAPI_BuilderAlgo(const BRepAlgoAPI_BuilderAlgo&) = delete; + + //! Move constructor is not allowed + BRepAlgoAPI_BuilderAlgo(BRepAlgoAPI_BuilderAlgo&&) = delete; + + //! Copy assignment is not allowed + BRepAlgoAPI_BuilderAlgo& operator=(const BRepAlgoAPI_BuilderAlgo&) = delete; + + //! Move assignment is not allowed + BRepAlgoAPI_BuilderAlgo& operator=(BRepAlgoAPI_BuilderAlgo&&) = delete; + public: //! @name Setting/Getting data for the algorithm //! Sets the arguments - void SetArguments(const TopTools_ListOfShape& theLS) { myArguments = theLS; } + void SetArguments(const NCollection_List& theLS) { myArguments = theLS; } //! Gets the arguments - const TopTools_ListOfShape& Arguments() const { return myArguments; } + const NCollection_List& Arguments() const { return myArguments; } public: //! @name Setting options //! Sets the flag that defines the mode of treatment. //! In non-destructive mode the argument shapes are not modified. Instead //! a copy of a sub-shape is created in the result if it is needed to be updated. - void SetNonDestructive(const Standard_Boolean theFlag) { myNonDestructive = theFlag; } + void SetNonDestructive(const bool theFlag) { myNonDestructive = theFlag; } //! Returns the flag that defines the mode of treatment. //! In non-destructive mode the argument shapes are not modified. Instead //! a copy of a sub-shape is created in the result if it is needed to be updated. - Standard_Boolean NonDestructive() const { return myNonDestructive; } + bool NonDestructive() const { return myNonDestructive; } //! Sets the glue option for the algorithm, //! which allows increasing performance of the intersection @@ -97,16 +110,16 @@ public: //! @name Setting options BOPAlgo_GlueEnum Glue() const { return myGlue; } //! Enables/Disables the check of the input solids for inverted status - void SetCheckInverted(const Standard_Boolean theCheck) { myCheckInverted = theCheck; } + void SetCheckInverted(const bool theCheck) { myCheckInverted = theCheck; } //! Returns the flag defining whether the check for input solids on inverted status //! should be performed or not. - Standard_Boolean CheckInverted() const { return myCheckInverted; } + bool CheckInverted() const { return myCheckInverted; } public: //! @name Performing the operation //! Performs the algorithm - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; public: //! @name Result simplification //! Simplification of the result shape is performed by the means of @@ -132,53 +145,52 @@ public: //! @name Result simplification //! @param theUnifyFaces Controls the faces unification. TRUE by default. //! @param theAngularTol Angular criteria for tangency of edges and faces. //! Precision::Angular() by default. - Standard_EXPORT void SimplifyResult(const Standard_Boolean theUnifyEdges = Standard_True, - const Standard_Boolean theUnifyFaces = Standard_True, - const Standard_Real theAngularTol = Precision::Angular()); + Standard_EXPORT void SimplifyResult(const bool theUnifyEdges = true, + const bool theUnifyFaces = true, + const double theAngularTol = Precision::Angular()); public: //! @name History support //! Returns the shapes modified from the shape . //! If any, the list will contain only those splits of the //! given shape, contained in the result. - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& theS) override; - //! Returns the list of shapes generated from the shape . + //! Returns the list of shapes generated from the shape . //! In frames of Boolean Operations algorithms only Edges and Faces //! could have Generated elements, as only they produce new elements //! during intersection: //! - Edges can generate new vertices; //! - Faces can generate new edges and vertices. - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Generated( + const TopoDS_Shape& theS) override; //! Checks if the shape has been completely removed from the result, //! i.e. the result does not contain the shape itself and any of its splits. //! Returns TRUE if the shape has been deleted. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& aS) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& aS) override; //! Returns true if any of the input shapes has been modified during operation. - Standard_EXPORT virtual Standard_Boolean HasModified() const; + Standard_EXPORT virtual bool HasModified() const; //! Returns true if any of the input shapes has generated shapes during operation. - Standard_EXPORT virtual Standard_Boolean HasGenerated() const; + Standard_EXPORT virtual bool HasGenerated() const; //! Returns true if any of the input shapes has been deleted during operation. //! Normally, General Fuse operation should not have Deleted elements, //! but all derived operation can have. - Standard_EXPORT virtual Standard_Boolean HasDeleted() const; + Standard_EXPORT virtual bool HasDeleted() const; public: //! @name Enabling/Disabling the history collection. //! Allows disabling the history collection - void SetToFillHistory(const Standard_Boolean theHistFlag) { myFillHistory = theHistFlag; } + void SetToFillHistory(const bool theHistFlag) { myFillHistory = theHistFlag; } //! Returns flag of history availability - Standard_Boolean HasHistory() const { return myFillHistory; } + bool HasHistory() const { return myFillHistory; } public: //! @name Getting the section edges //! Returns a list of section edges. //! The edges represent the result of intersection between arguments of operation. - Standard_EXPORT const TopTools_ListOfShape& SectionEdges(); + Standard_EXPORT const NCollection_List& SectionEdges(); public: //! @name Getting tools performing the job //! Returns the Intersection tool @@ -188,7 +200,7 @@ public: //! @name Getting tools performing the job const BOPAlgo_PBuilder& Builder() const { return myBuilder; } //! History tool - Handle(BRepTools_History) History() const { return myFillHistory ? myHistory : NULL; } + occ::handle History() const { return myFillHistory ? myHistory : nullptr; } protected: //! @name Setting options to the Intersection tool //! Sets options (available in child classes) for the intersection tool. @@ -197,37 +209,37 @@ protected: //! @name Setting options to the Intersection tool protected: //! @name Protected methods for shapes intersection and building result //! Intersects the given shapes with the intersection tool - Standard_EXPORT void IntersectShapes(const TopTools_ListOfShape& theArgs, - const Message_ProgressRange& theRange); + Standard_EXPORT void IntersectShapes(const NCollection_List& theArgs, + const Message_ProgressRange& theRange); //! Builds the resulting shape Standard_EXPORT void BuildResult(const Message_ProgressRange& theRange = Message_ProgressRange()); protected: //! @name Clearing the contents of the algorithm //! Clears the algorithm from previous runs - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; protected: //! @name Fields // Inputs - TopTools_ListOfShape myArguments; //!< Arguments of the operation + NCollection_List myArguments; //!< Arguments of the operation // Options - Standard_Boolean myNonDestructive; //!< Non-destructive mode management + bool myNonDestructive; //!< Non-destructive mode management BOPAlgo_GlueEnum myGlue; //!< Gluing mode management - Standard_Boolean myCheckInverted; //!< Check for inverted solids management - Standard_Boolean myFillHistory; //!< Controls the history collection + bool myCheckInverted; //!< Check for inverted solids management + bool myFillHistory; //!< Controls the history collection // Tools - Standard_Boolean myIsIntersectionNeeded; //!< Flag to control whether the intersection - //! of arguments should be performed or not - BOPAlgo_PPaveFiller myDSFiller; //!< Intersection tool performs intersection of the - //! argument shapes. - BOPAlgo_PBuilder myBuilder; //!< Building tool performs construction of the result - //! basing on the results of intersection - Handle(BRepTools_History) myHistory; //!< General History tool, containing all History of - //! shapes modifications during the operation - //! (including result simplification) - Handle(BRepTools_History) mySimplifierHistory; //!< History of result shape simplification + bool myIsIntersectionNeeded; //!< Flag to control whether the intersection + //! of arguments should be performed or not + BOPAlgo_PPaveFiller myDSFiller; //!< Intersection tool performs intersection of the + //! argument shapes. + BOPAlgo_PBuilder myBuilder; //!< Building tool performs construction of the result + //! basing on the results of intersection + occ::handle myHistory; //!< General History tool, containing all History of + //! shapes modifications during the operation + //! (including result simplification) + occ::handle mySimplifierHistory; //!< History of result shape simplification }; #endif // _BRepAlgoAPI_BuilderAlgo_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Check.hxx b/opencascade/BRepAlgoAPI_Check.hxx index 8e73d9beb..0d49fda13 100644 --- a/opencascade/BRepAlgoAPI_Check.hxx +++ b/opencascade/BRepAlgoAPI_Check.hxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -37,12 +37,12 @@ //! The class provides two ways of checking shape(-s) //! 1. Constructors //! BRepAlgoAPI_Check aCh(theS); -//! Standard_Boolean isValid = aCh.IsValid(); +//! bool isValid = aCh.IsValid(); //! 2. Methods SetData and Perform //! BRepAlgoAPI_Check aCh; -//! aCh.SetData(theS1, theS2, BOPAlgo_FUSE, Standard_False); +//! aCh.SetData(theS1, theS2, BOPAlgo_FUSE, false); //! aCh.Perform(); -//! Standard_Boolean isValid = aCh.IsValid(); +//! bool isValid = aCh.IsValid(); //! class BRepAlgoAPI_Check : public BOPAlgo_Options { @@ -52,7 +52,7 @@ public: public: //! @name Constructors //! Empty constructor. Standard_EXPORT BRepAlgoAPI_Check(); - Standard_EXPORT virtual ~BRepAlgoAPI_Check(); + Standard_EXPORT ~BRepAlgoAPI_Check() override; //! Constructor for checking single shape. //! @@ -64,8 +64,8 @@ public: //! @name Constructors //! @param[in] theRange - parameter to use progress indicator Standard_EXPORT BRepAlgoAPI_Check( const TopoDS_Shape& theS, - const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True, + const bool bTestSE = true, + const bool bTestSI = true, const Message_ProgressRange& theRange = Message_ProgressRange()); //! Constructor for checking the couple of shapes. @@ -86,8 +86,8 @@ public: //! @name Constructors const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const BOPAlgo_Operation theOp = BOPAlgo_UNKNOWN, - const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True, + const bool bTestSE = true, + const bool bTestSI = true, const Message_ProgressRange& theRange = Message_ProgressRange()); public: //! @name Initializing the algorithm @@ -98,9 +98,7 @@ public: //! @name Initializing the algorithm //! on small edges or not; by default it is set to TRUE; //! @param[in] bTestSI - flag which specifies whether to check the shape //! on self-interference or not; by default it is set to TRUE; - void SetData(const TopoDS_Shape& theS, - const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True) + void SetData(const TopoDS_Shape& theS, const bool bTestSE = true, const bool bTestSI = true) { myS1 = theS; myS2 = TopoDS_Shape(); @@ -125,8 +123,8 @@ public: //! @name Initializing the algorithm void SetData(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const BOPAlgo_Operation theOp = BOPAlgo_UNKNOWN, - const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True) + const bool bTestSE = true, + const bool bTestSI = true) { myS1 = theS1; myS2 = theS2; @@ -142,23 +140,23 @@ public: //! @name Performing the operation public: //! @name Getting the results. //! Shows whether shape(s) valid or not. - Standard_Boolean IsValid() { return myFaultyShapes.IsEmpty(); } + bool IsValid() { return myFaultyShapes.IsEmpty(); } //! Returns faulty shapes. - const BOPAlgo_ListOfCheckResult& Result() { return myFaultyShapes; } + const NCollection_List& Result() { return myFaultyShapes; } protected: //! @name Fields // Inputs TopoDS_Shape myS1; //!< The first shape TopoDS_Shape myS2; //!< The second shape // clang-format off - Standard_Boolean myTestSE; //!< Flag defining whether to look for small edges in the given shapes or not - Standard_Boolean myTestSI; //!< Flag defining whether to check the input edges on self-interference or not + bool myTestSE; //!< Flag defining whether to look for small edges in the given shapes or not + bool myTestSI; //!< Flag defining whether to check the input edges on self-interference or not BOPAlgo_Operation myOperation; //!< Type of Boolean operation for which the validity of input shapes should be checked // clang-format on // Results - BOPAlgo_ListOfCheckResult myFaultyShapes; //!< Found faulty shapes + NCollection_List myFaultyShapes; //!< Found faulty shapes }; #endif // _BRepAlgoAPI_Check_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Common.hxx b/opencascade/BRepAlgoAPI_Common.hxx index d7c15d66b..4480d0829 100644 --- a/opencascade/BRepAlgoAPI_Common.hxx +++ b/opencascade/BRepAlgoAPI_Common.hxx @@ -33,7 +33,7 @@ public: //! Empty constructor Standard_EXPORT BRepAlgoAPI_Common(); - Standard_EXPORT virtual ~BRepAlgoAPI_Common(); + Standard_EXPORT ~BRepAlgoAPI_Common() override; //! Empty constructor //! - PaveFiller object that is carried out @@ -60,9 +60,6 @@ public: const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF, const Message_ProgressRange& theRange = Message_ProgressRange()); - -protected: -private: }; #endif // _BRepAlgoAPI_Common_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Cut.hxx b/opencascade/BRepAlgoAPI_Cut.hxx index 98d615418..9027931c3 100644 --- a/opencascade/BRepAlgoAPI_Cut.hxx +++ b/opencascade/BRepAlgoAPI_Cut.hxx @@ -33,7 +33,7 @@ public: //! Empty constructor Standard_EXPORT BRepAlgoAPI_Cut(); - Standard_EXPORT virtual ~BRepAlgoAPI_Cut(); + Standard_EXPORT ~BRepAlgoAPI_Cut() override; //! Empty constructor //! - PaveFiller object that is carried out @@ -57,11 +57,8 @@ public: Standard_EXPORT BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, - const Standard_Boolean bFWD = Standard_True, + const bool bFWD = true, const Message_ProgressRange& theRange = Message_ProgressRange()); - -protected: -private: }; #endif // _BRepAlgoAPI_Cut_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Defeaturing.hxx b/opencascade/BRepAlgoAPI_Defeaturing.hxx index 79eb9c313..0dba6b049 100644 --- a/opencascade/BRepAlgoAPI_Defeaturing.hxx +++ b/opencascade/BRepAlgoAPI_Defeaturing.hxx @@ -68,9 +68,9 @@ //! Here is the example of usage of the algorithm: //! ~~~~ //! 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; // De-Featuring algorithm //! aDF.SetShape(aSolid); // Set the shape @@ -105,8 +105,7 @@ public: public: //! @name Constructors //! Empty constructor BRepAlgoAPI_Defeaturing() - : BRepAlgoAPI_Algo(), - myFillHistory(Standard_True) + : myFillHistory(true) { } @@ -125,67 +124,66 @@ public: //! @name Setting input data for the algorithm //! Adds the faces to remove from the input shape. //! @param[in] theFaces The list of shapes to extract the faces for removal. - void AddFacesToRemove(const TopTools_ListOfShape& theFaces) + void AddFacesToRemove(const NCollection_List& theFaces) { - TopTools_ListIteratorOfListOfShape it(theFaces); + NCollection_List::Iterator it(theFaces); for (; it.More(); it.Next()) myFacesToRemove.Append(it.Value()); } //! Returns the list of faces which have been requested for removal //! from the input shape. - const TopTools_ListOfShape& FacesToRemove() const { return myFacesToRemove; } + const NCollection_List& FacesToRemove() const { return myFacesToRemove; } public: //! @name Performing the operation //! Performs the operation - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; public: //! @name History Methods //! Defines whether to track the modification of the shapes or not. - void SetToFillHistory(const Standard_Boolean theFlag) { myFillHistory = theFlag; } + void SetToFillHistory(const bool theFlag) { myFillHistory = theFlag; } //! Returns whether the history was requested or not. - Standard_Boolean HasHistory() const { return myFillHistory; } + bool HasHistory() const { return myFillHistory; } //! Returns the list of shapes modified from the shape during the operation. - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& theS) override; //! Returns the list of shapes generated from the shape during the operation. - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Generated( + const TopoDS_Shape& theS) override; //! Returns true if the shape has been deleted during the operation. //! It means that the shape has no any trace in the result. //! Otherwise it returns false. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& theS) override; //! Returns true if any of the input shapes has been modified during operation. - Standard_EXPORT virtual Standard_Boolean HasModified() const; + Standard_EXPORT virtual bool HasModified() const; //! Returns true if any of the input shapes has generated shapes during operation. - Standard_EXPORT virtual Standard_Boolean HasGenerated() const; + Standard_EXPORT virtual bool HasGenerated() const; //! Returns true if any of the input shapes has been deleted during operation. - Standard_EXPORT virtual Standard_Boolean HasDeleted() const; + Standard_EXPORT virtual bool HasDeleted() const; //! Returns the History of shapes modifications - Handle(BRepTools_History) History() { return myFeatureRemovalTool.History(); } + occ::handle History() { return myFeatureRemovalTool.History(); } protected: //! @name Setting the algorithm into default state - virtual void Clear() Standard_OVERRIDE + void Clear() override { BRepAlgoAPI_Algo::Clear(); myFeatureRemovalTool.Clear(); } -protected: //! @name Fields - TopoDS_Shape myInputShape; //!< Input shape to remove the features from - TopTools_ListOfShape myFacesToRemove; //!< Features to remove from the shape - Standard_Boolean myFillHistory; //!< Defines whether to track the history of - //! shapes modifications or not (true by default) - BOPAlgo_RemoveFeatures myFeatureRemovalTool; //!< Tool for the features removal +protected: //! @name Fields + TopoDS_Shape myInputShape; //!< Input shape to remove the features from + NCollection_List myFacesToRemove; //!< Features to remove from the shape + bool myFillHistory; //!< Defines whether to track the history of + //! shapes modifications or not (true by default) + BOPAlgo_RemoveFeatures myFeatureRemovalTool; //!< Tool for the features removal }; #endif // _BRepAlgoAPI_Defeaturing_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Fuse.hxx b/opencascade/BRepAlgoAPI_Fuse.hxx index d87e78b89..5afb77443 100644 --- a/opencascade/BRepAlgoAPI_Fuse.hxx +++ b/opencascade/BRepAlgoAPI_Fuse.hxx @@ -25,7 +25,7 @@ class BOPAlgo_PaveFiller; class TopoDS_Shape; //! The class provides Boolean fusion operation -//! between arguments and tools (Boolean Union). +//! between arguments and tools (Boolean Union). class BRepAlgoAPI_Fuse : public BRepAlgoAPI_BooleanOperation { public: @@ -33,7 +33,7 @@ public: //! Empty constructor Standard_EXPORT BRepAlgoAPI_Fuse(); - Standard_EXPORT virtual ~BRepAlgoAPI_Fuse(); + Standard_EXPORT ~BRepAlgoAPI_Fuse() override; //! Empty constructor //! - PaveFiller object that is carried out @@ -58,9 +58,6 @@ public: const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, const Message_ProgressRange& theRange = Message_ProgressRange()); - -protected: -private: }; #endif // _BRepAlgoAPI_Fuse_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Section.hxx b/opencascade/BRepAlgoAPI_Section.hxx index c768bf42e..dd222b076 100644 --- a/opencascade/BRepAlgoAPI_Section.hxx +++ b/opencascade/BRepAlgoAPI_Section.hxx @@ -42,7 +42,7 @@ public: //! Empty constructor Standard_EXPORT BRepAlgoAPI_Section(); - Standard_EXPORT virtual ~BRepAlgoAPI_Section(); + Standard_EXPORT ~BRepAlgoAPI_Section() override; //! Empty constructor //! - PaveFiller object that is carried out @@ -54,9 +54,9 @@ public: //! - the flag: //! if =True - the algorithm is performed immediately //! Obsolete - Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - const Standard_Boolean PerformNow = Standard_True); + Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + const bool PerformNow = true); //! Constructor with two shapes //! -argument @@ -68,7 +68,7 @@ public: Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, - const Standard_Boolean PerformNow = Standard_True); + const bool PerformNow = true); //! Constructor with two shapes //! - argument @@ -76,9 +76,9 @@ public: //! - the flag: //! if =True - the algorithm is performed immediately //! Obsolete - Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, - const gp_Pln& Pl, - const Standard_Boolean PerformNow = Standard_True); + Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, + const gp_Pln& Pl, + const bool PerformNow = true); //! Constructor with two shapes //! - argument @@ -86,9 +86,9 @@ public: //! - the flag: //! if =True - the algorithm is performed immediately //! Obsolete - Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, - const Handle(Geom_Surface)& Sf, - const Standard_Boolean PerformNow = Standard_True); + Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, + const occ::handle& Sf, + const bool PerformNow = true); //! Constructor with two shapes //! - argument @@ -96,9 +96,9 @@ public: //! - the flag: //! if =True - the algorithm is performed immediately //! Obsolete - Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf, - const TopoDS_Shape& S2, - const Standard_Boolean PerformNow = Standard_True); + Standard_EXPORT BRepAlgoAPI_Section(const occ::handle& Sf, + const TopoDS_Shape& S2, + const bool PerformNow = true); //! Constructor with two shapes //! - argument @@ -106,9 +106,9 @@ public: //! - the flag: //! if =True - the algorithm is performed immediately //! Obsolete - Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1, - const Handle(Geom_Surface)& Sf2, - const Standard_Boolean PerformNow = Standard_True); + Standard_EXPORT BRepAlgoAPI_Section(const occ::handle& Sf1, + const occ::handle& Sf2, + const bool PerformNow = true); //! initialize the argument //! - argument @@ -123,7 +123,7 @@ public: //! initialize the argument //! - argument //! Obsolete - Standard_EXPORT void Init1(const Handle(Geom_Surface)& Sf); + Standard_EXPORT void Init1(const occ::handle& Sf); //! initialize the tool //! - tool @@ -138,9 +138,9 @@ public: //! initialize the tool //! - tool //! Obsolete - Standard_EXPORT void Init2(const Handle(Geom_Surface)& Sf); + Standard_EXPORT void Init2(const occ::handle& Sf); - Standard_EXPORT void Approximation(const Standard_Boolean B); + Standard_EXPORT void Approximation(const bool B); //! Indicates whether the P-Curve should be (or not) //! performed on the argument. @@ -150,7 +150,7 @@ public: //! to attach an P-Curve in the parametric space of the argument //! to the constructed edges. //! Obsolete - Standard_EXPORT void ComputePCurveOn1(const Standard_Boolean B); + Standard_EXPORT void ComputePCurveOn1(const bool B); //! Indicates whether the P-Curve should be (or not) //! performed on the tool. @@ -160,13 +160,13 @@ public: //! to attach an P-Curve in the parametric space of the tool //! to the constructed edges. //! Obsolete - Standard_EXPORT void ComputePCurveOn2(const Standard_Boolean B); + Standard_EXPORT void ComputePCurveOn2(const bool B); //! Performs the algorithm //! Filling interference Data Structure (if it is necessary) //! Building the result of the operation. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! get the face of the first part giving section edge . //! Returns True on the 3 following conditions : @@ -176,7 +176,7 @@ public: //! is not the result of common edges) //! When False, F remains untouched. //! Obsolete - Standard_EXPORT Standard_Boolean HasAncestorFaceOn1(const TopoDS_Shape& E, TopoDS_Shape& F) const; + Standard_EXPORT bool HasAncestorFaceOn1(const TopoDS_Shape& E, TopoDS_Shape& F) const; //! Identifies the ancestor faces of //! the intersection edge E resulting from the last @@ -197,17 +197,17 @@ public: //! Boolean value before using the ancestor face: F is significant //! only if the returned Boolean value equals true. //! Obsolete - Standard_EXPORT Standard_Boolean HasAncestorFaceOn2(const TopoDS_Shape& E, TopoDS_Shape& F) const; + Standard_EXPORT bool HasAncestorFaceOn2(const TopoDS_Shape& E, TopoDS_Shape& F) const; protected: - Standard_EXPORT void Init(const Standard_Boolean PerformNow); + Standard_EXPORT void Init(const bool PerformNow); - Standard_EXPORT virtual void SetAttributes() Standard_OVERRIDE; + Standard_EXPORT void SetAttributes() override; private: - Standard_Boolean myApprox; - Standard_Boolean myComputePCurve1; - Standard_Boolean myComputePCurve2; + bool myApprox; + bool myComputePCurve1; + bool myComputePCurve2; }; #endif // _BRepAlgoAPI_Section_HeaderFile diff --git a/opencascade/BRepAlgoAPI_Splitter.hxx b/opencascade/BRepAlgoAPI_Splitter.hxx index dfb5c28a9..983d298bb 100644 --- a/opencascade/BRepAlgoAPI_Splitter.hxx +++ b/opencascade/BRepAlgoAPI_Splitter.hxx @@ -23,30 +23,30 @@ //! The class contains API level of the **Splitter** algorithm, //! which allows splitting a group of arbitrary shapes by the -//! other group of arbitrary shapes.
-//! The arguments of the operation are divided on two groups:
-//! *Objects* - shapes that will be split;
-//! *Tools* - shapes by which the *Objects* will be split.
+//! other group of arbitrary shapes. +//! The arguments of the operation are divided on two groups: +//! *Objects* - shapes that will be split; +//! *Tools* - shapes by which the *Objects* will be split. //! The result of the operation contains only the split parts -//! of the shapes from the group of *Objects*.
+//! of the shapes from the group of *Objects*. //! The split parts of the shapes from the group of *Tools* are excluded -//! from the result.
+//! from the result. //! The shapes can be split by the other shapes from the same group //! (in case these shapes are interfering). //! //! The class is a General Fuse based algorithm. Thus, all options //! of the General Fuse algorithm such as Fuzzy mode, safe processing mode, //! parallel processing mode, gluing mode and history support are also -//! available in this algorithm.
+//! available in this algorithm. //! There is no requirement on the existence of the *Tools* shapes. //! And if there are no *Tools* shapes, the result of the splitting //! operation will be equivalent to the General Fuse result. //! -//! The algorithm returns the following Error statuses:
-//! - 0 - in case of success;
+//! The algorithm returns the following Error statuses: +//! - 0 - in case of success; //! - *BOPAlgo_AlertTooFewArguments* - in case there is no enough arguments for the -//! operation;
-//! - *BOPAlgo_AlertIntersectionFailed* - in case the Intersection of the arguments has failed;
+//! operation; +//! - *BOPAlgo_AlertIntersectionFailed* - in case the Intersection of the arguments has failed; //! - *BOPAlgo_AlertBuilderFailed* - in case the Building of the result has failed. class BRepAlgoAPI_Splitter : public BRepAlgoAPI_BuilderAlgo { @@ -62,20 +62,20 @@ public: //! @name Constructors public: //! @name Setters/Getters for the Tools //! Sets the Tool arguments - void SetTools(const TopTools_ListOfShape& theLS) { myTools = theLS; } + void SetTools(const NCollection_List& theLS) { myTools = theLS; } //! Returns the Tool arguments - const TopTools_ListOfShape& Tools() const { return myTools; } + const NCollection_List& Tools() const { return myTools; } public: //! @name Performing the operation //! Performs the Split operation. //! Performs the intersection of the argument shapes (both objects and tools) //! and splits objects by the tools. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; -protected: //! @name Fields - TopTools_ListOfShape myTools; //!< Tool arguments of the operation +protected: //! @name Fields + NCollection_List myTools; //!< Tool arguments of the operation }; #endif // _BRepAlgoAPI_Splitter_HeaderFile diff --git a/opencascade/BRepAlgo_AsDes.hxx b/opencascade/BRepAlgo_AsDes.hxx index 709e0b287..00fc0a86e 100644 --- a/opencascade/BRepAlgo_AsDes.hxx +++ b/opencascade/BRepAlgo_AsDes.hxx @@ -19,14 +19,13 @@ #include -#include +#include +#include +#include +#include #include -#include class TopoDS_Shape; -class BRepAlgo_AsDes; -DEFINE_STANDARD_HANDLE(BRepAlgo_AsDes, Standard_Transient) - //! SD to store descendants and ascendants of Shapes. class BRepAlgo_AsDes : public Standard_Transient { @@ -41,20 +40,20 @@ public: Standard_EXPORT void Add(const TopoDS_Shape& S, const TopoDS_Shape& SS); //! Stores as futurs SubShapes of . - Standard_EXPORT void Add(const TopoDS_Shape& S, const TopTools_ListOfShape& SS); + Standard_EXPORT void Add(const TopoDS_Shape& S, const NCollection_List& SS); - Standard_EXPORT Standard_Boolean HasAscendant(const TopoDS_Shape& S) const; + Standard_EXPORT bool HasAscendant(const TopoDS_Shape& S) const; - Standard_EXPORT Standard_Boolean HasDescendant(const TopoDS_Shape& S) const; + Standard_EXPORT bool HasDescendant(const TopoDS_Shape& S) const; //! Returns the Shape containing . - Standard_EXPORT const TopTools_ListOfShape& Ascendant(const TopoDS_Shape& S) const; + Standard_EXPORT const NCollection_List& Ascendant(const TopoDS_Shape& S) const; //! Returns futur subhapes of . - Standard_EXPORT const TopTools_ListOfShape& Descendant(const TopoDS_Shape& S) const; + Standard_EXPORT const NCollection_List& Descendant(const TopoDS_Shape& S) const; //! Returns futur subhapes of . - Standard_EXPORT TopTools_ListOfShape& ChangeDescendant(const TopoDS_Shape& S); + Standard_EXPORT NCollection_List& ChangeDescendant(const TopoDS_Shape& S); //! Replace theOldS by theNewS. //! theOldS disappear from this. @@ -63,25 +62,25 @@ public: //! Remove theS from me. Standard_EXPORT void Remove(const TopoDS_Shape& theS); - //! Returns True if (S1> and has common - //! Descendants. Stores in the Commons Descendants. - Standard_EXPORT Standard_Boolean HasCommonDescendant(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - TopTools_ListOfShape& LC) const; + //! Returns True if (S1> and has common + //! Descendants. Stores in the Commons Descendants. + Standard_EXPORT bool HasCommonDescendant(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + NCollection_List& LC) const; DEFINE_STANDARD_RTTIEXT(BRepAlgo_AsDes, Standard_Transient) private: //! Replace theOldS by theNewS. //! theOldS disappear from this. - Standard_EXPORT void BackReplace(const TopoDS_Shape& theOldS, - const TopoDS_Shape& theNewS, - const TopTools_ListOfShape& theL, - const Standard_Boolean theInUp); + Standard_EXPORT void BackReplace(const TopoDS_Shape& theOldS, + const TopoDS_Shape& theNewS, + const NCollection_List& theL, + const bool theInUp); private: - TopTools_DataMapOfShapeListOfShape up; - TopTools_DataMapOfShapeListOfShape down; + NCollection_DataMap, TopTools_ShapeMapHasher> up; + NCollection_DataMap, TopTools_ShapeMapHasher> down; }; #endif // _BRepAlgo_AsDes_HeaderFile diff --git a/opencascade/BRepAlgo_FaceRestrictor.hxx b/opencascade/BRepAlgo_FaceRestrictor.hxx index 16d23d37c..26841b67f 100644 --- a/opencascade/BRepAlgo_FaceRestrictor.hxx +++ b/opencascade/BRepAlgo_FaceRestrictor.hxx @@ -21,13 +21,16 @@ #include #include -#include +#include +#include +#include +#include class TopoDS_Wire; -//! Builds all the faces limited with a set of non -//! jointing and planars wires. if -//! is false The Wires must have -//! correct orientations. Sinon orientation des wires +//! Builds all the faces limited with a set of non +//! jointing and planars wires. +//! if is false The Wires must have +//! correct orientations. Sinon orientation des wires //! de telle sorte que les faces ne soient pas infinies //! et qu'elles soient disjointes. class BRepAlgo_FaceRestrictor @@ -41,9 +44,9 @@ public: //! faces built. //! is used to update pcurves on edges if necessary. //! See Add(). - Standard_EXPORT void Init(const TopoDS_Face& F, - const Standard_Boolean Proj = Standard_False, - const Standard_Boolean ControlOrientation = Standard_False); + Standard_EXPORT void Init(const TopoDS_Face& F, + const bool Proj = false, + const bool ControlOrientation = false); //! Add the wire to the set of wires. //! @@ -64,27 +67,28 @@ public: //! Evaluate all the faces limited by the set of Wires. Standard_EXPORT void Perform(); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean More() const; + Standard_EXPORT bool More() const; Standard_EXPORT void Next(); Standard_EXPORT TopoDS_Face Current() const; -protected: private: //! Evaluate all the faces limited by the set of Wires. Standard_EXPORT void PerformWithCorrection(); - Standard_Boolean myDone; - Standard_Boolean modeProj; - TopoDS_Face myFace; - TopTools_ListOfShape wires; - TopTools_ListOfShape faces; - Standard_Boolean myCorrection; - TopTools_DataMapOfShapeListOfShape keyIsIn; - TopTools_DataMapOfShapeListOfShape keyContains; + bool myDone; + bool modeProj; + TopoDS_Face myFace; + NCollection_List wires; + NCollection_List faces; + bool myCorrection; + NCollection_DataMap, TopTools_ShapeMapHasher> + keyIsIn; + NCollection_DataMap, TopTools_ShapeMapHasher> + keyContains; }; #endif // _BRepAlgo_FaceRestrictor_HeaderFile diff --git a/opencascade/BRepAlgo_Image.hxx b/opencascade/BRepAlgo_Image.hxx index f95e23063..f9cfe3182 100644 --- a/opencascade/BRepAlgo_Image.hxx +++ b/opencascade/BRepAlgo_Image.hxx @@ -21,9 +21,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #include #include class TopoDS_Shape; @@ -43,13 +44,13 @@ public: Standard_EXPORT void Bind(const TopoDS_Shape& OldS, const TopoDS_Shape& NewS); //! Links as image of . - Standard_EXPORT void Bind(const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS); + Standard_EXPORT void Bind(const TopoDS_Shape& OldS, const NCollection_List& NewS); //! Add to the image of . Standard_EXPORT void Add(const TopoDS_Shape& OldS, const TopoDS_Shape& NewS); //! Add to the image of . - Standard_EXPORT void Add(const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS); + Standard_EXPORT void Add(const TopoDS_Shape& OldS, const NCollection_List& NewS); Standard_EXPORT void Clear(); @@ -64,9 +65,9 @@ public: //! The is removed. Standard_EXPORT void ReplaceRoot(const TopoDS_Shape& OldRoot, const TopoDS_Shape& NewRoot); - Standard_EXPORT const TopTools_ListOfShape& Roots() const; + Standard_EXPORT const NCollection_List& Roots() const; - Standard_EXPORT Standard_Boolean IsImage(const TopoDS_Shape& S) const; + Standard_EXPORT bool IsImage(const TopoDS_Shape& S) const; //! Returns the generator of Standard_EXPORT const TopoDS_Shape& ImageFrom(const TopoDS_Shape& S) const; @@ -74,29 +75,28 @@ public: //! Returns the upper generator of Standard_EXPORT const TopoDS_Shape& Root(const TopoDS_Shape& S) const; - Standard_EXPORT Standard_Boolean HasImage(const TopoDS_Shape& S) const; + Standard_EXPORT bool HasImage(const TopoDS_Shape& S) const; //! Returns the Image of . //! Returns in the list if HasImage(S) is false. - Standard_EXPORT const TopTools_ListOfShape& Image(const TopoDS_Shape& S) const; + Standard_EXPORT const NCollection_List& Image(const TopoDS_Shape& S) const; //! Stores in the images of images of...images of . - //! contains only if HasImage(S) is false. - Standard_EXPORT void LastImage(const TopoDS_Shape& S, TopTools_ListOfShape& L) const; + //! contains only if HasImage(S) is false. + Standard_EXPORT void LastImage(const TopoDS_Shape& S, NCollection_List& L) const; //! Keeps only the link between roots and lastimage. Standard_EXPORT void Compact(); //! Deletes in the images the shape of type //! which are not in . - //! Warning: Compact() must be call before. + //! Warning: Compact() must be call before. Standard_EXPORT void Filter(const TopoDS_Shape& S, const TopAbs_ShapeEnum ShapeType); -protected: private: - TopTools_ListOfShape roots; - TopTools_DataMapOfShapeShape up; - TopTools_DataMapOfShapeListOfShape down; + NCollection_List roots; + NCollection_DataMap up; + NCollection_DataMap, TopTools_ShapeMapHasher> down; }; #endif // _BRepAlgo_Image_HeaderFile diff --git a/opencascade/BRepAlgo_Loop.hxx b/opencascade/BRepAlgo_Loop.hxx index e0859686b..591600690 100644 --- a/opencascade/BRepAlgo_Loop.hxx +++ b/opencascade/BRepAlgo_Loop.hxx @@ -21,9 +21,11 @@ #include #include -#include -#include -#include +#include +#include +#include +#include +#include #include class TopoDS_Edge; @@ -41,13 +43,13 @@ public: //! Add E with . will be copied and trim //! by vertices in . - Standard_EXPORT void AddEdge(TopoDS_Edge& E, const TopTools_ListOfShape& LV); + Standard_EXPORT void AddEdge(TopoDS_Edge& E, const NCollection_List& LV); //! Add as const edge, E can be in the result. Standard_EXPORT void AddConstEdge(const TopoDS_Edge& E); //! Add as a set of const edges. - Standard_EXPORT void AddConstEdges(const TopTools_ListOfShape& LE); + Standard_EXPORT void AddConstEdges(const NCollection_List& LE); //! Sets the Image Vertex - Vertex Standard_EXPORT void SetImageVV(const BRepAlgo_Image& theImageVV); @@ -56,17 +58,19 @@ public: Standard_EXPORT void Perform(); //! Update VE map according to Image Vertex - Vertex - Standard_EXPORT void UpdateVEmap(TopTools_IndexedDataMapOfShapeListOfShape& theVEmap); + Standard_EXPORT void UpdateVEmap(NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theVEmap); - //! Cut the edge in several edges on the + //! Cut the edge in several edges on the //! vertices. - Standard_EXPORT void CutEdge(const TopoDS_Edge& E, - const TopTools_ListOfShape& VonE, - TopTools_ListOfShape& NE) const; + Standard_EXPORT void CutEdge(const TopoDS_Edge& E, + const NCollection_List& VonE, + NCollection_List& NE) const; //! Returns the list of wires performed. //! can be an empty list. - Standard_EXPORT const TopTools_ListOfShape& NewWires() const; + Standard_EXPORT const NCollection_List& NewWires() const; //! Build faces from the wires result. Standard_EXPORT void WiresToFaces(); @@ -74,35 +78,38 @@ public: //! Returns the list of faces. //! Warning: The method as to be called before. //! can be an empty list. - Standard_EXPORT const TopTools_ListOfShape& NewFaces() const; + Standard_EXPORT const NCollection_List& NewFaces() const; //! Returns the list of new edges built from an edge //! it can be an empty list. - Standard_EXPORT const TopTools_ListOfShape& NewEdges(const TopoDS_Edge& E) const; + Standard_EXPORT const NCollection_List& NewEdges(const TopoDS_Edge& E) const; //! Returns the datamap of vertices with their substitutes. - Standard_EXPORT void GetVerticesForSubstitute(TopTools_DataMapOfShapeShape& VerVerMap) const; + Standard_EXPORT void GetVerticesForSubstitute( + NCollection_DataMap& VerVerMap) const; - Standard_EXPORT void VerticesForSubstitute(TopTools_DataMapOfShapeShape& VerVerMap); + Standard_EXPORT void VerticesForSubstitute( + NCollection_DataMap& VerVerMap); //! Set maximal tolerance used for comparing distances between vertices. - void SetTolConf(const Standard_Real theTolConf) { myTolConf = theTolConf; } + void SetTolConf(const double theTolConf) { myTolConf = theTolConf; } //! Get maximal tolerance used for comparing distances between vertices. - Standard_Real GetTolConf() const { return myTolConf; } + double GetTolConf() const { return myTolConf; } -protected: private: - TopoDS_Face myFace; - TopTools_ListOfShape myConstEdges; - TopTools_ListOfShape myEdges; - TopTools_DataMapOfShapeListOfShape myVerOnEdges; - TopTools_ListOfShape myNewWires; - TopTools_ListOfShape myNewFaces; - TopTools_DataMapOfShapeListOfShape myCutEdges; - TopTools_DataMapOfShapeShape myVerticesForSubstitute; - BRepAlgo_Image myImageVV; - Standard_Real myTolConf; + TopoDS_Face myFace; + NCollection_List myConstEdges; + NCollection_List myEdges; + NCollection_DataMap, TopTools_ShapeMapHasher> + myVerOnEdges; + NCollection_List myNewWires; + NCollection_List myNewFaces; + NCollection_DataMap, TopTools_ShapeMapHasher> + myCutEdges; + NCollection_DataMap myVerticesForSubstitute; + BRepAlgo_Image myImageVV; + double myTolConf; }; #endif // _BRepAlgo_Loop_HeaderFile diff --git a/opencascade/BRepAlgo_NormalProjection.hxx b/opencascade/BRepAlgo_NormalProjection.hxx index f5508e037..1b9263f34 100644 --- a/opencascade/BRepAlgo_NormalProjection.hxx +++ b/opencascade/BRepAlgo_NormalProjection.hxx @@ -23,13 +23,13 @@ #include #include #include -#include -#include -#include +#include +#include +#include class TopoDS_Edge; class Adaptor3d_Curve; -//! This class makes the projection of a wire on a +//! This class makes the projection of a wire on a //! shape. class BRepAlgo_NormalProjection { @@ -45,20 +45,20 @@ public: //! Add an edge or a wire to the list of shape to project Standard_EXPORT void Add(const TopoDS_Shape& ToProj); - //! Set the parameters used for computation - //! Tol3d is the required tolerance between the 3d projected - //! curve and its 2d representation - //! InternalContinuity is the order of constraints - //! used for approximation. + //! Set the parameters used for computation + //! Tol3d is the required tolerance between the 3d projected + //! curve and its 2d representation + //! InternalContinuity is the order of constraints + //! used for approximation. //! MaxDeg and MaxSeg are the maximum degree and the maximum //! number of segment for BSpline resulting of an approximation. - Standard_EXPORT void SetParams(const Standard_Real Tol3D, - const Standard_Real Tol2D, - const GeomAbs_Shape InternalContinuity, - const Standard_Integer MaxDegree, - const Standard_Integer MaxSeg); + Standard_EXPORT void SetParams(const double Tol3D, + const double Tol2D, + const GeomAbs_Shape InternalContinuity, + const int MaxDegree, + const int MaxSeg); - //! Set the parameters used for computation + //! Set the parameters used for computation //! in their default values Standard_EXPORT void SetDefaultParams(); @@ -66,19 +66,19 @@ public: //! shape to project. If this condition is not satisfied then //! corresponding part of solution is discarded. //! if MaxDist < 0 then this method does not affect the algorithm - Standard_EXPORT void SetMaxDistance(const Standard_Real MaxDist); + Standard_EXPORT void SetMaxDistance(const double MaxDist); - //! if With3d = Standard_False the 3dcurve is not computed - //! the initial 3dcurve is kept to build the resulting edges. - Standard_EXPORT void Compute3d(const Standard_Boolean With3d = Standard_True); + //! if With3d = false the 3dcurve is not computed + //! the initial 3dcurve is kept to build the resulting edges. + Standard_EXPORT void Compute3d(const bool With3d = true); - //! Manage limitation of projected edges. - Standard_EXPORT void SetLimit(const Standard_Boolean FaceBoundaries = Standard_True); + //! Manage limitation of projected edges. + Standard_EXPORT void SetLimit(const bool FaceBoundaries = true); - //! Builds the result as a compound. + //! Builds the result as a compound. Standard_EXPORT void Build(); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result Standard_EXPORT const TopoDS_Shape& Projection() const; @@ -89,33 +89,33 @@ public: //! For a projected edge, returns the corresponding initial face. Standard_EXPORT const TopoDS_Shape& Couple(const TopoDS_Edge& E) const; - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S); + Standard_EXPORT const NCollection_List& Generated(const TopoDS_Shape& S); - Standard_EXPORT Standard_Boolean IsElementary(const Adaptor3d_Curve& C) const; + Standard_EXPORT bool IsElementary(const Adaptor3d_Curve& C) const; //! build the result as a list of wire if possible in -- //! a first returns a wire only if there is only a wire. - Standard_EXPORT Standard_Boolean BuildWire(TopTools_ListOfShape& Liste) const; + Standard_EXPORT bool BuildWire(NCollection_List& Liste) const; -protected: private: - TopoDS_Shape myShape; - Standard_Boolean myIsDone; - Standard_Real myTol3d; - Standard_Real myTol2d; - Standard_Real myMaxDist; - Standard_Boolean myWith3d; - GeomAbs_Shape myContinuity; - Standard_Integer myMaxDegree; - Standard_Integer myMaxSeg; - Standard_Boolean myFaceBounds; - TopoDS_Shape myToProj; - TopTools_DataMapOfShapeShape myAncestorMap; - TopTools_DataMapOfShapeShape myCorresp; - TopTools_DataMapOfShapeListOfShape myDescendants; - TopoDS_Shape myRes; + TopoDS_Shape myShape; + bool myIsDone; + double myTol3d; + double myTol2d; + double myMaxDist; + bool myWith3d; + GeomAbs_Shape myContinuity; + int myMaxDegree; + int myMaxSeg; + bool myFaceBounds; + TopoDS_Shape myToProj; + NCollection_DataMap myAncestorMap; + NCollection_DataMap myCorresp; + NCollection_DataMap, TopTools_ShapeMapHasher> + myDescendants; + TopoDS_Shape myRes; }; #endif // _BRepAlgo_NormalProjection_HeaderFile diff --git a/opencascade/BRepApprox_Approx.hxx b/opencascade/BRepApprox_Approx.hxx index 4c0d8ba53..adaa2e687 100644 --- a/opencascade/BRepApprox_Approx.hxx +++ b/opencascade/BRepApprox_Approx.hxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ private: struct Approx_Data { Approx_Data() - : myBezierApprox(Standard_True), + : myBezierApprox(true), Xo(0.0), Yo(0.0), Zo(0.0), @@ -62,9 +62,9 @@ private: V1o(0.0), U2o(0.0), V2o(0.0), - ApproxXYZ(Standard_True), - ApproxU1V1(Standard_True), - ApproxU2V2(Standard_True), + ApproxXYZ(true), + ApproxU1V1(true), + ApproxU2V2(true), indicemin(0), indicemax(0), myNbPntMax(30), @@ -72,10 +72,10 @@ private: { } - Standard_Boolean myBezierApprox; - Standard_Real Xo, Yo, Zo, U1o, V1o, U2o, V2o; - Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2; - Standard_Integer indicemin, indicemax, myNbPntMax; + bool myBezierApprox; + double Xo, Yo, Zo, U1o, V1o, U2o, V2o; + bool ApproxXYZ, ApproxU1V1, ApproxU2V2; + int indicemin, indicemax, myNbPntMax; Approx_ParametrizationType parametrization; }; @@ -84,95 +84,94 @@ public: Standard_EXPORT BRepApprox_Approx(); - Standard_EXPORT void Perform(const BRepAdaptor_Surface& Surf1, - const BRepAdaptor_Surface& Surf2, - const Handle(BRepApprox_ApproxLine)& aLine, - const Standard_Boolean ApproxXYZ = Standard_True, - const Standard_Boolean ApproxU1V1 = Standard_True, - const Standard_Boolean ApproxU2V2 = Standard_True, - const Standard_Integer indicemin = 0, - const Standard_Integer indicemax = 0); - - Standard_EXPORT void Perform(const Handle(BRepApprox_ApproxLine)& aLine, - const Standard_Boolean ApproxXYZ = Standard_True, - const Standard_Boolean ApproxU1V1 = Standard_True, - const Standard_Boolean ApproxU2V2 = Standard_True, - const Standard_Integer indicemin = 0, - const Standard_Integer indicemax = 0); + Standard_EXPORT void Perform(const BRepAdaptor_Surface& Surf1, + const BRepAdaptor_Surface& Surf2, + const occ::handle& aLine, + const bool ApproxXYZ = true, + const bool ApproxU1V1 = true, + const bool ApproxU2V2 = true, + const int indicemin = 0, + const int indicemax = 0); + + Standard_EXPORT void Perform(const occ::handle& aLine, + const bool ApproxXYZ = true, + const bool ApproxU1V1 = true, + const bool ApproxU2V2 = true, + const int indicemin = 0, + const int indicemax = 0); Standard_EXPORT void SetParameters( - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer DegMin, - const Standard_Integer DegMax, - const Standard_Integer NbIterMax, - const Standard_Integer NbPntMax = 30, - const Standard_Boolean ApproxWithTangency = Standard_True, + const double Tol3d, + const double Tol2d, + const int DegMin, + const int DegMax, + const int NbIterMax, + const int NbPntMax = 30, + const bool ApproxWithTangency = true, const Approx_ParametrizationType Parametrization = Approx_ChordLength); Standard_EXPORT void Perform(); - Standard_EXPORT Standard_Real TolReached3d() const; + Standard_EXPORT double TolReached3d() const; - Standard_EXPORT Standard_Real TolReached2d() const; + Standard_EXPORT double TolReached2d() const; - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; - Standard_EXPORT const AppParCurves_MultiBSpCurve& Value(const Standard_Integer Index) const; + Standard_EXPORT const AppParCurves_MultiBSpCurve& Value(const int Index) const; Standard_EXPORT static void Parameters(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer firstP, - const Standard_Integer lastP, + const int firstP, + const int lastP, const Approx_ParametrizationType Par, math_Vector& TheParameters); -protected: private: - Standard_EXPORT void Perform(const IntSurf_Quadric& Surf1, - const BRepAdaptor_Surface& Surf2, - const Handle(BRepApprox_ApproxLine)& aLine, - const Standard_Boolean ApproxXYZ, - const Standard_Boolean ApproxU1V1, - const Standard_Boolean ApproxU2V2, - const Standard_Integer indicemin, - const Standard_Integer indicemax, - const Standard_Boolean isTheQuadFirst); + Standard_EXPORT void Perform(const IntSurf_Quadric& Surf1, + const BRepAdaptor_Surface& Surf2, + const occ::handle& aLine, + const bool ApproxXYZ, + const bool ApproxU1V1, + const bool ApproxU2V2, + const int indicemin, + const int indicemax, + const bool isTheQuadFirst); Standard_EXPORT void UpdateTolReached(); //! Fill data structure for intersection approximation. - Standard_EXPORT void fillData(const Handle(BRepApprox_ApproxLine)& theLine); + Standard_EXPORT void fillData(const occ::handle& theLine); //! Prepare data structure for further computations. - Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ, - const Standard_Boolean theApproxU1V1, - const Standard_Boolean theApproxU2V2, - const Standard_Integer indicemin, - const Standard_Integer indicemax); + Standard_EXPORT void prepareDS(const bool theApproxXYZ, + const bool theApproxU1V1, + const bool theApproxU2V2, + const int indicemin, + const int indicemax); //! Build knot sequence. - Standard_EXPORT void buildKnots(const Handle(BRepApprox_ApproxLine)& theline, - const Standard_Address thePtrSVSurf); + Standard_EXPORT void buildKnots(const occ::handle& theline, + void* const thePtrSVSurf); //! Build curve. - Standard_EXPORT void buildCurve(const Handle(BRepApprox_ApproxLine)& theline, - const Standard_Address thePtrSVSurf); + Standard_EXPORT void buildCurve(const occ::handle& theline, + void* const thePtrSVSurf); BRepApprox_TheComputeLineOfApprox myComputeLine; BRepApprox_TheComputeLineBezierOfApprox myComputeLineBezier; Approx_MCurvesToBSpCurve myBezToBSpl; - Standard_Boolean myWithTangency; - Standard_Real myTol3d; - Standard_Real myTol2d; - Standard_Integer myDegMin; - Standard_Integer myDegMax; - Standard_Integer myNbIterMax; - Standard_Real myTolReached3d; - Standard_Real myTolReached2d; + bool myWithTangency; + double myTol3d; + double myTol2d; + int myDegMin; + int myDegMax; + int myNbIterMax; + double myTolReached3d; + double myTolReached2d; Approx_Data myData; - NCollection_Vector myKnots; + NCollection_DynamicArray myKnots; }; #endif // _BRepApprox_Approx_HeaderFile diff --git a/opencascade/BRepApprox_ApproxLine.hxx b/opencascade/BRepApprox_ApproxLine.hxx index b1b5ee208..a8d41f340 100644 --- a/opencascade/BRepApprox_ApproxLine.hxx +++ b/opencascade/BRepApprox_ApproxLine.hxx @@ -27,34 +27,30 @@ class Geom2d_BSplineCurve; class IntSurf_LineOn2S; class IntSurf_PntOn2S; -class BRepApprox_ApproxLine; -DEFINE_STANDARD_HANDLE(BRepApprox_ApproxLine, Standard_Transient) - class BRepApprox_ApproxLine : public Standard_Transient { public: - Standard_EXPORT BRepApprox_ApproxLine(const Handle(Geom_BSplineCurve)& CurveXYZ, - const Handle(Geom2d_BSplineCurve)& CurveUV1, - const Handle(Geom2d_BSplineCurve)& CurveUV2); + Standard_EXPORT BRepApprox_ApproxLine(const occ::handle& CurveXYZ, + const occ::handle& CurveUV1, + const occ::handle& CurveUV2); //! theTang variable has been entered only for compatibility with //! the alias IntPatch_WLine. They are not used in this class. - Standard_EXPORT BRepApprox_ApproxLine(const Handle(IntSurf_LineOn2S)& lin, - const Standard_Boolean theTang = Standard_False); + Standard_EXPORT BRepApprox_ApproxLine(const occ::handle& lin, + const bool theTang = false); - Standard_EXPORT Standard_Integer NbPnts() const; + Standard_EXPORT int NbPnts() const; - Standard_EXPORT IntSurf_PntOn2S Point(const Standard_Integer Index); + Standard_EXPORT IntSurf_PntOn2S Point(const int Index); DEFINE_STANDARD_RTTIEXT(BRepApprox_ApproxLine, Standard_Transient) -protected: private: - Handle(Geom_BSplineCurve) myCurveXYZ; - Handle(Geom2d_BSplineCurve) myCurveUV1; - Handle(Geom2d_BSplineCurve) myCurveUV2; - Handle(IntSurf_LineOn2S) myLineOn2S; + occ::handle myCurveXYZ; + occ::handle myCurveUV1; + occ::handle myCurveUV2; + occ::handle myLineOn2S; }; #endif // _BRepApprox_ApproxLine_HeaderFile diff --git a/opencascade/BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox.hxx index f707ff7c1..e69fedf41 100644 --- a/opencascade/BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox.hxx @@ -38,18 +38,16 @@ public: Standard_EXPORT BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox( math_MultipleVarFunctionWithGradient& F, const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _BRepApprox_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox.hxx index b2135eeec..7e0e5b3ef 100644 --- a/opencascade/BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox.hxx @@ -25,11 +25,10 @@ #include #include #include -#include -#include +#include +#include +#include #include -#include -#include #include #include class BRepApprox_TheMultiLineOfApprox; @@ -47,32 +46,32 @@ public: //! initializes the fields of the function. The approximating //! curve has control points. Standard_EXPORT BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer NbPol); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int NbPol); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -83,16 +82,15 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex); + Standard_EXPORT double Error(const int IPoint, const int CurveIndex); //! returns the maximum distance between the points //! and the MultiBSpCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiBSpCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the function matrix used to approximate the //! multiline. @@ -108,17 +106,17 @@ public: //! to Index(ieme point) + degree +1. Standard_EXPORT const math_IntegerVector& Index() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; - Standard_EXPORT void SetFirstLambda(const Standard_Real l1); + Standard_EXPORT void SetFirstLambda(const double l1); - Standard_EXPORT void SetLastLambda(const Standard_Real l2); + Standard_EXPORT void SetLastLambda(const double l2); protected: //! this method is used each time Value or Gradient is @@ -126,12 +124,12 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; + bool Done; BRepApprox_TheMultiLineOfApprox MyMultiLine; AppParCurves_MultiBSpCurve MyMultiBSpCurve; - Standard_Integer nbpoles; + int nbpoles; math_Vector myParameters; - Standard_Real FVal; + double FVal; math_Vector ValGrad_F; math_Matrix MyF; math_Matrix PTLX; @@ -140,19 +138,19 @@ private: math_Matrix A; math_Matrix DA; BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Real mylambda1; - Standard_Real mylambda2; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; + double mylambda1; + double mylambda2; }; #endif // _BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox.hxx index ec741572d..5a2fe2da3 100644 --- a/opencascade/BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -65,21 +63,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -98,59 +96,57 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -174,10 +170,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -186,15 +179,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -211,24 +204,24 @@ public: protected: //! is used by the constructors above. Standard_EXPORT void Init(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + const int FirstPoint, + const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; + Standard_EXPORT int NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -247,41 +240,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox.hxx index 63ef1b5ef..a3b2b0ee4 100644 --- a/opencascade/BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox.hxx @@ -39,18 +39,16 @@ public: Standard_EXPORT BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox( math_MultipleVarFunctionWithGradient& F, const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox.hxx index 16b36b212..f85bb8232 100644 --- a/opencascade/BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox.hxx @@ -39,18 +39,16 @@ public: Standard_EXPORT BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox( math_MultipleVarFunctionWithGradient& F, const math_Vector& StartingPoint, - const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d, - const Standard_Real Eps, - const Standard_Integer NbIterations = 200); + const double Tolerance3d, + const double Tolerance2d, + const double Eps, + const int NbIterations = 200); - Standard_EXPORT virtual Standard_Boolean IsSolutionReached( - math_MultipleVarFunctionWithGradient& F) const Standard_OVERRIDE; + Standard_EXPORT bool IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const override; -protected: private: - Standard_Real myTol3d; - Standard_Real myTol2d; + double myTol3d; + double myTol2d; }; #endif // _BRepApprox_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_MyBSplGradientOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_MyBSplGradientOfTheComputeLineOfApprox.hxx index 1862912c8..9e75860cb 100644 --- a/opencascade/BRepApprox_MyBSplGradientOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_MyBSplGradientOfTheComputeLineOfApprox.hxx @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class BRepApprox_TheMultiLineOfApprox; @@ -49,17 +49,17 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT BRepApprox_MyBSplGradientOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 1); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 1); //! Tries to minimize the sum (square(||Qui - Bi*Pi||)) //! where Pui describe the approximating BSpline curves'Poles @@ -68,22 +68,22 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT BRepApprox_MyBSplGradientOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations, - const Standard_Real lambda1, - const Standard_Real lambda2); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations, + const double lambda1, + const double lambda2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the BSpline curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -93,43 +93,44 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; protected: - Standard_EXPORT void Perform(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + Standard_EXPORT void Perform( + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); private: AppParCurves_MultiBSpCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Real mylambda1; - Standard_Real mylambda2; - Standard_Boolean myIsLambdaDefined; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + double mylambda1; + double mylambda2; + bool myIsLambdaDefined; + bool Done; }; #endif // _BRepApprox_MyBSplGradientOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_MyGradientOfTheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_MyGradientOfTheComputeLineBezierOfApprox.hxx index 9b7f34840..c069c9291 100644 --- a/opencascade/BRepApprox_MyGradientOfTheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_MyGradientOfTheComputeLineBezierOfApprox.hxx @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class BRepApprox_TheMultiLineOfApprox; @@ -48,18 +50,18 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT BRepApprox_MyGradientOfTheComputeLineBezierOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the Bezier curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -69,28 +71,27 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; -protected: private: AppParCurves_MultiCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + bool Done; }; #endif // _BRepApprox_MyGradientOfTheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_MyGradientbisOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_MyGradientbisOfTheComputeLineOfApprox.hxx index e5080a481..a8f5a4a8e 100644 --- a/opencascade/BRepApprox_MyGradientbisOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_MyGradientbisOfTheComputeLineOfApprox.hxx @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include class Standard_OutOfRange; class StdFail_NotDone; class BRepApprox_TheMultiLineOfApprox; @@ -48,18 +50,18 @@ public: //! The tolerance required on this sum is given by Tol. //! The desired degree of the resulting curve is Deg. Standard_EXPORT BRepApprox_MyGradientbisOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - math_Vector& Parameters, - const Standard_Integer Deg, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIterations = 200); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + math_Vector& Parameters, + const int Deg, + const double Tol3d, + const double Tol2d, + const int NbIterations = 200); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns all the Bezier curves approximating the //! MultiLine SSP after minimization of the parameter. @@ -69,28 +71,27 @@ public: //! approximation. //! An exception is raised if NotDone. //! An exception is raised if Index<1 or Index>NbParameters. - Standard_EXPORT Standard_Real Error(const Standard_Integer Index) const; + Standard_EXPORT double Error(const int Index) const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum difference between the old and the //! new approximation. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; //! returns the average error between the old and the //! new approximation. - Standard_EXPORT Standard_Real AverageError() const; + Standard_EXPORT double AverageError() const; -protected: private: AppParCurves_MultiCurve SCU; math_Vector ParError; - Standard_Real AvError; - Standard_Real MError3d; - Standard_Real MError2d; - Standard_Boolean Done; + double AvError; + double MError3d; + double MError2d; + bool Done; }; #endif // _BRepApprox_MyGradientbisOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox.hxx index d74b25cb8..303a99624 100644 --- a/opencascade/BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class BRepApprox_TheMultiLineOfApprox; @@ -44,30 +45,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -78,24 +79,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -103,12 +103,12 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; + bool Done; BRepApprox_TheMultiLineOfApprox MyMultiLine; AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; + int Degre; math_Vector myParameters; - Standard_Real FVal; + double FVal; math_Vector ValGrad_F; math_Matrix MyF; math_Matrix PTLX; @@ -117,17 +117,17 @@ private: math_Matrix A; math_Matrix DA; BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox.hxx index 6102b91ab..74e953a96 100644 --- a/opencascade/BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include #include #include class BRepApprox_TheMultiLineOfApprox; @@ -44,30 +45,30 @@ public: //! initializes the fields of the function. The approximating //! curve has the desired degree Deg. Standard_EXPORT BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const math_Vector& Parameters, - const Standard_Integer Deg); + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints, + const math_Vector& Parameters, + const int Deg); //! returns the number of variables of the function. It //! corresponds to the number of MultiPoints. - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; //! this method computes the new approximation of the //! MultiLine //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each //! point of the MultiLine. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F); + Standard_EXPORT bool Value(const math_Vector& X, double& F) override; //! returns the gradient G of the sum above for the //! parameters Xi. - Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G); + Standard_EXPORT bool Gradient(const math_Vector& X, math_Vector& G) override; //! returns the value F=sum(||Pui - Bi*Pi||)2. //! returns the value G = grad(F) for the parameters Xi. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G); + Standard_EXPORT bool Values(const math_Vector& X, double& F, math_Vector& G) override; //! returns the new parameters of the MultiLine. Standard_EXPORT const math_Vector& NewParameters() const; @@ -78,24 +79,23 @@ public: //! returns the distance between the MultiPoint of range //! IPoint and the curve CurveIndex. - Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint, - const Standard_Integer CurveIndex) const; + Standard_EXPORT double Error(const int IPoint, const int CurveIndex) const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError3d() const; + Standard_EXPORT double MaxError3d() const; //! returns the maximum distance between the points //! and the MultiCurve. - Standard_EXPORT Standard_Real MaxError2d() const; + Standard_EXPORT double MaxError2d() const; - Standard_EXPORT AppParCurves_Constraint - FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer FirstPoint) const; + Standard_EXPORT AppParCurves_Constraint FirstConstraint( + const occ::handle>& TheConstraints, + const int FirstPoint) const; - Standard_EXPORT AppParCurves_Constraint - LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, - const Standard_Integer LastPoint) const; + Standard_EXPORT AppParCurves_Constraint LastConstraint( + const occ::handle>& TheConstraints, + const int LastPoint) const; protected: //! this method is used each time Value or Gradient is @@ -103,12 +103,12 @@ protected: Standard_EXPORT void Perform(const math_Vector& X); private: - Standard_Boolean Done; + bool Done; BRepApprox_TheMultiLineOfApprox MyMultiLine; AppParCurves_MultiCurve MyMultiCurve; - Standard_Integer Degre; + int Degre; math_Vector myParameters; - Standard_Real FVal; + double FVal; math_Vector ValGrad_F; math_Matrix MyF; math_Matrix PTLX; @@ -117,17 +117,17 @@ private: math_Matrix A; math_Matrix DA; BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox MyLeastSquare; - Standard_Boolean Contraintes; - Standard_Integer NbP; - Standard_Integer NbCu; - Standard_Integer Adeb; - Standard_Integer Afin; - Handle(TColStd_HArray1OfInteger) tabdim; - Standard_Real ERR3d; - Standard_Real ERR2d; - Standard_Integer FirstP; - Standard_Integer LastP; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; + bool Contraintes; + int NbP; + int NbCu; + int Adeb; + int Afin; + occ::handle> tabdim; + double ERR3d; + double ERR2d; + int FirstP; + int LastP; + occ::handle> myConstraints; }; #endif // _BRepApprox_ParFunctionOfMyGradientbisOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox.hxx index d3fd10ee2..dce3f642c 100644 --- a/opencascade/BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -65,21 +63,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -98,59 +96,57 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -174,10 +170,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -186,15 +179,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -211,24 +204,24 @@ public: protected: //! is used by the constructors above. Standard_EXPORT void Init(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + const int FirstPoint, + const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; + Standard_EXPORT int NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -247,41 +240,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox.hxx index 504609164..92b08ece1 100644 --- a/opencascade/BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox.hxx @@ -23,15 +23,13 @@ #include #include -#include -#include +#include +#include +#include #include #include #include #include -#include -#include -#include class StdFail_NotDone; class Standard_OutOfRange; class Standard_DimensionError; @@ -65,21 +63,21 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! given a MultiLine, this algorithm computes the least //! square resolution using the Householder-QR method. @@ -98,59 +96,57 @@ public: //! parameter, only the vector B changes). Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const math_Vector& Parameters, - const Standard_Integer NbPol); + const int NbPol); //! Initializes the fields of the object. Standard_EXPORT BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& SSP, - const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, + const NCollection_Array1& Knots, + const NCollection_Array1& Mults, + const int FirstPoint, + const int LastPoint, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, - const Standard_Integer NbPol); + const int NbPol); //! Is used after having initialized the fields. //! The case "CurvaturePoint" is not treated in this method. Standard_EXPORT void Perform(const math_Vector& Parameters); //! Is used after having initialized the fields. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, const double l1, const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const double l1, + const double l2); //! Is used after having initialized the fields. //! is the tangent vector at the first point. //! is the tangent vector at the last point. //! is the tangent vector at the first point. //! is the tangent vector at the last point. - Standard_EXPORT void Perform(const math_Vector& Parameters, - const math_Vector& V1t, - const math_Vector& V2t, - const math_Vector& V1c, - const math_Vector& V2c, - const Standard_Real l1, - const Standard_Real l2); + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const double l1, + const double l2); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the result of the approximation, i.e. all the //! Curves. @@ -174,10 +170,7 @@ public: //! and the approximation curves. F is the sum of the square //! distances. Grad is the derivative vector of the //! function F. - Standard_EXPORT void ErrorGradient(math_Vector& Grad, - Standard_Real& F, - Standard_Real& MaxE3d, - Standard_Real& MaxE2d); + Standard_EXPORT void ErrorGradient(math_Vector& Grad, double& F, double& MaxE3d, double& MaxE2d); //! returns the distances between the points of the //! multiline and the approximation curves. @@ -186,15 +179,15 @@ public: //! returns the maximum errors between the MultiLine //! and the approximation curves. F is the sum of the square //! distances. - Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + Standard_EXPORT void Error(double& F, double& MaxE3d, double& MaxE2d); //! returns the value (P2 - P1)/ V1 if the first point //! was a tangency point. - Standard_EXPORT Standard_Real FirstLambda() const; + Standard_EXPORT double FirstLambda() const; //! returns the value (PN - PN-1)/ VN if the last point //! was a tangency point. - Standard_EXPORT Standard_Real LastLambda() const; + Standard_EXPORT double LastLambda() const; //! returns the matrix of points value. Standard_EXPORT const math_Matrix& Points() const; @@ -211,24 +204,24 @@ public: protected: //! is used by the constructors above. Standard_EXPORT void Init(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint); + const int FirstPoint, + const int LastPoint); //! returns the number of second member columns. //! Is used internally to initialize the fields. - Standard_EXPORT Standard_Integer NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; + Standard_EXPORT int NbBColumns(const BRepApprox_TheMultiLineOfApprox& SSP) const; //! returns the first point being fitted. - Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, - const Standard_Integer FirstPoint) const; + Standard_EXPORT int TheFirstPoint(const AppParCurves_Constraint FirstCons, + const int FirstPoint) const; //! returns the last point being fitted. - Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, - const Standard_Integer LastPoint) const; + Standard_EXPORT int TheLastPoint(const AppParCurves_Constraint LastCons, + const int LastPoint) const; //! Affects the fields in the case of a constraint point. Standard_EXPORT void Affect(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer Index, + const int Index, AppParCurves_Constraint& Cons, math_Vector& Vt, math_Vector& Vc); @@ -247,41 +240,41 @@ protected: Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); private: - AppParCurves_Constraint FirstConstraint; - AppParCurves_Constraint LastConstraint; - AppParCurves_MultiBSpCurve SCU; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - math_Matrix mypoles; - math_Matrix A; - math_Matrix DA; - math_Matrix B2; - math_Matrix mypoints; - math_Vector Vflatknots; - math_Vector Vec1t; - math_Vector Vec1c; - math_Vector Vec2t; - math_Vector Vec2c; - math_Matrix theError; - math_IntegerVector myindex; - Standard_Real lambda1; - Standard_Real lambda2; - Standard_Integer FirstP; - Standard_Integer LastP; - Standard_Integer Nlignes; - Standard_Integer Ninc; - Standard_Integer NA; - Standard_Integer myfirstp; - Standard_Integer mylastp; - Standard_Integer resinit; - Standard_Integer resfin; - Standard_Integer nbP2d; - Standard_Integer nbP; - Standard_Integer nbpoles; - Standard_Integer deg; - Standard_Boolean done; - Standard_Boolean iscalculated; - Standard_Boolean isready; + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + occ::handle> myknots; + occ::handle> mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + double lambda1; + double lambda2; + int FirstP; + int LastP; + int Nlignes; + int Ninc; + int NA; + int myfirstp; + int mylastp; + int resinit; + int resfin; + int nbP2d; + int nbP; + int nbpoles; + int deg; + bool done; + bool iscalculated; + bool isready; }; #endif // _BRepApprox_ParLeastSquareOfMyGradientbisOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox.hxx index 3c6482fc6..e5e01fdf2 100644 --- a/opencascade/BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class BRepApprox_TheMultiLineOfApprox; class BRepApprox_TheMultiLineToolOfApprox; @@ -49,21 +50,21 @@ public: //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. Standard_EXPORT BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + const BRepApprox_TheMultiLineOfApprox& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -74,7 +75,7 @@ public: Standard_EXPORT const math_Matrix& ConstraintDerivative( const BRepApprox_TheMultiLineOfApprox& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -83,30 +84,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const BRepApprox_TheMultiLineOfApprox& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox.hxx b/opencascade/BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox.hxx index c0420edf3..40bc20df9 100644 --- a/opencascade/BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox.hxx @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +#include +#include class Standard_OutOfRange; class BRepApprox_TheMultiLineOfApprox; class BRepApprox_TheMultiLineToolOfApprox; @@ -49,21 +50,21 @@ public: //! from an approximation with ParLeastSquare.) //! The MultiCurve is modified. New MultiPoles are given. Standard_EXPORT BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& SSP, - AppParCurves_MultiCurve& SCurv, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& Constraints, - const math_Matrix& Bern, - const math_Matrix& DerivativeBern, - const Standard_Real Tolerance = 1.0e-10); + const BRepApprox_TheMultiLineOfApprox& SSP, + AppParCurves_MultiCurve& SCurv, + const int FirstPoint, + const int LastPoint, + const occ::handle>& Constraints, + const math_Matrix& Bern, + const math_Matrix& DerivativeBern, + const double Tolerance = 1.0e-10); //! returns True if all has been correctly done. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the maximum difference value between the curve //! and the given points. - Standard_EXPORT Standard_Real Error() const; + Standard_EXPORT double Error() const; Standard_EXPORT const math_Matrix& ConstraintMatrix() const; @@ -74,7 +75,7 @@ public: Standard_EXPORT const math_Matrix& ConstraintDerivative( const BRepApprox_TheMultiLineOfApprox& SSP, const math_Vector& Parameters, - const Standard_Integer Deg, + const int Deg, const math_Matrix& DA); //! returns the Inverse of Cont*Transposed(Cont), where @@ -83,30 +84,29 @@ public: protected: //! is used internally to create the fields. - Standard_EXPORT Standard_Integer - NbConstraints(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer FirstPoint, - const Standard_Integer LastPoint, - const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints) const; + Standard_EXPORT int NbConstraints( + const BRepApprox_TheMultiLineOfApprox& SSP, + const int FirstPoint, + const int LastPoint, + const occ::handle>& TheConstraints) const; //! is internally used for the fields creation. - Standard_EXPORT Standard_Integer NbColumns(const BRepApprox_TheMultiLineOfApprox& SSP, - const Standard_Integer Deg) const; + Standard_EXPORT int NbColumns(const BRepApprox_TheMultiLineOfApprox& SSP, const int Deg) const; private: - Standard_Boolean Done; - Standard_Real Err; + bool Done; + double Err; math_Matrix Cont; math_Matrix DeCont; math_Vector Secont; math_Matrix CTCinv; math_Vector Vardua; - Standard_Integer IncPass; - Standard_Integer IncTan; - Standard_Integer IncCurv; - TColStd_Array1OfInteger IPas; - TColStd_Array1OfInteger ITan; - TColStd_Array1OfInteger ICurv; + int IncPass; + int IncTan; + int IncCurv; + NCollection_Array1 IPas; + NCollection_Array1 ITan; + NCollection_Array1 ICurv; }; #endif // _BRepApprox_ResConstraintOfMyGradientbisOfTheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_SurfaceTool.hxx b/opencascade/BRepApprox_SurfaceTool.hxx index c7381e4d4..b99e605a0 100644 --- a/opencascade/BRepApprox_SurfaceTool.hxx +++ b/opencascade/BRepApprox_SurfaceTool.hxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -39,67 +39,64 @@ class BRepApprox_SurfaceTool public: DEFINE_STANDARD_ALLOC - static Standard_Real FirstUParameter(const BRepAdaptor_Surface& S); + static double FirstUParameter(const BRepAdaptor_Surface& S); - static Standard_Real FirstVParameter(const BRepAdaptor_Surface& S); + static double FirstVParameter(const BRepAdaptor_Surface& S); - static Standard_Real LastUParameter(const BRepAdaptor_Surface& S); + static double LastUParameter(const BRepAdaptor_Surface& S); - static Standard_Real LastVParameter(const BRepAdaptor_Surface& S); + static double LastVParameter(const BRepAdaptor_Surface& S); - static Standard_Integer NbUIntervals(const BRepAdaptor_Surface& S, const GeomAbs_Shape Sh); + static int NbUIntervals(const BRepAdaptor_Surface& S, const GeomAbs_Shape Sh); - static Standard_Integer NbVIntervals(const BRepAdaptor_Surface& S, const GeomAbs_Shape Sh); + static int NbVIntervals(const BRepAdaptor_Surface& S, const GeomAbs_Shape Sh); - static void UIntervals(const BRepAdaptor_Surface& S, - TColStd_Array1OfReal& T, - const GeomAbs_Shape Sh); + static void UIntervals(const BRepAdaptor_Surface& S, + NCollection_Array1& T, + const GeomAbs_Shape Sh); - static void VIntervals(const BRepAdaptor_Surface& S, - TColStd_Array1OfReal& T, - const GeomAbs_Shape Sh); + static void VIntervals(const BRepAdaptor_Surface& S, + NCollection_Array1& T, + const GeomAbs_Shape Sh); //! If >= - static Handle(Adaptor3d_Surface) UTrim(const BRepAdaptor_Surface& S, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + static occ::handle UTrim(const BRepAdaptor_Surface& S, + const double First, + const double Last, + const double Tol); //! If >= - static Handle(Adaptor3d_Surface) VTrim(const BRepAdaptor_Surface& S, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol); + static occ::handle VTrim(const BRepAdaptor_Surface& S, + const double First, + const double Last, + const double Tol); - static Standard_Boolean IsUClosed(const BRepAdaptor_Surface& S); + static bool IsUClosed(const BRepAdaptor_Surface& S); - static Standard_Boolean IsVClosed(const BRepAdaptor_Surface& S); + static bool IsVClosed(const BRepAdaptor_Surface& S); - static Standard_Boolean IsUPeriodic(const BRepAdaptor_Surface& S); + static bool IsUPeriodic(const BRepAdaptor_Surface& S); - static Standard_Real UPeriod(const BRepAdaptor_Surface& S); + static double UPeriod(const BRepAdaptor_Surface& S); - static Standard_Boolean IsVPeriodic(const BRepAdaptor_Surface& S); + static bool IsVPeriodic(const BRepAdaptor_Surface& S); - static Standard_Real VPeriod(const BRepAdaptor_Surface& S); + static double VPeriod(const BRepAdaptor_Surface& S); - static gp_Pnt Value(const BRepAdaptor_Surface& S, const Standard_Real u, const Standard_Real v); + static gp_Pnt Value(const BRepAdaptor_Surface& S, const double u, const double v); - static void D0(const BRepAdaptor_Surface& S, - const Standard_Real u, - const Standard_Real v, - gp_Pnt& P); + static void D0(const BRepAdaptor_Surface& S, const double u, const double v, gp_Pnt& P); static void D1(const BRepAdaptor_Surface& S, - const Standard_Real u, - const Standard_Real v, + const double u, + const double v, gp_Pnt& P, gp_Vec& D1u, gp_Vec& D1v); static void D2(const BRepAdaptor_Surface& S, - const Standard_Real u, - const Standard_Real v, + const double u, + const double v, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, @@ -108,8 +105,8 @@ public: gp_Vec& D2UV); static void D3(const BRepAdaptor_Surface& S, - const Standard_Real u, - const Standard_Real v, + const double u, + const double v, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, @@ -122,14 +119,14 @@ public: gp_Vec& D3UVV); static gp_Vec DN(const BRepAdaptor_Surface& S, - const Standard_Real u, - const Standard_Real v, - const Standard_Integer Nu, - const Standard_Integer Nv); + const double u, + const double v, + const int Nu, + const int Nv); - static Standard_Real UResolution(const BRepAdaptor_Surface& S, const Standard_Real R3d); + static double UResolution(const BRepAdaptor_Surface& S, const double R3d); - static Standard_Real VResolution(const BRepAdaptor_Surface& S, const Standard_Real R3d); + static double VResolution(const BRepAdaptor_Surface& S, const double R3d); static GeomAbs_SurfaceType GetType(const BRepAdaptor_Surface& S); @@ -143,30 +140,27 @@ public: static gp_Sphere Sphere(const BRepAdaptor_Surface& S); - static Handle(Geom_BezierSurface) Bezier(const BRepAdaptor_Surface& S); + static occ::handle Bezier(const BRepAdaptor_Surface& S); - static Handle(Geom_BSplineSurface) BSpline(const BRepAdaptor_Surface& S); + static occ::handle BSpline(const BRepAdaptor_Surface& S); static gp_Ax1 AxeOfRevolution(const BRepAdaptor_Surface& S); static gp_Dir Direction(const BRepAdaptor_Surface& S); - static Handle(Adaptor3d_Curve) BasisCurve(const BRepAdaptor_Surface& S); + static occ::handle BasisCurve(const BRepAdaptor_Surface& S); - Standard_EXPORT static Standard_Integer NbSamplesU(const BRepAdaptor_Surface& S); + Standard_EXPORT static int NbSamplesU(const BRepAdaptor_Surface& S); - Standard_EXPORT static Standard_Integer NbSamplesV(const BRepAdaptor_Surface& S); + Standard_EXPORT static int NbSamplesV(const BRepAdaptor_Surface& S); - Standard_EXPORT static Standard_Integer NbSamplesU(const BRepAdaptor_Surface& S, - const Standard_Real u1, - const Standard_Real u2); + Standard_EXPORT static int NbSamplesU(const BRepAdaptor_Surface& S, + const double u1, + const double u2); - Standard_EXPORT static Standard_Integer NbSamplesV(const BRepAdaptor_Surface& S, - const Standard_Real v1, - const Standard_Real v2); - -protected: -private: + Standard_EXPORT static int NbSamplesV(const BRepAdaptor_Surface& S, + const double v1, + const double v2); }; #include diff --git a/opencascade/BRepApprox_SurfaceTool.lxx b/opencascade/BRepApprox_SurfaceTool.lxx index 41e72709c..2d5a244ee 100644 --- a/opencascade/BRepApprox_SurfaceTool.lxx +++ b/opencascade/BRepApprox_SurfaceTool.lxx @@ -28,116 +28,116 @@ #include #include -inline Standard_Real BRepApprox_SurfaceTool::FirstUParameter(const BRepAdaptor_Surface& Surf) +inline double BRepApprox_SurfaceTool::FirstUParameter(const BRepAdaptor_Surface& Surf) { return Surf.FirstUParameter(); } -inline Standard_Real BRepApprox_SurfaceTool::FirstVParameter(const BRepAdaptor_Surface& Surf) +inline double BRepApprox_SurfaceTool::FirstVParameter(const BRepAdaptor_Surface& Surf) { return Surf.FirstVParameter(); } -inline Standard_Real BRepApprox_SurfaceTool::LastUParameter(const BRepAdaptor_Surface& Surf) +inline double BRepApprox_SurfaceTool::LastUParameter(const BRepAdaptor_Surface& Surf) { return Surf.LastUParameter(); } -inline Standard_Real BRepApprox_SurfaceTool::LastVParameter(const BRepAdaptor_Surface& Surf) +inline double BRepApprox_SurfaceTool::LastVParameter(const BRepAdaptor_Surface& Surf) { return Surf.LastVParameter(); } -inline Standard_Integer BRepApprox_SurfaceTool::NbUIntervals(const BRepAdaptor_Surface& Surf, - const GeomAbs_Shape S) +inline int BRepApprox_SurfaceTool::NbUIntervals(const BRepAdaptor_Surface& Surf, + const GeomAbs_Shape S) { return Surf.NbUIntervals(S); } -inline Standard_Integer BRepApprox_SurfaceTool::NbVIntervals(const BRepAdaptor_Surface& Surf, - const GeomAbs_Shape S) +inline int BRepApprox_SurfaceTool::NbVIntervals(const BRepAdaptor_Surface& Surf, + const GeomAbs_Shape S) { return Surf.NbVIntervals(S); } -inline void BRepApprox_SurfaceTool::UIntervals(const BRepAdaptor_Surface& Surf, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape S) +inline void BRepApprox_SurfaceTool::UIntervals(const BRepAdaptor_Surface& Surf, + NCollection_Array1& Tab, + const GeomAbs_Shape S) { Surf.UIntervals(Tab, S); } -inline void BRepApprox_SurfaceTool::VIntervals(const BRepAdaptor_Surface& Surf, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape S) +inline void BRepApprox_SurfaceTool::VIntervals(const BRepAdaptor_Surface& Surf, + NCollection_Array1& Tab, + const GeomAbs_Shape S) { Surf.VIntervals(Tab, S); } -inline Handle(Adaptor3d_Surface) BRepApprox_SurfaceTool::UTrim(const BRepAdaptor_Surface& Surf, - const Standard_Real F, - const Standard_Real L, - const Standard_Real Tol) +inline occ::handle BRepApprox_SurfaceTool::UTrim(const BRepAdaptor_Surface& Surf, + const double F, + const double L, + const double Tol) { return Surf.UTrim(F, L, Tol); } -inline Handle(Adaptor3d_Surface) BRepApprox_SurfaceTool::VTrim(const BRepAdaptor_Surface& Surf, - const Standard_Real F, - const Standard_Real L, - const Standard_Real Tol) +inline occ::handle BRepApprox_SurfaceTool::VTrim(const BRepAdaptor_Surface& Surf, + const double F, + const double L, + const double Tol) { return Surf.VTrim(F, L, Tol); } -inline Standard_Boolean BRepApprox_SurfaceTool::IsUClosed(const BRepAdaptor_Surface& S) +inline bool BRepApprox_SurfaceTool::IsUClosed(const BRepAdaptor_Surface& S) { return S.IsUClosed(); } -inline Standard_Boolean BRepApprox_SurfaceTool::IsVClosed(const BRepAdaptor_Surface& S) +inline bool BRepApprox_SurfaceTool::IsVClosed(const BRepAdaptor_Surface& S) { return S.IsVClosed(); } -inline Standard_Boolean BRepApprox_SurfaceTool::IsUPeriodic(const BRepAdaptor_Surface& S) +inline bool BRepApprox_SurfaceTool::IsUPeriodic(const BRepAdaptor_Surface& S) { return S.IsUPeriodic(); } -inline Standard_Real BRepApprox_SurfaceTool::UPeriod(const BRepAdaptor_Surface& S) +inline double BRepApprox_SurfaceTool::UPeriod(const BRepAdaptor_Surface& S) { return S.UPeriod(); } -inline Standard_Boolean BRepApprox_SurfaceTool::IsVPeriodic(const BRepAdaptor_Surface& S) +inline bool BRepApprox_SurfaceTool::IsVPeriodic(const BRepAdaptor_Surface& S) { return S.IsVPeriodic(); } -inline Standard_Real BRepApprox_SurfaceTool::VPeriod(const BRepAdaptor_Surface& S) +inline double BRepApprox_SurfaceTool::VPeriod(const BRepAdaptor_Surface& S) { return S.VPeriod(); } inline gp_Pnt BRepApprox_SurfaceTool::Value(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V) + const double U, + const double V) { return S.Value(U, V); } inline void BRepApprox_SurfaceTool::D0(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P) { S.D0(U, V, P); } inline void BRepApprox_SurfaceTool::D1(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) @@ -146,8 +146,8 @@ inline void BRepApprox_SurfaceTool::D1(const BRepAdaptor_Surface& S, } inline void BRepApprox_SurfaceTool::D2(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, @@ -159,8 +159,8 @@ inline void BRepApprox_SurfaceTool::D2(const BRepAdaptor_Surface& S, } inline void BRepApprox_SurfaceTool::D3(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, @@ -176,22 +176,20 @@ inline void BRepApprox_SurfaceTool::D3(const BRepAdaptor_Surface& S, } inline gp_Vec BRepApprox_SurfaceTool::DN(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, - const Standard_Integer Nu, - const Standard_Integer Nv) + const double U, + const double V, + const int Nu, + const int Nv) { return S.DN(U, V, Nu, Nv); } -inline Standard_Real BRepApprox_SurfaceTool::UResolution(const BRepAdaptor_Surface& S, - const Standard_Real R3d) +inline double BRepApprox_SurfaceTool::UResolution(const BRepAdaptor_Surface& S, const double R3d) { return S.UResolution(R3d); } -inline Standard_Real BRepApprox_SurfaceTool::VResolution(const BRepAdaptor_Surface& S, - const Standard_Real R3d) +inline double BRepApprox_SurfaceTool::VResolution(const BRepAdaptor_Surface& S, const double R3d) { return S.VResolution(R3d); } @@ -226,12 +224,13 @@ inline gp_Torus BRepApprox_SurfaceTool::Torus(const BRepAdaptor_Surface& S) return S.Torus(); } -inline Handle(Geom_BezierSurface) BRepApprox_SurfaceTool::Bezier(const BRepAdaptor_Surface& S) +inline occ::handle BRepApprox_SurfaceTool::Bezier(const BRepAdaptor_Surface& S) { return (S.Bezier()); } -inline Handle(Geom_BSplineSurface) BRepApprox_SurfaceTool::BSpline(const BRepAdaptor_Surface& S) +inline occ::handle BRepApprox_SurfaceTool::BSpline( + const BRepAdaptor_Surface& S) { return (S.BSpline()); } @@ -246,7 +245,7 @@ inline gp_Dir BRepApprox_SurfaceTool::Direction(const BRepAdaptor_Surface& S) return (S.Direction()); } -inline Handle(Adaptor3d_Curve) BRepApprox_SurfaceTool::BasisCurve(const BRepAdaptor_Surface& S) +inline occ::handle BRepApprox_SurfaceTool::BasisCurve(const BRepAdaptor_Surface& S) { return (S.BasisCurve()); } diff --git a/opencascade/BRepApprox_TheComputeLineBezierOfApprox.hxx b/opencascade/BRepApprox_TheComputeLineBezierOfApprox.hxx index 5bb169746..0f5f401ef 100644 --- a/opencascade/BRepApprox_TheComputeLineBezierOfApprox.hxx +++ b/opencascade/BRepApprox_TheComputeLineBezierOfApprox.hxx @@ -21,18 +21,16 @@ #include #include -#include #include +#include #include #include -#include -#include -#include -#include +#include +#include +#include #include #include #include -#include class BRepApprox_TheMultiLineOfApprox; class BRepApprox_TheMultiLineToolOfApprox; class BRepApprox_MyGradientOfTheComputeLineBezierOfApprox; @@ -56,14 +54,14 @@ public: //! no iteration at all. Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-3, - const Standard_Real Tolerance2d = 1.0e-6, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-3, + const double Tolerance2d = 1.0e-6, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! The MultiLine will be approximated until tolerances //! will be reached. @@ -74,56 +72,53 @@ public: Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox( const BRepApprox_TheMultiLineOfApprox& Line, const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox( - const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const math_Vector& Parameters, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox( - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT void Init(const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + Standard_EXPORT void Init(const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! runs the algorithm after having initialized the fields. Standard_EXPORT void Perform(const BRepApprox_TheMultiLineOfApprox& Line); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! changes the first and the last constraint points. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint firstC, @@ -132,101 +127,98 @@ public: //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiCurve. - Standard_EXPORT void Error(const Standard_Integer Index, - Standard_Real& tol3d, - Standard_Real& tol2d) const; + Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const; //! Returns the number of MultiCurve doing the approximation //! of the MultiLine. - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; //! returns the result of the approximation. - Standard_EXPORT const AppParCurves_MultiCurve& Value(const Standard_Integer Index = 1) const; + Standard_EXPORT const AppParCurves_MultiCurve& Value(const int Index = 1) const; //! returns the result of the approximation. - Standard_EXPORT AppParCurves_MultiCurve& ChangeValue(const Standard_Integer Index = 1); + Standard_EXPORT AppParCurves_MultiCurve& ChangeValue(const int Index = 1); //! returns the result of the approximation. Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue(); - //! returns the type of parametrization + //! returns the type of parametrization Standard_EXPORT Approx_ParametrizationType Parametrization() const; //! returns the new parameters of the approximation //! corresponding to the points of the multicurve . - Standard_EXPORT const TColStd_Array1OfReal& Parameters(const Standard_Integer Index = 1) const; + Standard_EXPORT const NCollection_Array1& Parameters(const int Index = 1) const; -protected: private: //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean Compute(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer fpt, - const Standard_Integer lpt, - math_Vector& Para, - Standard_Real& TheTol3d, - Standard_Real& TheTol2d, - Standard_Integer& indbad); + Standard_EXPORT bool Compute(const BRepApprox_TheMultiLineOfApprox& Line, + const int fpt, + const int lpt, + math_Vector& Para, + double& TheTol3d, + double& TheTol2d, + int& indbad); //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean ComputeCurve(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer firspt, - const Standard_Integer lastpt); + Standard_EXPORT bool ComputeCurve(const BRepApprox_TheMultiLineOfApprox& Line, + const int firspt, + const int lastpt); //! computes new parameters between firstP and lastP. Standard_EXPORT void Parameters(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer firstP, - const Standard_Integer LastP, + const int firstP, + const int LastP, math_Vector& TheParameters) const; - Standard_EXPORT Standard_Real SearchFirstLambda(const BRepApprox_TheMultiLineOfApprox& Line, - const math_Vector& Para, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchFirstLambda(const BRepApprox_TheMultiLineOfApprox& Line, + const math_Vector& Para, + const math_Vector& V, + const int index) const; - Standard_EXPORT Standard_Real SearchLastLambda(const BRepApprox_TheMultiLineOfApprox& Line, - const math_Vector& Para, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchLastLambda(const BRepApprox_TheMultiLineOfApprox& Line, + const math_Vector& Para, + const math_Vector& V, + const int index) const; Standard_EXPORT void FirstTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void LastTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; - AppParCurves_SequenceOfMultiCurve myMultiCurves; - AppParCurves_MultiCurve TheMultiCurve; - AppParCurves_MultiBSpCurve myspline; - Standard_Boolean alldone; - Standard_Boolean tolreached; - Approx_ParametrizationType Par; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myfirstParam; - Approx_SequenceOfHArray1OfReal myPar; - TColStd_SequenceOfReal Tolers3d; - TColStd_SequenceOfReal Tolers2d; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - Standard_Boolean mysquares; - Standard_Integer myitermax; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - Standard_Integer myMultiLineNb; - Standard_Boolean myIsClear; + NCollection_Sequence myMultiCurves; + AppParCurves_MultiCurve TheMultiCurve; + AppParCurves_MultiBSpCurve myspline; + bool alldone; + bool tolreached; + Approx_ParametrizationType Par; + occ::handle> myParameters; + occ::handle> myfirstParam; + NCollection_Sequence>> myPar; + NCollection_Sequence Tolers3d; + NCollection_Sequence Tolers2d; + occ::handle> myConstraints; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + bool mysquares; + int myitermax; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + int myMultiLineNb; + bool myIsClear; }; #endif // _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_TheComputeLineOfApprox.hxx b/opencascade/BRepApprox_TheComputeLineOfApprox.hxx index f26f38f05..8f84721aa 100644 --- a/opencascade/BRepApprox_TheComputeLineOfApprox.hxx +++ b/opencascade/BRepApprox_TheComputeLineOfApprox.hxx @@ -23,14 +23,12 @@ #include #include -#include -#include -#include +#include +#include #include +#include #include #include -#include -#include class BRepApprox_TheMultiLineOfApprox; class BRepApprox_TheMultiLineToolOfApprox; class BRepApprox_MyBSplGradientOfTheComputeLineOfApprox; @@ -61,14 +59,14 @@ public: //! default. Standard_EXPORT BRepApprox_TheComputeLineOfApprox( const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-3, - const Standard_Real Tolerance2d = 1.0e-6, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-3, + const double Tolerance2d = 1.0e-6, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! The MultiLine will be approximated until tolerances //! will be reached. @@ -76,102 +74,98 @@ public: //! with a cutting if the corresponding boolean is True. //! If is True, the computation will be done with //! no iteration at all. - Standard_EXPORT BRepApprox_TheComputeLineOfApprox( - const BRepApprox_TheMultiLineOfApprox& Line, - const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + Standard_EXPORT BRepApprox_TheComputeLineOfApprox(const BRepApprox_TheMultiLineOfApprox& Line, + const math_Vector& Parameters, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. - Standard_EXPORT BRepApprox_TheComputeLineOfApprox( - const math_Vector& Parameters, - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, - const Standard_Boolean Squares = Standard_False); + Standard_EXPORT BRepApprox_TheComputeLineOfApprox(const math_Vector& Parameters, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, + const bool Squares = false); //! Initializes the fields of the algorithm. Standard_EXPORT BRepApprox_TheComputeLineOfApprox( - const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! Constructs an interpolation of the MultiLine //! The result will be a C2 curve of degree 3. Standard_EXPORT void Interpol(const BRepApprox_TheMultiLineOfApprox& Line); //! Initializes the fields of the algorithm. - Standard_EXPORT void Init(const Standard_Integer degreemin = 4, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-03, - const Standard_Real Tolerance2d = 1.0e-06, - const Standard_Integer NbIterations = 5, - const Standard_Boolean cutting = Standard_True, + Standard_EXPORT void Init(const int degreemin = 4, + const int degreemax = 8, + const double Tolerance3d = 1.0e-03, + const double Tolerance2d = 1.0e-06, + const int NbIterations = 5, + const bool cutting = true, const Approx_ParametrizationType parametrization = Approx_ChordLength, - const Standard_Boolean Squares = Standard_False); + const bool Squares = false); //! runs the algorithm after having initialized the fields. Standard_EXPORT void Perform(const BRepApprox_TheMultiLineOfApprox& Line); //! The approximation will begin with the - //! set of parameters . + //! set of parameters . Standard_EXPORT void SetParameters(const math_Vector& ThePar); //! The approximation will be done with the //! set of knots . The multiplicities will be set //! with the degree and the desired continuity. - Standard_EXPORT void SetKnots(const TColStd_Array1OfReal& Knots); + Standard_EXPORT void SetKnots(const NCollection_Array1& Knots); //! The approximation will be done with the //! set of knots and the multiplicities . - Standard_EXPORT void SetKnotsAndMultiplicities(const TColStd_Array1OfReal& Knots, - const TColStd_Array1OfInteger& Mults); + Standard_EXPORT void SetKnotsAndMultiplicities(const NCollection_Array1& Knots, + const NCollection_Array1& Mults); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! sets the continuity of the spline. //! if C = 2, the spline will be C2. - Standard_EXPORT void SetContinuity(const Standard_Integer C); + Standard_EXPORT void SetContinuity(const int C); //! changes the first and the last constraint points. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC); //! Sets periodic flag. - //! If thePeriodic = Standard_True, algorithm tries to build periodic + //! If thePeriodic = true, algorithm tries to build periodic //! multicurve using corresponding C1 boundary condition for first and last multipoints. //! Multiline must be closed. - Standard_EXPORT void SetPeriodic(const Standard_Boolean thePeriodic); + Standard_EXPORT void SetPeriodic(const bool thePeriodic); //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiBSpCurve. - Standard_EXPORT void Error(Standard_Real& tol3d, Standard_Real& tol2d) const; + Standard_EXPORT void Error(double& tol3d, double& tol2d) const; //! returns the result of the approximation. Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const; @@ -181,84 +175,83 @@ public: //! returns the new parameters of the approximation //! corresponding to the points of the MultiBSpCurve. - Standard_EXPORT const TColStd_Array1OfReal& Parameters() const; + Standard_EXPORT const NCollection_Array1& Parameters() const; -protected: private: //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean Compute(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer fpt, - const Standard_Integer lpt, - math_Vector& Para, - const TColStd_Array1OfReal& Knots, - TColStd_Array1OfInteger& Mults); + Standard_EXPORT bool Compute(const BRepApprox_TheMultiLineOfApprox& Line, + const int fpt, + const int lpt, + math_Vector& Para, + const NCollection_Array1& Knots, + NCollection_Array1& Mults); //! is internally used in the algorithm. - Standard_EXPORT Standard_Boolean ComputeCurve(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer firspt, - const Standard_Integer lastpt); + Standard_EXPORT bool ComputeCurve(const BRepApprox_TheMultiLineOfApprox& Line, + const int firspt, + const int lastpt); //! computes new parameters between firstP and lastP. Standard_EXPORT void Parameters(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer firstP, - const Standard_Integer LastP, + const int firstP, + const int LastP, math_Vector& TheParameters) const; - Standard_EXPORT Standard_Real SearchFirstLambda(const BRepApprox_TheMultiLineOfApprox& Line, - const math_Vector& Para, - const TColStd_Array1OfReal& Knots, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchFirstLambda(const BRepApprox_TheMultiLineOfApprox& Line, + const math_Vector& Para, + const NCollection_Array1& Knots, + const math_Vector& V, + const int index) const; - Standard_EXPORT Standard_Real SearchLastLambda(const BRepApprox_TheMultiLineOfApprox& Line, - const math_Vector& Para, - const TColStd_Array1OfReal& Knots, - const math_Vector& V, - const Standard_Integer index) const; + Standard_EXPORT double SearchLastLambda(const BRepApprox_TheMultiLineOfApprox& Line, + const math_Vector& Para, + const NCollection_Array1& Knots, + const math_Vector& V, + const int index) const; Standard_EXPORT void TangencyVector(const BRepApprox_TheMultiLineOfApprox& Line, const AppParCurves_MultiCurve& C, - const Standard_Real U, + const double U, math_Vector& V) const; Standard_EXPORT void FirstTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void LastTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line, - const Standard_Integer index, + const int index, math_Vector& V) const; Standard_EXPORT void FindRealConstraints(const BRepApprox_TheMultiLineOfApprox& Line); - AppParCurves_MultiBSpCurve TheMultiBSpCurve; - Standard_Boolean alldone; - Standard_Boolean tolreached; - Approx_ParametrizationType Par; - Handle(TColStd_HArray1OfReal) myParameters; - Handle(TColStd_HArray1OfReal) myfirstParam; - Handle(TColStd_HArray1OfReal) myknots; - Handle(TColStd_HArray1OfInteger) mymults; - Standard_Boolean myhasknots; - Standard_Boolean myhasmults; - Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - Standard_Boolean mysquares; - Standard_Integer myitermax; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - AppParCurves_Constraint realfirstC; - AppParCurves_Constraint reallastC; - Standard_Integer mycont; - Standard_Real mylambda1; - Standard_Real mylambda2; - Standard_Boolean myPeriodic; + AppParCurves_MultiBSpCurve TheMultiBSpCurve; + bool alldone; + bool tolreached; + Approx_ParametrizationType Par; + occ::handle> myParameters; + occ::handle> myfirstParam; + occ::handle> myknots; + occ::handle> mymults; + bool myhasknots; + bool myhasmults; + occ::handle> myConstraints; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + bool mysquares; + int myitermax; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + AppParCurves_Constraint realfirstC; + AppParCurves_Constraint reallastC; + int mycont; + double mylambda1; + double mylambda2; + bool myPeriodic; }; #endif // _BRepApprox_TheComputeLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_TheFunctionOfTheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx b/opencascade/BRepApprox_TheFunctionOfTheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx index e9b09e5de..325768b9e 100644 --- a/opencascade/BRepApprox_TheFunctionOfTheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx +++ b/opencascade/BRepApprox_TheFunctionOfTheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include class StdFail_UndefinedDerivative; @@ -44,31 +44,31 @@ public: const BRepAdaptor_Surface& S1, const BRepAdaptor_Surface& S2); - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_EXPORT void ComputeParameters(const IntImp_ConstIsoparametric ChoixIso, - const TColStd_Array1OfReal& Param, - math_Vector& UVap, - math_Vector& BornInf, - math_Vector& BornSup, - math_Vector& Tolerance); + Standard_EXPORT void ComputeParameters(const IntImp_ConstIsoparametric ChoixIso, + const NCollection_Array1& Param, + math_Vector& UVap, + math_Vector& BornInf, + math_Vector& BornSup, + math_Vector& Tolerance); //! returns somme des fi*fi - Standard_Real Root() const; + double Root() const; gp_Pnt Point() const; - Standard_EXPORT Standard_Boolean IsTangent(const math_Vector& UVap, - TColStd_Array1OfReal& Param, - IntImp_ConstIsoparametric& BestChoix); + Standard_EXPORT bool IsTangent(const math_Vector& UVap, + NCollection_Array1& Param, + IntImp_ConstIsoparametric& BestChoix); gp_Dir Direction() const; @@ -80,31 +80,30 @@ public: const BRepAdaptor_Surface& AuxillarSurface2() const; -protected: private: - Standard_Address surf1; - Standard_Address surf2; + void* surf1; + void* surf2; gp_Pnt pntsol1; gp_Pnt pntsol2; - Standard_Real f[3]; - Standard_Boolean compute; - Standard_Boolean tangent; - Standard_Real tgduv[4]; + double f[3]; + bool compute; + bool tangent; + double tgduv[4]; gp_Vec dpuv[4]; IntImp_ConstIsoparametric chxIso; - Standard_Real paramConst; - Standard_Real ua0; - Standard_Real va0; - Standard_Real ua1; - Standard_Real va1; - Standard_Real ub0; - Standard_Real vb0; - Standard_Real ub1; - Standard_Real vb1; - Standard_Real ures1; - Standard_Real ures2; - Standard_Real vres1; - Standard_Real vres2; + double paramConst; + double ua0; + double va0; + double ua1; + double va1; + double ub0; + double vb0; + double ub1; + double vb1; + double ures1; + double ures2; + double vres1; + double vres2; }; #define ThePSurface BRepAdaptor_Surface diff --git a/opencascade/BRepApprox_TheImpPrmSvSurfacesOfApprox.hxx b/opencascade/BRepApprox_TheImpPrmSvSurfacesOfApprox.hxx index ee98da40f..297118cd6 100644 --- a/opencascade/BRepApprox_TheImpPrmSvSurfacesOfApprox.hxx +++ b/opencascade/BRepApprox_TheImpPrmSvSurfacesOfApprox.hxx @@ -50,58 +50,57 @@ public: const BRepAdaptor_Surface& Surf2); //! returns True if Tg,Tguv1 Tguv2 can be computed. - Standard_EXPORT Standard_Boolean Compute(Standard_Real& u1, - Standard_Real& v1, - Standard_Real& u2, - Standard_Real& v2, - gp_Pnt& Pt, - gp_Vec& Tg, - gp_Vec2d& Tguv1, - gp_Vec2d& Tguv2); + Standard_EXPORT bool Compute(double& u1, + double& v1, + double& u2, + double& v2, + gp_Pnt& Pt, + gp_Vec& Tg, + gp_Vec2d& Tguv1, + gp_Vec2d& Tguv2) override; - Standard_EXPORT void Pnt(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Pnt& P); + Standard_EXPORT void Pnt(const double u1, + const double v1, + const double u2, + const double v2, + gp_Pnt& P) override; - Standard_EXPORT Standard_Boolean SeekPoint(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - IntSurf_PntOn2S& Point); + Standard_EXPORT bool SeekPoint(const double u1, + const double v1, + const double u2, + const double v2, + IntSurf_PntOn2S& Point) override; - Standard_EXPORT Standard_Boolean Tangency(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec& Tg); + Standard_EXPORT bool Tangency(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec& Tg) override; - Standard_EXPORT Standard_Boolean TangencyOnSurf1(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg); + Standard_EXPORT bool TangencyOnSurf1(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) override; - Standard_EXPORT Standard_Boolean TangencyOnSurf2(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg); + Standard_EXPORT bool TangencyOnSurf2(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) override; - Standard_Boolean FillInitialVectorOfSolution(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - const Standard_Real binfu, - const Standard_Real bsupu, - const Standard_Real binfv, - const Standard_Real bsupv, - math_Vector& X, - Standard_Real& TranslationU, - Standard_Real& TranslationV); + bool FillInitialVectorOfSolution(const double u1, + const double v1, + const double u2, + const double v2, + const double binfu, + const double bsupu, + const double binfv, + const double bsupv, + math_Vector& X, + double& TranslationU, + double& TranslationV); -protected: private: gp_Pnt2d MyParOnS1; gp_Pnt2d MyParOnS2; @@ -109,17 +108,17 @@ private: gp_Vec2d MyTguv1; gp_Vec2d MyTguv2; gp_Vec MyTg; - Standard_Boolean MyIsTangent; - Standard_Boolean MyHasBeenComputed; + bool MyIsTangent; + bool MyHasBeenComputed; gp_Pnt2d MyParOnS1bis; gp_Pnt2d MyParOnS2bis; gp_Pnt MyPntbis; gp_Vec2d MyTguv1bis; gp_Vec2d MyTguv2bis; gp_Vec MyTgbis; - Standard_Boolean MyIsTangentbis; - Standard_Boolean MyHasBeenComputedbis; - Standard_Boolean MyImplicitFirst; + bool MyIsTangentbis; + bool MyHasBeenComputedbis; + bool MyImplicitFirst; BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox MyZerImpFunc; }; diff --git a/opencascade/BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx b/opencascade/BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx index 2e6db5254..09e2c8ada 100644 --- a/opencascade/BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx +++ b/opencascade/BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox.hxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include class StdFail_NotDone; class Standard_DomainError; @@ -45,10 +45,10 @@ public: //! compute the solution point with the close point Standard_EXPORT BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox( - const TColStd_Array1OfReal& Param, - const BRepAdaptor_Surface& S1, - const BRepAdaptor_Surface& S2, - const Standard_Real TolTangency); + const NCollection_Array1& Param, + const BRepAdaptor_Surface& S1, + const BRepAdaptor_Surface& S2, + const double TolTangency); //! initialize the parameters to compute the solution point //! it 's possible to write to optimize: @@ -62,37 +62,37 @@ public: //! } Standard_EXPORT BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox(const BRepAdaptor_Surface& S1, const BRepAdaptor_Surface& S2, - const Standard_Real TolTangency); + const double TolTangency); //! returns the best constant isoparametric to find //! the next intersection's point +stores the solution //! point (the solution point is found with the close point //! to intersect the isoparametric with the other patch; //! the choice of the isoparametic is calculated) - Standard_EXPORT IntImp_ConstIsoparametric Perform(const TColStd_Array1OfReal& Param, - math_FunctionSetRoot& Rsnld); + Standard_EXPORT IntImp_ConstIsoparametric Perform(const NCollection_Array1& Param, + math_FunctionSetRoot& Rsnld); //! returns the best constant isoparametric to find //! the next intersection's point +stores the solution //! point (the solution point is found with the close point //! to intersect the isoparametric with the other patch; //! the choice of the isoparametic is given by ChoixIso) - Standard_EXPORT IntImp_ConstIsoparametric Perform(const TColStd_Array1OfReal& Param, - math_FunctionSetRoot& Rsnld, - const IntImp_ConstIsoparametric ChoixIso); + Standard_EXPORT IntImp_ConstIsoparametric Perform(const NCollection_Array1& Param, + math_FunctionSetRoot& Rsnld, + const IntImp_ConstIsoparametric ChoixIso); //! Returns TRUE if the creation completed without failure. - Standard_Boolean IsDone() const; + bool IsDone() const; //! Returns TRUE when there is no solution to the problem. - Standard_Boolean IsEmpty() const; + bool IsEmpty() const; //! Returns the intersection point. const IntSurf_PntOn2S& Point() const; //! Returns True if the surfaces are tangent at the //! intersection point. - Standard_Boolean IsTangent() const; + bool IsTangent() const; //! Returns the tangent at the intersection line. const gp_Dir& Direction() const; @@ -113,29 +113,28 @@ public: //! enable for changing. IntSurf_PntOn2S& ChangePoint(); -protected: private: - Standard_Boolean done; - Standard_Boolean empty; + bool done; + bool empty; IntSurf_PntOn2S pint; - Standard_Boolean tangent; + bool tangent; gp_Dir d3d; gp_Dir2d d2d1; gp_Dir2d d2d2; BRepApprox_TheFunctionOfTheInt2SOfThePrmPrmSvSurfacesOfApprox myZerParFunc; - Standard_Real tol; - Standard_Real ua0; - Standard_Real va0; - Standard_Real ua1; - Standard_Real va1; - Standard_Real ub0; - Standard_Real vb0; - Standard_Real ub1; - Standard_Real vb1; - Standard_Real ures1; - Standard_Real ures2; - Standard_Real vres1; - Standard_Real vres2; + double tol; + double ua0; + double va0; + double ua1; + double va1; + double ub0; + double vb0; + double ub1; + double vb1; + double ures1; + double ures2; + double vres1; + double vres2; }; #define ThePSurface BRepAdaptor_Surface diff --git a/opencascade/BRepApprox_TheMultiLineOfApprox.hxx b/opencascade/BRepApprox_TheMultiLineOfApprox.hxx index c1d10ecbd..c47805276 100644 --- a/opencascade/BRepApprox_TheMultiLineOfApprox.hxx +++ b/opencascade/BRepApprox_TheMultiLineOfApprox.hxx @@ -25,10 +25,11 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include class BRepApprox_ApproxLine; class ApproxInt_SvSurfaces; @@ -41,117 +42,111 @@ public: //! The class SvSurfaces is used when the approximation algorithm //! needs some extra points on the line . - //! A New line is then created which shares the same surfaces and functions. + //! A New line is then created which shares the same surfaces and functions. //! SvSurfaces is a deferred class which allows several implementations of - //! this algorithm with different surfaces (bi-parametric ones, or + //! this algorithm with different surfaces (bi-parametric ones, or //! implicit and biparametric ones) - Standard_EXPORT BRepApprox_TheMultiLineOfApprox(const Handle(BRepApprox_ApproxLine)& line, - const Standard_Address PtrSvSurfaces, - const Standard_Integer NbP3d, - const Standard_Integer NbP2d, - const Standard_Boolean ApproxU1V1, - const Standard_Boolean ApproxU2V2, - const Standard_Real xo, - const Standard_Real yo, - const Standard_Real zo, - const Standard_Real u1o, - const Standard_Real v1o, - const Standard_Real u2o, - const Standard_Real v2o, - const Standard_Boolean P2DOnFirst, - const Standard_Integer IndMin = 0, - const Standard_Integer IndMax = 0); + Standard_EXPORT BRepApprox_TheMultiLineOfApprox(const occ::handle& line, + void* const PtrSvSurfaces, + const int NbP3d, + const int NbP2d, + const bool ApproxU1V1, + const bool ApproxU2V2, + const double xo, + const double yo, + const double zo, + const double u1o, + const double v1o, + const double u2o, + const double v2o, + const bool P2DOnFirst, + const int IndMin = 0, + const int IndMax = 0); //! No Extra points will be added on the current line - Standard_EXPORT BRepApprox_TheMultiLineOfApprox(const Handle(BRepApprox_ApproxLine)& line, - const Standard_Integer NbP3d, - const Standard_Integer NbP2d, - const Standard_Boolean ApproxU1V1, - const Standard_Boolean ApproxU2V2, - const Standard_Real xo, - const Standard_Real yo, - const Standard_Real zo, - const Standard_Real u1o, - const Standard_Real v1o, - const Standard_Real u2o, - const Standard_Real v2o, - const Standard_Boolean P2DOnFirst, - const Standard_Integer IndMin = 0, - const Standard_Integer IndMax = 0); - - Standard_EXPORT Standard_Integer FirstPoint() const; - - Standard_EXPORT Standard_Integer LastPoint() const; + Standard_EXPORT BRepApprox_TheMultiLineOfApprox(const occ::handle& line, + const int NbP3d, + const int NbP2d, + const bool ApproxU1V1, + const bool ApproxU2V2, + const double xo, + const double yo, + const double zo, + const double u1o, + const double v1o, + const double u2o, + const double v2o, + const bool P2DOnFirst, + const int IndMin = 0, + const int IndMax = 0); + + Standard_EXPORT int FirstPoint() const; + + Standard_EXPORT int LastPoint() const; //! Returns the number of 2d points of a TheLine. - Standard_EXPORT Standard_Integer NbP2d() const; + Standard_EXPORT int NbP2d() const; //! Returns the number of 3d points of a TheLine. - Standard_EXPORT Standard_Integer NbP3d() const; + Standard_EXPORT int NbP3d() const; Standard_EXPORT Approx_Status WhatStatus() const; //! Returns the 3d points of the multipoint when only 3d points exist. - Standard_EXPORT void Value(const Standard_Integer MPointIndex, TColgp_Array1OfPnt& tabPt) const; + Standard_EXPORT void Value(const int MPointIndex, NCollection_Array1& tabPt) const; //! Returns the 2d points of the multipoint when only 2d points exist. - Standard_EXPORT void Value(const Standard_Integer MPointIndex, - TColgp_Array1OfPnt2d& tabPt2d) const; + Standard_EXPORT void Value(const int MPointIndex, NCollection_Array1& tabPt2d) const; //! Returns the 3d and 2d points of the multipoint . - Standard_EXPORT void Value(const Standard_Integer MPointIndex, - TColgp_Array1OfPnt& tabPt, - TColgp_Array1OfPnt2d& tabPt2d) const; + Standard_EXPORT void Value(const int MPointIndex, + NCollection_Array1& tabPt, + NCollection_Array1& tabPt2d) const; //! Returns the 3d tangency points of the multipoint only when 3d points exist. - Standard_EXPORT Standard_Boolean Tangency(const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV) const; + Standard_EXPORT bool Tangency(const int MPointIndex, NCollection_Array1& tabV) const; //! Returns the 2d tangency points of the multipoint only when 2d points exist. - Standard_EXPORT Standard_Boolean Tangency(const Standard_Integer MPointIndex, - TColgp_Array1OfVec2d& tabV2d) const; + Standard_EXPORT bool Tangency(const int MPointIndex, NCollection_Array1& tabV2d) const; //! Returns the 3d and 2d points of the multipoint . - Standard_EXPORT Standard_Boolean Tangency(const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV, - TColgp_Array1OfVec2d& tabV2d) const; + Standard_EXPORT bool Tangency(const int MPointIndex, + NCollection_Array1& tabV, + NCollection_Array1& tabV2d) const; //! Tries to make a sub-line between and points of this line //! by adding new points - Standard_EXPORT BRepApprox_TheMultiLineOfApprox - MakeMLBetween(const Standard_Integer Low, - const Standard_Integer High, - const Standard_Integer NbPointsToInsert) const; + Standard_EXPORT BRepApprox_TheMultiLineOfApprox MakeMLBetween(const int Low, + const int High, + const int NbPointsToInsert) const; //! Tries to make a sub-line between and points of this line //! by adding one more point between (indbad-1)-th and indbad-th points - Standard_EXPORT Standard_Boolean - MakeMLOneMorePoint(const Standard_Integer Low, - const Standard_Integer High, - const Standard_Integer indbad, - BRepApprox_TheMultiLineOfApprox& OtherLine) const; + Standard_EXPORT bool MakeMLOneMorePoint(const int Low, + const int High, + const int indbad, + BRepApprox_TheMultiLineOfApprox& OtherLine) const; //! Dump of the current multi-line. Standard_EXPORT void Dump() const; -protected: private: - Standard_Address PtrOnmySvSurfaces; - Handle(BRepApprox_ApproxLine) myLine; - Standard_Integer indicemin; - Standard_Integer indicemax; - Standard_Integer nbp3d; - Standard_Integer nbp2d; - Standard_Boolean myApproxU1V1; - Standard_Boolean myApproxU2V2; - Standard_Boolean p2donfirst; - Standard_Real Xo; - Standard_Real Yo; - Standard_Real Zo; - Standard_Real U1o; - Standard_Real V1o; - Standard_Real U2o; - Standard_Real V2o; + void* PtrOnmySvSurfaces; + occ::handle myLine; + int indicemin; + int indicemax; + int nbp3d; + int nbp2d; + bool myApproxU1V1; + bool myApproxU2V2; + bool p2donfirst; + double Xo; + double Yo; + double Zo; + double U1o; + double V1o; + double U2o; + double V2o; }; #endif // _BRepApprox_TheMultiLineOfApprox_HeaderFile diff --git a/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx b/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx index 595f7a8dd..6de9152bf 100644 --- a/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx +++ b/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include class BRepApprox_TheMultiLineOfApprox; class ApproxInt_SvSurfaces; @@ -32,96 +33,93 @@ public: DEFINE_STANDARD_ALLOC //! Returns the number of multipoints of the TheMultiLine. - static Standard_Integer FirstPoint(const BRepApprox_TheMultiLineOfApprox& ML); + static int FirstPoint(const BRepApprox_TheMultiLineOfApprox& ML); //! Returns the number of multipoints of the TheMultiLine. - static Standard_Integer LastPoint(const BRepApprox_TheMultiLineOfApprox& ML); + static int LastPoint(const BRepApprox_TheMultiLineOfApprox& ML); //! Returns the number of 2d points of a TheMultiLine. - static Standard_Integer NbP2d(const BRepApprox_TheMultiLineOfApprox& ML); + static int NbP2d(const BRepApprox_TheMultiLineOfApprox& ML); //! Returns the number of 3d points of a TheMultiLine. - static Standard_Integer NbP3d(const BRepApprox_TheMultiLineOfApprox& ML); + static int NbP3d(const BRepApprox_TheMultiLineOfApprox& ML); //! returns the 3d points of the multipoint //! when only 3d points exist. static void Value(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt& tabPt); + const int MPointIndex, + NCollection_Array1& tabPt); //! returns the 2d points of the multipoint //! when only 2d points exist. static void Value(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt2d& tabPt2d); + const int MPointIndex, + NCollection_Array1& tabPt2d); //! returns the 3d and 2d points of the multipoint //! . static void Value(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfPnt& tabPt, - TColgp_Array1OfPnt2d& tabPt2d); + const int MPointIndex, + NCollection_Array1& tabPt, + NCollection_Array1& tabPt2d); //! returns the 3d points of the multipoint //! when only 3d points exist. - static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV); + static bool Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV); //! returns the 2d tangency points of the multipoint //! only when 2d points exist. - static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec2d& tabV2d); + static bool Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV2d); //! returns the 3d and 2d points of the multipoint //! . - static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV, - TColgp_Array1OfVec2d& tabV2d); + static bool Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV, + NCollection_Array1& tabV2d); //! returns the 3d curvature of the multipoint //! when only 3d points exist. - static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV); + static bool Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV); //! returns the 2d curvature points of the multipoint //! only when 2d points exist. - static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec2d& tabV2d); + static bool Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV2d); //! returns the 3d and 2d curvature of the multipoint //! . - static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer MPointIndex, - TColgp_Array1OfVec& tabV, - TColgp_Array1OfVec2d& tabV2d); + static bool Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const int MPointIndex, + NCollection_Array1& tabV, + NCollection_Array1& tabV2d); //! Is called if WhatStatus returned "PointsAdded". static BRepApprox_TheMultiLineOfApprox MakeMLBetween(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer NbPMin); + const int I1, + const int I2, + const int NbPMin); //! Is called when the Bezier curve contains a loop - static Standard_Boolean MakeMLOneMorePoint(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer I1, - const Standard_Integer I2, - const Standard_Integer indbad, - BRepApprox_TheMultiLineOfApprox& OtherLine); + static bool MakeMLOneMorePoint(const BRepApprox_TheMultiLineOfApprox& ML, + const int I1, + const int I2, + const int indbad, + BRepApprox_TheMultiLineOfApprox& OtherLine); static Approx_Status WhatStatus(const BRepApprox_TheMultiLineOfApprox& ML, - const Standard_Integer I1, - const Standard_Integer I2); + const int I1, + const int I2); //! Dump of the current multi-line. static void Dump(const BRepApprox_TheMultiLineOfApprox& ML); - -protected: -private: }; #define TheMultiLine BRepApprox_TheMultiLineOfApprox diff --git a/opencascade/BRepApprox_ThePrmPrmSvSurfacesOfApprox.hxx b/opencascade/BRepApprox_ThePrmPrmSvSurfacesOfApprox.hxx index be2be9cef..2f2e8c999 100644 --- a/opencascade/BRepApprox_ThePrmPrmSvSurfacesOfApprox.hxx +++ b/opencascade/BRepApprox_ThePrmPrmSvSurfacesOfApprox.hxx @@ -46,46 +46,45 @@ public: const BRepAdaptor_Surface& Surf2); //! returns True if Tg,Tguv1 Tguv2 can be computed. - Standard_EXPORT Standard_Boolean Compute(Standard_Real& u1, - Standard_Real& v1, - Standard_Real& u2, - Standard_Real& v2, - gp_Pnt& Pt, - gp_Vec& Tg, - gp_Vec2d& Tguv1, - gp_Vec2d& Tguv2); + Standard_EXPORT bool Compute(double& u1, + double& v1, + double& u2, + double& v2, + gp_Pnt& Pt, + gp_Vec& Tg, + gp_Vec2d& Tguv1, + gp_Vec2d& Tguv2) override; - Standard_EXPORT void Pnt(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Pnt& P); + Standard_EXPORT void Pnt(const double u1, + const double v1, + const double u2, + const double v2, + gp_Pnt& P) override; - Standard_EXPORT Standard_Boolean SeekPoint(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - IntSurf_PntOn2S& Point); + Standard_EXPORT bool SeekPoint(const double u1, + const double v1, + const double u2, + const double v2, + IntSurf_PntOn2S& Point) override; - Standard_EXPORT Standard_Boolean Tangency(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec& Tg); + Standard_EXPORT bool Tangency(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec& Tg) override; - Standard_EXPORT Standard_Boolean TangencyOnSurf1(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg); + Standard_EXPORT bool TangencyOnSurf1(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) override; - Standard_EXPORT Standard_Boolean TangencyOnSurf2(const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec2d& Tg); + Standard_EXPORT bool TangencyOnSurf2(const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec2d& Tg) override; -protected: private: gp_Pnt2d MyParOnS1; gp_Pnt2d MyParOnS2; @@ -93,16 +92,16 @@ private: gp_Vec2d MyTguv1; gp_Vec2d MyTguv2; gp_Vec MyTg; - Standard_Boolean MyIsTangent; - Standard_Boolean MyHasBeenComputed; + bool MyIsTangent; + bool MyHasBeenComputed; gp_Pnt2d MyParOnS1bis; gp_Pnt2d MyParOnS2bis; gp_Pnt MyPntbis; gp_Vec2d MyTguv1bis; gp_Vec2d MyTguv2bis; gp_Vec MyTgbis; - Standard_Boolean MyIsTangentbis; - Standard_Boolean MyHasBeenComputedbis; + bool MyIsTangentbis; + bool MyHasBeenComputedbis; BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox MyIntersectionOn2S; }; diff --git a/opencascade/BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox.hxx b/opencascade/BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox.hxx index 20cd8e1cd..43e614016 100644 --- a/opencascade/BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox.hxx +++ b/opencascade/BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox.hxx @@ -52,27 +52,27 @@ public: void SetImplicitSurface(const IntSurf_Quadric& IS); - void Set(const Standard_Real Tolerance); + void Set(const double Tolerance); - Standard_EXPORT Standard_Integer NbVariables() const; + Standard_EXPORT int NbVariables() const override; - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_Real Root() const; + double Root() const; - //! Returns the value Tol so that if Abs(Func.Root())& Line, + Blend_Function& Func, + const double Tol3d, + const double Tol2d); Standard_EXPORT void Point(const Blend_AppFunction& Func, - const Standard_Real Param, + const double Param, const math_Vector& Sol, - Blend_Point& Pnt) const Standard_OVERRIDE; + Blend_Point& Pnt) const override; - Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const Standard_OVERRIDE; + Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const override; DEFINE_STANDARD_RTTIEXT(BRepBlend_AppFunc, BRepBlend_AppFuncRoot) - -protected: -private: }; #endif // _BRepBlend_AppFunc_HeaderFile diff --git a/opencascade/BRepBlend_AppFuncRoot.hxx b/opencascade/BRepBlend_AppFuncRoot.hxx index 78bdd111f..1897f9f96 100644 --- a/opencascade/BRepBlend_AppFuncRoot.hxx +++ b/opencascade/BRepBlend_AppFuncRoot.hxx @@ -24,19 +24,18 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include #include + +#include + class BRepBlend_Line; class Blend_AppFunction; - -class BRepBlend_AppFuncRoot; -DEFINE_STANDARD_HANDLE(BRepBlend_AppFuncRoot, Approx_SweepFunction) +class math_FunctionSetRoot; //! Function to approximate by AppSurface class BRepBlend_AppFuncRoot : public Approx_SweepFunction @@ -44,118 +43,112 @@ class BRepBlend_AppFuncRoot : public Approx_SweepFunction public: //! compute the section for v = param - Standard_EXPORT virtual Standard_Boolean D0(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; - - //! compute the first derivative in v direction of the - //! section for v = param - Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; - - //! compute the second derivative in v direction of the - //! section for v = param - Standard_EXPORT virtual Standard_Boolean D2(const Standard_Real Param, - const Standard_Real First, - const Standard_Real Last, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE; - - //! get the number of 2d curves to approximate. - Standard_EXPORT virtual Standard_Integer Nb2dCurves() const Standard_OVERRIDE; - - //! get the format of an section - Standard_EXPORT virtual void SectionShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree) const Standard_OVERRIDE; + Standard_EXPORT bool D0(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) override; + + //! compute the first derivative in v direction of the + //! section for v = param + Standard_EXPORT bool D1(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths) override; + + //! compute the second derivative in v direction of the + //! section for v = param + Standard_EXPORT bool D2(const double Param, + const double First, + const double Last, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths) override; + + //! get the number of 2d curves to approximate. + Standard_EXPORT int Nb2dCurves() const override; + + //! get the format of an section + Standard_EXPORT void SectionShape(int& NbPoles, int& NbKnots, int& Degree) const override; //! get the Knots of the section - Standard_EXPORT virtual void Knots(TColStd_Array1OfReal& TKnots) const Standard_OVERRIDE; + Standard_EXPORT void Knots(NCollection_Array1& TKnots) const override; //! get the Multplicities of the section - Standard_EXPORT virtual void Mults(TColStd_Array1OfInteger& TMults) const Standard_OVERRIDE; + Standard_EXPORT void Mults(NCollection_Array1& TMults) const override; //! Returns if the section is rational or not - Standard_EXPORT virtual Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool IsRational() const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const - Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; //! Sets the bounds of the parametric interval on //! the fonction //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT virtual void SetInterval(const Standard_Real First, - const Standard_Real Last) Standard_OVERRIDE; + Standard_EXPORT void SetInterval(const double First, const double Last) override; - //! Returns the resolutions in the sub-space 2d -- - //! This information is usfull to find an good tolerance in + //! Returns the resolutions in the sub-space 2d -- + //! This information is useful to find a good tolerance in //! 2d approximation - Standard_EXPORT virtual void Resolution(const Standard_Integer Index, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const Standard_OVERRIDE; + Standard_EXPORT void Resolution(const int Index, + const double Tol, + double& TolU, + double& TolV) const override; //! Returns the tolerance to reach in approximation //! to respect //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary (in radian) //! SurfTol error inside the surface. - Standard_EXPORT virtual void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - TColStd_Array1OfReal& Tol3d) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + NCollection_Array1& Tol3d) const override; - //! Is usfull, if (me) have to be run numerical - //! algorithme to perform D0, D1 or D2 - Standard_EXPORT virtual void SetTolerance(const Standard_Real Tol3d, - const Standard_Real Tol2d) Standard_OVERRIDE; + //! Is useful, if (me) has to be run numerical + //! algorithm to perform D0, D1 or D2 + Standard_EXPORT void SetTolerance(const double Tol3d, const double Tol2d) override; - //! Get the barycentre of Surface. An very poor + //! Get the barycentre of Surface. An very poor //! estimation is sufficient. This information is useful //! to perform well conditioned rational approximation. - Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const Standard_OVERRIDE; + Standard_EXPORT gp_Pnt BarycentreOfSurf() const override; - //! Returns the length of the maximum section. This + //! Returns the length of the maximum section. This //! information is useful to perform well conditioned rational //! approximation. - Standard_EXPORT virtual Standard_Real MaximalSection() const Standard_OVERRIDE; + Standard_EXPORT double MaximalSection() const override; //! Compute the minimal value of weight for each poles - //! of all sections. This information is useful to + //! of all sections. This information is useful to //! perform well conditioned rational approximation. - Standard_EXPORT virtual void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const - Standard_OVERRIDE; + Standard_EXPORT void GetMinimalWeight(NCollection_Array1& Weigths) const override; Standard_EXPORT virtual void Point(const Blend_AppFunction& Func, - const Standard_Real Param, + const double Param, const math_Vector& Sol, Blend_Point& Pnt) const = 0; @@ -163,31 +156,32 @@ public: DEFINE_STANDARD_RTTIEXT(BRepBlend_AppFuncRoot, Approx_SweepFunction) + Standard_EXPORT ~BRepBlend_AppFuncRoot(); + protected: - Standard_EXPORT BRepBlend_AppFuncRoot(Handle(BRepBlend_Line)& Line, - Blend_AppFunction& Func, - const Standard_Real Tol3d, - const Standard_Real Tol2d); + Standard_EXPORT BRepBlend_AppFuncRoot(occ::handle& Line, + Blend_AppFunction& Func, + const double Tol3d, + const double Tol2d); private: - Standard_EXPORT Standard_Boolean SearchPoint(Blend_AppFunction& Func, - const Standard_Real Param, - Blend_Point& Pnt); - - Standard_EXPORT Standard_Boolean SearchLocation(const Standard_Real Param, - const Standard_Integer FirstIndex, - const Standard_Integer LastIndex, - Standard_Integer& ParamIndex) const; - - Handle(BRepBlend_Line) myLine; - Standard_Address myFunc; - math_Vector myTolerance; - Blend_Point myPnt; - gp_Pnt myBary; - math_Vector X1; - math_Vector X2; - math_Vector XInit; - math_Vector Sol; + Standard_EXPORT bool SearchPoint(Blend_AppFunction& Func, const double Param, Blend_Point& Pnt); + + Standard_EXPORT bool SearchLocation(const double Param, + const int FirstIndex, + const int LastIndex, + int& ParamIndex) const; + + occ::handle myLine; + void* myFunc; + math_Vector myTolerance; + Blend_Point myPnt; + gp_Pnt myBary; + math_Vector X1; + math_Vector X2; + math_Vector XInit; + math_Vector Sol; + std::unique_ptr mySolver; }; #endif // _BRepBlend_AppFuncRoot_HeaderFile diff --git a/opencascade/BRepBlend_AppFuncRst.hxx b/opencascade/BRepBlend_AppFuncRst.hxx index 773a697e6..cecf59a47 100644 --- a/opencascade/BRepBlend_AppFuncRst.hxx +++ b/opencascade/BRepBlend_AppFuncRst.hxx @@ -27,30 +27,24 @@ class Blend_SurfRstFunction; class Blend_AppFunction; class Blend_Point; -class BRepBlend_AppFuncRst; -DEFINE_STANDARD_HANDLE(BRepBlend_AppFuncRst, BRepBlend_AppFuncRoot) - -//! Function to approximate by AppSurface for Curve/Surface contact. +//! Function to approximate by AppSurface for Curve/Surface contact. class BRepBlend_AppFuncRst : public BRepBlend_AppFuncRoot { public: - Standard_EXPORT BRepBlend_AppFuncRst(Handle(BRepBlend_Line)& Line, - Blend_SurfRstFunction& Func, - const Standard_Real Tol3d, - const Standard_Real Tol2d); + Standard_EXPORT BRepBlend_AppFuncRst(occ::handle& Line, + Blend_SurfRstFunction& Func, + const double Tol3d, + const double Tol2d); Standard_EXPORT void Point(const Blend_AppFunction& Func, - const Standard_Real Param, + const double Param, const math_Vector& Sol, - Blend_Point& Pnt) const Standard_OVERRIDE; + Blend_Point& Pnt) const override; - Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const Standard_OVERRIDE; + Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const override; DEFINE_STANDARD_RTTIEXT(BRepBlend_AppFuncRst, BRepBlend_AppFuncRoot) - -protected: -private: }; #endif // _BRepBlend_AppFuncRst_HeaderFile diff --git a/opencascade/BRepBlend_AppFuncRstRst.hxx b/opencascade/BRepBlend_AppFuncRstRst.hxx index 135e2622a..d96b6ff10 100644 --- a/opencascade/BRepBlend_AppFuncRstRst.hxx +++ b/opencascade/BRepBlend_AppFuncRstRst.hxx @@ -27,30 +27,24 @@ class Blend_RstRstFunction; class Blend_AppFunction; class Blend_Point; -class BRepBlend_AppFuncRstRst; -DEFINE_STANDARD_HANDLE(BRepBlend_AppFuncRstRst, BRepBlend_AppFuncRoot) - //! Function to approximate by AppSurface for Edge/Face (Curve/Curve contact). class BRepBlend_AppFuncRstRst : public BRepBlend_AppFuncRoot { public: - Standard_EXPORT BRepBlend_AppFuncRstRst(Handle(BRepBlend_Line)& Line, - Blend_RstRstFunction& Func, - const Standard_Real Tol3d, - const Standard_Real Tol2d); + Standard_EXPORT BRepBlend_AppFuncRstRst(occ::handle& Line, + Blend_RstRstFunction& Func, + const double Tol3d, + const double Tol2d); Standard_EXPORT void Point(const Blend_AppFunction& Func, - const Standard_Real Param, + const double Param, const math_Vector& Sol, - Blend_Point& Pnt) const Standard_OVERRIDE; + Blend_Point& Pnt) const override; - Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const Standard_OVERRIDE; + Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const override; DEFINE_STANDARD_RTTIEXT(BRepBlend_AppFuncRstRst, BRepBlend_AppFuncRoot) - -protected: -private: }; #endif // _BRepBlend_AppFuncRstRst_HeaderFile diff --git a/opencascade/BRepBlend_AppSurf.hxx b/opencascade/BRepBlend_AppSurf.hxx index 591e8506d..eeb473acf 100644 --- a/opencascade/BRepBlend_AppSurf.hxx +++ b/opencascade/BRepBlend_AppSurf.hxx @@ -24,19 +24,16 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include class StdFail_NotDone; class Standard_DomainError; class Standard_OutOfRange; @@ -50,19 +47,19 @@ public: Standard_EXPORT BRepBlend_AppSurf(); - Standard_EXPORT BRepBlend_AppSurf(const Standard_Integer Degmin, - const Standard_Integer Degmax, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIt, - const Standard_Boolean KnownParameters = Standard_False); + Standard_EXPORT BRepBlend_AppSurf(const int Degmin, + const int Degmax, + const double Tol3d, + const double Tol2d, + const int NbIt, + const bool KnownParameters = false); - Standard_EXPORT void Init(const Standard_Integer Degmin, - const Standard_Integer Degmax, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Integer NbIt, - const Standard_Boolean KnownParameters = Standard_False); + Standard_EXPORT void Init(const int Degmin, + const int Degmax, + const double Tol3d, + const double Tol2d, + const int NbIt, + const bool KnownParameters = false); //! Define the type of parametrization used in the approximation Standard_EXPORT void SetParType(const Approx_ParametrizationType ParType); @@ -70,13 +67,11 @@ public: //! Define the Continuity used in the approximation Standard_EXPORT void SetContinuity(const GeomAbs_Shape C); - //! define the Weights associed to the criterium used in - //! the optimization. + //! define the Weights associed to the criterium used in + //! the optimization. //! //! if Wi <= 0 - Standard_EXPORT void SetCriteriumWeight(const Standard_Real W1, - const Standard_Real W2, - const Standard_Real W3); + Standard_EXPORT void SetCriteriumWeight(const double W1, const double W2, const double W3); //! returns the type of parametrization used in the approximation Standard_EXPORT Approx_ParametrizationType ParType() const; @@ -84,111 +79,106 @@ public: //! returns the Continuity used in the approximation Standard_EXPORT GeomAbs_Shape Continuity() const; - //! returns the Weights (as percent) associed to the criterium used in - //! the optimization. - Standard_EXPORT void CriteriumWeight(Standard_Real& W1, - Standard_Real& W2, - Standard_Real& W3) const; + //! returns the Weights (as percent) associed to the criterium used in + //! the optimization. + Standard_EXPORT void CriteriumWeight(double& W1, double& W2, double& W3) const; - Standard_EXPORT void Perform(const Handle(BRepBlend_Line)& Lin, - Blend_AppFunction& SecGen, - const Standard_Boolean SpApprox = Standard_False); + Standard_EXPORT void Perform(const occ::handle& Lin, + Blend_AppFunction& SecGen, + const bool SpApprox = false); - Standard_EXPORT void PerformSmoothing(const Handle(BRepBlend_Line)& Lin, - Blend_AppFunction& SecGen); + Standard_EXPORT void PerformSmoothing(const occ::handle& Lin, + Blend_AppFunction& SecGen); - Standard_EXPORT void Perform(const Handle(BRepBlend_Line)& Lin, - Blend_AppFunction& SecGen, - const Standard_Integer NbMaxP); + Standard_EXPORT void Perform(const occ::handle& Lin, + Blend_AppFunction& SecGen, + const int NbMaxP); - Standard_Boolean IsDone() const; + bool IsDone() const override; - Standard_EXPORT void SurfShape(Standard_Integer& UDegree, - Standard_Integer& VDegree, - Standard_Integer& NbUPoles, - Standard_Integer& NbVPoles, - Standard_Integer& NbUKnots, - Standard_Integer& NbVKnots) const; + Standard_EXPORT void SurfShape(int& UDegree, + int& VDegree, + int& NbUPoles, + int& NbVPoles, + int& NbUKnots, + int& NbVKnots) const override; - Standard_EXPORT void Surface(TColgp_Array2OfPnt& TPoles, - TColStd_Array2OfReal& TWeights, - TColStd_Array1OfReal& TUKnots, - TColStd_Array1OfReal& TVKnots, - TColStd_Array1OfInteger& TUMults, - TColStd_Array1OfInteger& TVMults) const; + Standard_EXPORT void Surface(NCollection_Array2& TPoles, + NCollection_Array2& TWeights, + NCollection_Array1& TUKnots, + NCollection_Array1& TVKnots, + NCollection_Array1& TUMults, + NCollection_Array1& TVMults) const override; - Standard_Integer UDegree() const; + int UDegree() const override; - Standard_Integer VDegree() const; + int VDegree() const override; - const TColgp_Array2OfPnt& SurfPoles() const; + const NCollection_Array2& SurfPoles() const override; - const TColStd_Array2OfReal& SurfWeights() const; + const NCollection_Array2& SurfWeights() const override; - const TColStd_Array1OfReal& SurfUKnots() const; + const NCollection_Array1& SurfUKnots() const override; - const TColStd_Array1OfReal& SurfVKnots() const; + const NCollection_Array1& SurfVKnots() const override; - const TColStd_Array1OfInteger& SurfUMults() const; + const NCollection_Array1& SurfUMults() const override; - const TColStd_Array1OfInteger& SurfVMults() const; + const NCollection_Array1& SurfVMults() const override; - Standard_Integer NbCurves2d() const; + int NbCurves2d() const override; - Standard_EXPORT void Curves2dShape(Standard_Integer& Degree, - Standard_Integer& NbPoles, - Standard_Integer& NbKnots) const; + Standard_EXPORT void Curves2dShape(int& Degree, int& NbPoles, int& NbKnots) const override; - Standard_EXPORT void Curve2d(const Standard_Integer Index, - TColgp_Array1OfPnt2d& TPoles, - TColStd_Array1OfReal& TKnots, - TColStd_Array1OfInteger& TMults) const; + Standard_EXPORT void Curve2d(const int Index, + NCollection_Array1& TPoles, + NCollection_Array1& TKnots, + NCollection_Array1& TMults) const override; - Standard_Integer Curves2dDegree() const; + int Curves2dDegree() const override; - const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const; + const NCollection_Array1& Curve2dPoles(const int Index) const override; - const TColStd_Array1OfReal& Curves2dKnots() const; + const NCollection_Array1& Curves2dKnots() const override; - const TColStd_Array1OfInteger& Curves2dMults() const; + const NCollection_Array1& Curves2dMults() const override; - void TolReached(Standard_Real& Tol3d, Standard_Real& Tol2d) const; + void TolReached(double& Tol3d, double& Tol2d) const override; - Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const; + Standard_EXPORT double TolCurveOnSurf(const int Index) const override; -protected: private: - Standard_EXPORT void InternalPerform(const Handle(BRepBlend_Line)& Lin, - Blend_AppFunction& SecGen, - const Standard_Boolean SpApprox, - const Standard_Boolean UseVariational); - - Standard_Boolean done; - Standard_Integer dmin; - Standard_Integer dmax; - Standard_Real tol3d; - Standard_Real tol2d; - Standard_Integer nbit; - Standard_Integer udeg; - Standard_Integer vdeg; - Standard_Boolean knownp; - Handle(TColgp_HArray2OfPnt) tabPoles; - Handle(TColStd_HArray2OfReal) tabWeights; - Handle(TColStd_HArray1OfReal) tabUKnots; - Handle(TColStd_HArray1OfReal) tabVKnots; - Handle(TColStd_HArray1OfInteger) tabUMults; - Handle(TColStd_HArray1OfInteger) tabVMults; - TColgp_SequenceOfArray1OfPnt2d seqPoles2d; - Standard_Real tol3dreached; - Standard_Real tol2dreached; - Approx_ParametrizationType paramtype; - GeomAbs_Shape continuity; - Standard_Real critweights[3]; + Standard_EXPORT void InternalPerform(const occ::handle& Lin, + Blend_AppFunction& SecGen, + const bool SpApprox, + const bool UseVariational); + + bool done; + int dmin; + int dmax; + double tol3d; + double tol2d; + int nbit; + int udeg; + int vdeg; + bool knownp; + occ::handle> tabPoles; + occ::handle> tabWeights; + occ::handle> tabUKnots; + occ::handle> tabVKnots; + occ::handle> tabUMults; + occ::handle> tabVMults; + NCollection_Sequence>> seqPoles2d; + double tol3dreached; + double tol2dreached; + Approx_ParametrizationType paramtype; + GeomAbs_Shape continuity; + double critweights[3]; }; #define TheSectionGenerator Blend_AppFunction #define TheSectionGenerator_hxx -#define Handle_TheLine Handle(BRepBlend_Line) +#define Handle_TheLine occ::handle #define TheLine BRepBlend_Line #define TheLine_hxx #define AppBlend_AppSurf BRepBlend_AppSurf diff --git a/opencascade/BRepBlend_AppSurface.hxx b/opencascade/BRepBlend_AppSurface.hxx index 620797578..d1b2083fb 100644 --- a/opencascade/BRepBlend_AppSurface.hxx +++ b/opencascade/BRepBlend_AppSurface.hxx @@ -25,11 +25,10 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include class Approx_SweepFunction; @@ -39,88 +38,85 @@ class BRepBlend_AppSurface : public AppBlend_Approx public: DEFINE_STANDARD_ALLOC - //! Approximation of the new Surface (and - //! eventually the 2d Curves on the support + //! Approximation of the new Surface (and + //! eventually the 2d Curves on the support //! surfaces). - //! Normally the 2d curve are - //! approximated with an tolerance given by the - //! resolution on support surfaces, but if this - //! tolerance is too large Tol2d is used. - Standard_EXPORT BRepBlend_AppSurface(const Handle(Approx_SweepFunction)& Funct, - const Standard_Real First, - const Standard_Real Last, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Real TolAngular, - const GeomAbs_Shape Continuity = GeomAbs_C0, - const Standard_Integer Degmax = 11, - const Standard_Integer Segmax = 50); + //! Normally the 2d curve are + //! approximated with a tolerance given by the + //! resolution on support surfaces, but if this + //! tolerance is too large Tol2d is used. + Standard_EXPORT BRepBlend_AppSurface(const occ::handle& Funct, + const double First, + const double Last, + const double Tol3d, + const double Tol2d, + const double TolAngular, + const GeomAbs_Shape Continuity = GeomAbs_C0, + const int Degmax = 11, + const int Segmax = 50); - Standard_Boolean IsDone() const; + bool IsDone() const override; - Standard_EXPORT void SurfShape(Standard_Integer& UDegree, - Standard_Integer& VDegree, - Standard_Integer& NbUPoles, - Standard_Integer& NbVPoles, - Standard_Integer& NbUKnots, - Standard_Integer& NbVKnots) const; + Standard_EXPORT void SurfShape(int& UDegree, + int& VDegree, + int& NbUPoles, + int& NbVPoles, + int& NbUKnots, + int& NbVKnots) const override; - Standard_EXPORT void Surface(TColgp_Array2OfPnt& TPoles, - TColStd_Array2OfReal& TWeights, - TColStd_Array1OfReal& TUKnots, - TColStd_Array1OfReal& TVKnots, - TColStd_Array1OfInteger& TUMults, - TColStd_Array1OfInteger& TVMults) const; + Standard_EXPORT void Surface(NCollection_Array2& TPoles, + NCollection_Array2& TWeights, + NCollection_Array1& TUKnots, + NCollection_Array1& TVKnots, + NCollection_Array1& TUMults, + NCollection_Array1& TVMults) const override; - Standard_Integer UDegree() const; + int UDegree() const override; - Standard_Integer VDegree() const; + int VDegree() const override; - const TColgp_Array2OfPnt& SurfPoles() const; + const NCollection_Array2& SurfPoles() const override; - const TColStd_Array2OfReal& SurfWeights() const; + const NCollection_Array2& SurfWeights() const override; - const TColStd_Array1OfReal& SurfUKnots() const; + const NCollection_Array1& SurfUKnots() const override; - const TColStd_Array1OfReal& SurfVKnots() const; + const NCollection_Array1& SurfVKnots() const override; - const TColStd_Array1OfInteger& SurfUMults() const; + const NCollection_Array1& SurfUMults() const override; - const TColStd_Array1OfInteger& SurfVMults() const; + const NCollection_Array1& SurfVMults() const override; //! returns the maximum error in the surface approximation. - Standard_EXPORT Standard_Real MaxErrorOnSurf() const; + Standard_EXPORT double MaxErrorOnSurf() const; - Standard_Integer NbCurves2d() const; + int NbCurves2d() const override; - Standard_EXPORT void Curves2dShape(Standard_Integer& Degree, - Standard_Integer& NbPoles, - Standard_Integer& NbKnots) const; + Standard_EXPORT void Curves2dShape(int& Degree, int& NbPoles, int& NbKnots) const override; - Standard_EXPORT void Curve2d(const Standard_Integer Index, - TColgp_Array1OfPnt2d& TPoles, - TColStd_Array1OfReal& TKnots, - TColStd_Array1OfInteger& TMults) const; + Standard_EXPORT void Curve2d(const int Index, + NCollection_Array1& TPoles, + NCollection_Array1& TKnots, + NCollection_Array1& TMults) const override; - Standard_Integer Curves2dDegree() const; + int Curves2dDegree() const override; - const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const; + const NCollection_Array1& Curve2dPoles(const int Index) const override; - const TColStd_Array1OfReal& Curves2dKnots() const; + const NCollection_Array1& Curves2dKnots() const override; - const TColStd_Array1OfInteger& Curves2dMults() const; + const NCollection_Array1& Curves2dMults() const override; - Standard_EXPORT void TolReached(Standard_Real& Tol3d, Standard_Real& Tol2d) const; + Standard_EXPORT void TolReached(double& Tol3d, double& Tol2d) const override; //! returns the maximum error in the 2d curve approximation. - Standard_EXPORT Standard_Real Max2dError(const Standard_Integer Index) const; + Standard_EXPORT double Max2dError(const int Index) const; - Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const; + Standard_EXPORT double TolCurveOnSurf(const int Index) const override; //! display information on approximation. Standard_EXPORT void Dump(Standard_OStream& o) const; -protected: private: Approx_SweepApproximation approx; }; diff --git a/opencascade/BRepBlend_AppSurface.lxx b/opencascade/BRepBlend_AppSurface.lxx index 4fb914616..1be91c2ac 100644 --- a/opencascade/BRepBlend_AppSurface.lxx +++ b/opencascade/BRepBlend_AppSurface.lxx @@ -15,79 +15,80 @@ // commercial license or contractual agreement. #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -inline Standard_Boolean BRepBlend_AppSurface::IsDone() const +inline bool BRepBlend_AppSurface::IsDone() const { return approx.IsDone(); } -inline Standard_Integer BRepBlend_AppSurface::UDegree() const +inline int BRepBlend_AppSurface::UDegree() const { return approx.UDegree(); } -inline Standard_Integer BRepBlend_AppSurface::VDegree() const +inline int BRepBlend_AppSurface::VDegree() const { return approx.VDegree(); } -inline const TColgp_Array2OfPnt& BRepBlend_AppSurface::SurfPoles() const +inline const NCollection_Array2& BRepBlend_AppSurface::SurfPoles() const { return approx.SurfPoles(); } -inline const TColStd_Array2OfReal& BRepBlend_AppSurface::SurfWeights() const +inline const NCollection_Array2& BRepBlend_AppSurface::SurfWeights() const { return approx.SurfWeights(); } -inline const TColStd_Array1OfReal& BRepBlend_AppSurface::SurfUKnots() const +inline const NCollection_Array1& BRepBlend_AppSurface::SurfUKnots() const { return approx.SurfUKnots(); } -inline const TColStd_Array1OfReal& BRepBlend_AppSurface::SurfVKnots() const +inline const NCollection_Array1& BRepBlend_AppSurface::SurfVKnots() const { return approx.SurfVKnots(); } -inline const TColStd_Array1OfInteger& BRepBlend_AppSurface::SurfUMults() const +inline const NCollection_Array1& BRepBlend_AppSurface::SurfUMults() const { return approx.SurfUMults(); } -inline const TColStd_Array1OfInteger& BRepBlend_AppSurface::SurfVMults() const +inline const NCollection_Array1& BRepBlend_AppSurface::SurfVMults() const { return approx.SurfVMults(); } -inline Standard_Integer BRepBlend_AppSurface::NbCurves2d() const +inline int BRepBlend_AppSurface::NbCurves2d() const { return approx.NbCurves2d(); } -inline Standard_Integer BRepBlend_AppSurface::Curves2dDegree() const +inline int BRepBlend_AppSurface::Curves2dDegree() const { return approx.Curves2dDegree(); } -inline const TColgp_Array1OfPnt2d& BRepBlend_AppSurface::Curve2dPoles( - const Standard_Integer Index) const +inline const NCollection_Array1& BRepBlend_AppSurface::Curve2dPoles(const int Index) const { return approx.Curve2dPoles(Index); } -inline const TColStd_Array1OfReal& BRepBlend_AppSurface::Curves2dKnots() const +inline const NCollection_Array1& BRepBlend_AppSurface::Curves2dKnots() const { return approx.Curves2dKnots(); } -inline const TColStd_Array1OfInteger& BRepBlend_AppSurface::Curves2dMults() const +inline const NCollection_Array1& BRepBlend_AppSurface::Curves2dMults() const { return approx.Curves2dMults(); } diff --git a/opencascade/BRepBlend_BlendTool.hxx b/opencascade/BRepBlend_BlendTool.hxx index c56c30b21..71a3c8495 100644 --- a/opencascade/BRepBlend_BlendTool.hxx +++ b/opencascade/BRepBlend_BlendTool.hxx @@ -29,65 +29,62 @@ public: DEFINE_STANDARD_ALLOC //! Projects the point P on the arc C. - //! If the methods returns Standard_True, the projection is + //! If the methods returns true, the projection is //! successful, and Paramproj is the parameter on the arc //! of the projected point, Dist is the distance between //! P and the curve.. - //! If the method returns Standard_False, Param proj and Dist + //! If the method returns false, Param proj and Dist //! are not significant. - Standard_EXPORT static Standard_Boolean Project(const gp_Pnt2d& P, - const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor2d_Curve2d)& C, - Standard_Real& Paramproj, - Standard_Real& Dist); - - Standard_EXPORT static Standard_Boolean Inters(const gp_Pnt2d& P1, - const gp_Pnt2d& P2, - const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor2d_Curve2d)& C, - Standard_Real& Param, - Standard_Real& Dist); + Standard_EXPORT static bool Project(const gp_Pnt2d& P, + const occ::handle& S, + const occ::handle& C, + double& Paramproj, + double& Dist); + + Standard_EXPORT static bool Inters(const gp_Pnt2d& P1, + const gp_Pnt2d& P2, + const occ::handle& S, + const occ::handle& C, + double& Param, + double& Dist); //! Returns the parameter of the vertex V on the edge A. - static Standard_Real Parameter(const Handle(Adaptor3d_HVertex)& V, - const Handle(Adaptor2d_Curve2d)& A); + static double Parameter(const occ::handle& V, + const occ::handle& A); //! Returns the parametric tolerance on the arc A //! used to consider that the vertex and another point meet, - //! i-e if Abs(Parameter(Vertex)-Parameter(OtherPnt))<= + //! i-e if std::abs(Parameter(Vertex)-Parameter(OtherPnt))<= //! Tolerance, the points are "merged". - static Standard_Real Tolerance(const Handle(Adaptor3d_HVertex)& V, - const Handle(Adaptor2d_Curve2d)& A); + static double Tolerance(const occ::handle& V, + const occ::handle& A); - static Standard_Boolean SingularOnUMin(const Handle(Adaptor3d_Surface)& S); + static bool SingularOnUMin(const occ::handle& S); - static Standard_Boolean SingularOnUMax(const Handle(Adaptor3d_Surface)& S); + static bool SingularOnUMax(const occ::handle& S); - static Standard_Boolean SingularOnVMin(const Handle(Adaptor3d_Surface)& S); + static bool SingularOnVMin(const occ::handle& S); - static Standard_Boolean SingularOnVMax(const Handle(Adaptor3d_Surface)& S); + static bool SingularOnVMax(const occ::handle& S); - Standard_EXPORT static Standard_Integer NbSamplesU(const Handle(Adaptor3d_Surface)& S, - const Standard_Real u1, - const Standard_Real u2); + Standard_EXPORT static int NbSamplesU(const occ::handle& S, + const double u1, + const double u2); - Standard_EXPORT static Standard_Integer NbSamplesV(const Handle(Adaptor3d_Surface)& S, - const Standard_Real v1, - const Standard_Real v2); + Standard_EXPORT static int NbSamplesV(const occ::handle& S, + const double v1, + const double v2); //! Returns the parametric limits on the arc C. //! These limits must be finite : they are either //! the real limits of the arc, for a finite arc, //! or a bounding box for an infinite arc. - Standard_EXPORT static void Bounds(const Handle(Adaptor2d_Curve2d)& C, - Standard_Real& Ufirst, - Standard_Real& Ulast); + Standard_EXPORT static void Bounds(const occ::handle& C, + double& Ufirst, + double& Ulast); - static Handle(Adaptor2d_Curve2d) CurveOnSurf(const Handle(Adaptor2d_Curve2d)& C, - const Handle(Adaptor3d_Surface)& S); - -protected: -private: + static occ::handle CurveOnSurf(const occ::handle& C, + const occ::handle& S); }; #include diff --git a/opencascade/BRepBlend_BlendTool.lxx b/opencascade/BRepBlend_BlendTool.lxx index c603e9a18..1a08fc267 100644 --- a/opencascade/BRepBlend_BlendTool.lxx +++ b/opencascade/BRepBlend_BlendTool.lxx @@ -16,43 +16,43 @@ #include -inline Standard_Boolean BRepBlend_BlendTool::SingularOnUMin(const Handle(Adaptor3d_Surface)&) +inline bool BRepBlend_BlendTool::SingularOnUMin(const occ::handle&) { - return Standard_False; + return false; } -inline Standard_Boolean BRepBlend_BlendTool::SingularOnUMax(const Handle(Adaptor3d_Surface)&) +inline bool BRepBlend_BlendTool::SingularOnUMax(const occ::handle&) { - return Standard_False; + return false; } -inline Standard_Boolean BRepBlend_BlendTool::SingularOnVMin(const Handle(Adaptor3d_Surface)&) +inline bool BRepBlend_BlendTool::SingularOnVMin(const occ::handle&) { - return Standard_False; + return false; } -inline Standard_Boolean BRepBlend_BlendTool::SingularOnVMax(const Handle(Adaptor3d_Surface)&) +inline bool BRepBlend_BlendTool::SingularOnVMax(const occ::handle&) { - return Standard_False; + return false; } -inline Standard_Real BRepBlend_BlendTool::Tolerance(const Handle(Adaptor3d_HVertex)& V, - const Handle(Adaptor2d_Curve2d)& A) +inline double BRepBlend_BlendTool::Tolerance(const occ::handle& V, + const occ::handle& A) { // return Adaptor2d_HCurve2dTool::Resolution(A,1.e-6); // a voir return V->Resolution(A); // a voir } -inline Standard_Real BRepBlend_BlendTool::Parameter(const Handle(Adaptor3d_HVertex)& V, - const Handle(Adaptor2d_Curve2d)& C) +inline double BRepBlend_BlendTool::Parameter(const occ::handle& V, + const occ::handle& C) { // return BRep_Tool::Parameter(V,A->Curve().Edge()); return V->Parameter(C); } -inline Handle(Adaptor2d_Curve2d) BRepBlend_BlendTool::CurveOnSurf( - const Handle(Adaptor2d_Curve2d)& C, - const Handle(Adaptor3d_Surface)&) +inline occ::handle BRepBlend_BlendTool::CurveOnSurf( + const occ::handle& C, + const occ::handle&) { return C; } diff --git a/opencascade/BRepBlend_CSWalking.hxx b/opencascade/BRepBlend_CSWalking.hxx index ee9e8b0d9..10ff492fd 100644 --- a/opencascade/BRepBlend_CSWalking.hxx +++ b/opencascade/BRepBlend_CSWalking.hxx @@ -17,10 +17,12 @@ #include #include -#include +#include +#include #include #include -#include +#include +#include #include class BRepBlend_Line; @@ -45,73 +47,71 @@ class BRepBlend_CSWalking public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_CSWalking(const Handle(Adaptor3d_Curve)& Curv, - const Handle(Adaptor3d_Surface)& Surf, - const Handle(Adaptor3d_TopolTool)& Domain); + Standard_EXPORT BRepBlend_CSWalking(const occ::handle& Curv, + const occ::handle& Surf, + const occ::handle& Domain); - Standard_EXPORT void Perform(Blend_CSFunction& F, - const Standard_Real Pdep, - const Standard_Real Pmax, - const Standard_Real MaxStep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, - const math_Vector& Soldep, - const Standard_Real Fleche, - const Standard_Boolean Appro = Standard_False); + Standard_EXPORT void Perform(Blend_CSFunction& F, + const double Pdep, + const double Pmax, + const double MaxStep, + const double Tol3d, + const double TolGuide, + const math_Vector& Soldep, + const double Fleche, + const bool Appro = false); - Standard_EXPORT Standard_Boolean Complete(Blend_CSFunction& F, const Standard_Real Pmin); + Standard_EXPORT bool Complete(Blend_CSFunction& F, const double Pmin); - Standard_Boolean IsDone() const; + bool IsDone() const; - const Handle(BRepBlend_Line)& Line() const; + const occ::handle& Line() const; private: - Standard_EXPORT void InternalPerform(Blend_CSFunction& F, - math_Vector& Sol, - const Standard_Real Bound); + Standard_EXPORT void InternalPerform(Blend_CSFunction& F, math_Vector& Sol, const double Bound); - Standard_EXPORT void Transition(const Handle(Adaptor2d_Curve2d)& A, - const Standard_Real Param, - IntSurf_Transition& TLine, - IntSurf_Transition& TArc); + Standard_EXPORT void Transition(const occ::handle& A, + const double Param, + IntSurf_Transition& TLine, + IntSurf_Transition& TArc); - Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, - const Standard_Integer Index, - const Standard_Real Param, - const Standard_Boolean IsVtx, - const Handle(Adaptor3d_HVertex)& Vtx); + Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, + const int Index, + const double Param, + const bool IsVtx, + const occ::handle& Vtx); Standard_EXPORT Blend_Status CheckDeflectionOnSurf(const gp_Pnt& Psurf, const gp_Pnt2d& Ponsurf, const gp_Vec& Tgsurf, const gp_Vec2d& Tgonsurf); - Standard_EXPORT Blend_Status CheckDeflectionOnCurv(const gp_Pnt& Pcurv, - const Standard_Real Poncurv, - const gp_Vec& Tgcurv); - - Standard_EXPORT Blend_Status TestArret(Blend_CSFunction& F, - const math_Vector& Sol, - const Standard_Boolean TestDeflection, - const Blend_Status State); - - Standard_Boolean done; - Handle(BRepBlend_Line) line; - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Curve) curv; - Handle(Adaptor3d_TopolTool) domain; - Standard_Real tolpoint3d; - Standard_Real tolgui; - Standard_Real pasmax; - Standard_Real fleche; - Standard_Real param; - Standard_Real firstparam; - Handle(TColStd_HArray1OfReal) firstsol; - Blend_Point previousP; - Standard_Boolean rebrou; - Standard_Boolean iscomplete; - Standard_Boolean comptra; - Standard_Real sens; + Standard_EXPORT Blend_Status CheckDeflectionOnCurv(const gp_Pnt& Pcurv, + const double Poncurv, + const gp_Vec& Tgcurv); + + Standard_EXPORT Blend_Status TestArret(Blend_CSFunction& F, + const math_Vector& Sol, + const bool TestDeflection, + const Blend_Status State); + + bool done; + occ::handle line; + occ::handle surf; + occ::handle curv; + occ::handle domain; + double tolpoint3d; + double tolgui; + double pasmax; + double fleche; + double param; + double firstparam; + occ::handle> firstsol; + Blend_Point previousP; + bool rebrou; + bool iscomplete; + bool comptra; + double sens; }; #endif // _BRepBlend_CSWalking_HeaderFile diff --git a/opencascade/BRepBlend_CurvPointRadInv.hxx b/opencascade/BRepBlend_CurvPointRadInv.hxx index 5296018b4..f2c8b5ff9 100644 --- a/opencascade/BRepBlend_CurvPointRadInv.hxx +++ b/opencascade/BRepBlend_CurvPointRadInv.hxx @@ -30,69 +30,68 @@ class math_Matrix; //! Function of reframing between a point and a curve. //! valid in cases of constant and progressive radius. -//! This function is used to find a solution on a done -//! point of the curve 1 when using RstRstConsRad or +//! This function is used to find a solution on a done +//! point of the curve 1 when using RstRstConsRad or //! CSConstRad... -//! The vector used in Value, Values and Derivatives -//! methods has to be the vector of the parametric -//! coordinates w, U where w is the parameter on the -//! guide line, U are the parametric coordinates of a +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates w, U where w is the parameter on the +//! guide line, U are the parametric coordinates of a //! point on the partner curve 2. class BRepBlend_CurvPointRadInv : public Blend_CurvPointFuncInv { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_CurvPointRadInv(const Handle(Adaptor3d_Curve)& C1, - const Handle(Adaptor3d_Curve)& C2); + Standard_EXPORT BRepBlend_CurvPointRadInv(const occ::handle& C1, + const occ::handle& C2); - Standard_EXPORT void Set(const Standard_Integer Choix); + Standard_EXPORT void Set(const int Choix); //! returns 2. - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; //! Set the Point on which a solution has to be found. - Standard_EXPORT void Set(const gp_Pnt& P); + Standard_EXPORT void Set(const gp_Pnt& P) override; //! Returns in the vector Tolerance the parametric tolerance //! for each of the 3 variables; //! Tol is the tolerance used in 3d space. - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; //! Returns in the vector InfBound the lowest values allowed //! for each of the 3 variables. //! Returns in the vector SupBound the greatest values allowed //! for each of the 3 variables. - Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - //! Returns Standard_True if Sol is a zero of the function. + //! Returns true if Sol is a zero of the function. //! Tol is the tolerance used in 3d space. - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; -protected: private: - Handle(Adaptor3d_Curve) curv1; - Handle(Adaptor3d_Curve) curv2; - gp_Pnt point; - Standard_Integer choix; + occ::handle curv1; + occ::handle curv2; + gp_Pnt point; + int choix; }; #endif // _BRepBlend_CurvPointRadInv_HeaderFile diff --git a/opencascade/BRepBlend_Extremity.hxx b/opencascade/BRepBlend_Extremity.hxx index 4900776b9..a0f3ba251 100644 --- a/opencascade/BRepBlend_Extremity.hxx +++ b/opencascade/BRepBlend_Extremity.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include #include #include @@ -39,87 +40,87 @@ public: Standard_EXPORT BRepBlend_Extremity(); //! Creates an extremity on a surface - Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, - const Standard_Real U, - const Standard_Real V, - const Standard_Real Param, - const Standard_Real Tol); + Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, + const double U, + const double V, + const double Param, + const double Tol); //! Creates an extremity on a surface. This extremity matches //! the vertex . - Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, - const Standard_Real U, - const Standard_Real V, - const Standard_Real Param, - const Standard_Real Tol, - const Handle(Adaptor3d_HVertex)& Vtx); + Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, + const double U, + const double V, + const double Param, + const double Tol, + const occ::handle& Vtx); //! Creates an extremity on a curve - Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, - const Standard_Real W, - const Standard_Real Param, - const Standard_Real Tol); + Standard_EXPORT BRepBlend_Extremity(const gp_Pnt& P, + const double W, + const double Param, + const double Tol); //! Set the values for an extremity on a surface. - Standard_EXPORT void SetValue(const gp_Pnt& P, - const Standard_Real U, - const Standard_Real V, - const Standard_Real Param, - const Standard_Real Tol); + Standard_EXPORT void SetValue(const gp_Pnt& P, + const double U, + const double V, + const double Param, + const double Tol); //! Set the values for an extremity on a surface.This //! extremity matches the vertex . - Standard_EXPORT void SetValue(const gp_Pnt& P, - const Standard_Real U, - const Standard_Real V, - const Standard_Real Param, - const Standard_Real Tol, - const Handle(Adaptor3d_HVertex)& Vtx); + Standard_EXPORT void SetValue(const gp_Pnt& P, + const double U, + const double V, + const double Param, + const double Tol, + const occ::handle& Vtx); //! Set the values for an extremity on curve. - Standard_EXPORT void SetValue(const gp_Pnt& P, - const Standard_Real W, - const Standard_Real Param, - const Standard_Real Tol); + Standard_EXPORT void SetValue(const gp_Pnt& P, + const double W, + const double Param, + const double Tol); //! This method returns the value of the point in 3d space. const gp_Pnt& Value() const; - //! Set the tangent vector for an extremity on a + //! Set the tangent vector for an extremity on a //! surface. void SetTangent(const gp_Vec& Tangent); - //! Returns TRUE if the Tangent is stored. - Standard_Boolean HasTangent() const; + //! Returns TRUE if the Tangent is stored. + bool HasTangent() const; - //! This method returns the value of tangent in 3d + //! This method returns the value of tangent in 3d //! space. const gp_Vec& Tangent() const; //! This method returns the fuzziness on the point //! in 3d space. - Standard_Real Tolerance() const; + double Tolerance() const; //! Set the values for an extremity on a curve. - Standard_EXPORT void SetVertex(const Handle(Adaptor3d_HVertex)& V); + Standard_EXPORT void SetVertex(const occ::handle& V); //! Sets the values of a point which is on the arc //! A, at parameter Param. - Standard_EXPORT void AddArc(const Handle(Adaptor2d_Curve2d)& A, - const Standard_Real Param, - const IntSurf_Transition& TLine, - const IntSurf_Transition& TArc); + Standard_EXPORT void AddArc(const occ::handle& A, + const double Param, + const IntSurf_Transition& TLine, + const IntSurf_Transition& TArc); //! This method returns the parameters of the point //! on the concerned surface. - void Parameters(Standard_Real& U, Standard_Real& V) const; + void Parameters(double& U, double& V) const; - //! Returns Standard_True when the point coincide with + //! Returns true when the point coincide with //! an existing vertex. - Standard_Boolean IsVertex() const; + bool IsVertex() const; - //! Returns the vertex when IsVertex returns Standard_True. - const Handle(Adaptor3d_HVertex)& Vertex() const; + //! Returns the vertex when IsVertex returns true. + const occ::handle& Vertex() const; //! Returns the number of arc containing the extremity. //! If the method returns 0, the point is inside the @@ -128,26 +129,25 @@ public: //! and all the information (arc, parameter, transitions) //! are given by the point on restriction (PointOnRst) //! returned by the next method. - Standard_Integer NbPointOnRst() const; + int NbPointOnRst() const; - const BRepBlend_PointOnRst& PointOnRst(const Standard_Integer Index) const; + const BRepBlend_PointOnRst& PointOnRst(const int Index) const; - Standard_Real Parameter() const; + double Parameter() const; - Standard_Real ParameterOnGuide() const; + double ParameterOnGuide() const; -protected: private: - Handle(Adaptor3d_HVertex) vtx; - BRepBlend_SequenceOfPointOnRst seqpt; - gp_Pnt pt; - gp_Vec tang; - Standard_Real param; - Standard_Real u; - Standard_Real v; - Standard_Real tol; - Standard_Boolean isvtx; - Standard_Boolean hastang; + occ::handle vtx; + NCollection_Sequence seqpt; + gp_Pnt pt; + gp_Vec tang; + double param; + double u; + double v; + double tol; + bool isvtx; + bool hastang; }; #include diff --git a/opencascade/BRepBlend_Extremity.lxx b/opencascade/BRepBlend_Extremity.lxx index 3b84ce392..6bd3a2a40 100644 --- a/opencascade/BRepBlend_Extremity.lxx +++ b/opencascade/BRepBlend_Extremity.lxx @@ -21,11 +21,11 @@ inline const gp_Pnt& BRepBlend_Extremity::Value() const inline void BRepBlend_Extremity::SetTangent(const gp_Vec& Tangent) { - hastang = Standard_True; + hastang = true; tang = Tangent; } -inline Standard_Boolean BRepBlend_Extremity::HasTangent() const +inline bool BRepBlend_Extremity::HasTangent() const { return hastang; } @@ -39,23 +39,23 @@ inline const gp_Vec& BRepBlend_Extremity::Tangent() const return tang; } -inline void BRepBlend_Extremity::Parameters(Standard_Real& U, Standard_Real& V) const +inline void BRepBlend_Extremity::Parameters(double& U, double& V) const { U = u; V = v; } -inline Standard_Real BRepBlend_Extremity::Tolerance() const +inline double BRepBlend_Extremity::Tolerance() const { return tol; } -inline Standard_Boolean BRepBlend_Extremity::IsVertex() const +inline bool BRepBlend_Extremity::IsVertex() const { return isvtx; } -inline const Handle(Adaptor3d_HVertex)& BRepBlend_Extremity::Vertex() const +inline const occ::handle& BRepBlend_Extremity::Vertex() const { if (!isvtx) { @@ -64,24 +64,23 @@ inline const Handle(Adaptor3d_HVertex)& BRepBlend_Extremity::Vertex() const return vtx; } -inline Standard_Integer BRepBlend_Extremity::NbPointOnRst() const +inline int BRepBlend_Extremity::NbPointOnRst() const { return seqpt.Length(); } -inline const BRepBlend_PointOnRst& BRepBlend_Extremity::PointOnRst( - const Standard_Integer Index) const +inline const BRepBlend_PointOnRst& BRepBlend_Extremity::PointOnRst(const int Index) const { return seqpt(Index); } -inline Standard_Real BRepBlend_Extremity::Parameter() const +inline double BRepBlend_Extremity::Parameter() const { return u; } -inline Standard_Real BRepBlend_Extremity::ParameterOnGuide() const +inline double BRepBlend_Extremity::ParameterOnGuide() const { return param; diff --git a/opencascade/BRepBlend_HCurve2dTool.hxx b/opencascade/BRepBlend_HCurve2dTool.hxx index e9c6ca75c..c19eea1aa 100644 --- a/opencascade/BRepBlend_HCurve2dTool.hxx +++ b/opencascade/BRepBlend_HCurve2dTool.hxx @@ -27,112 +27,104 @@ #include #include #include -#include +#include class BRepBlend_HCurve2dTool { public: DEFINE_STANDARD_ALLOC - static Standard_Real FirstParameter(const Handle(Adaptor2d_Curve2d)& C); + static double FirstParameter(const occ::handle& C); - static Standard_Real LastParameter(const Handle(Adaptor2d_Curve2d)& C); + static double LastParameter(const occ::handle& C); - static GeomAbs_Shape Continuity(const Handle(Adaptor2d_Curve2d)& C); + static GeomAbs_Shape Continuity(const occ::handle& C); - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(myclass) >= - static Standard_Integer NbIntervals(const Handle(Adaptor2d_Curve2d)& C, const GeomAbs_Shape S); + static int NbIntervals(const occ::handle& C, const GeomAbs_Shape S); - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - static void Intervals(const Handle(Adaptor2d_Curve2d)& C, - TColStd_Array1OfReal& T, - const GeomAbs_Shape S); + static void Intervals(const occ::handle& C, + NCollection_Array1& T, + const GeomAbs_Shape S); - static Standard_Boolean IsClosed(const Handle(Adaptor2d_Curve2d)& C); + static bool IsClosed(const occ::handle& C); - static Standard_Boolean IsPeriodic(const Handle(Adaptor2d_Curve2d)& C); + static bool IsPeriodic(const occ::handle& C); - static Standard_Real Period(const Handle(Adaptor2d_Curve2d)& C); + static double Period(const occ::handle& C); //! Computes the point of parameter U on the curve. - static gp_Pnt2d Value(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U); + static gp_Pnt2d Value(const occ::handle& C, const double U); //! Computes the point of parameter U on the curve. - static void D0(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P); + static void D0(const occ::handle& C, const double U, gp_Pnt2d& P); //! Computes the point of parameter U on the curve with its //! first derivative. //! Raised if the continuity of the current interval //! is not C1. - static void D1(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V); + static void D1(const occ::handle& C, const double U, gp_Pnt2d& P, gp_Vec2d& V); //! Returns the point P of parameter U, the first and second //! derivatives V1 and V2. //! Raised if the continuity of the current interval //! is not C2. - static void D2(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2); + static void D2(const occ::handle& C, + const double U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2); //! Returns the point P of parameter U, the first, the second //! and the third derivative. //! Raised if the continuity of the current interval //! is not C3. - static void D3(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3); + static void D3(const occ::handle& C, + const double U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3); //! The returned vector gives the value of the derivative for the //! order of derivation N. //! Raised if the continuity of the current interval //! is not CN. //! Raised if N < 1. - static gp_Vec2d DN(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - const Standard_Integer N); + static gp_Vec2d DN(const occ::handle& C, const double U, const int N); - //! Returns the parametric resolution corresponding + //! Returns the parametric resolution corresponding //! to the real space resolution . - static Standard_Real Resolution(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real R3d); + static double Resolution(const occ::handle& C, const double R3d); - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - static GeomAbs_CurveType GetType(const Handle(Adaptor2d_Curve2d)& C); + static GeomAbs_CurveType GetType(const occ::handle& C); - static gp_Lin2d Line(const Handle(Adaptor2d_Curve2d)& C); + static gp_Lin2d Line(const occ::handle& C); - static gp_Circ2d Circle(const Handle(Adaptor2d_Curve2d)& C); + static gp_Circ2d Circle(const occ::handle& C); - static gp_Elips2d Ellipse(const Handle(Adaptor2d_Curve2d)& C); + static gp_Elips2d Ellipse(const occ::handle& C); - static gp_Hypr2d Hyperbola(const Handle(Adaptor2d_Curve2d)& C); + static gp_Hypr2d Hyperbola(const occ::handle& C); - static gp_Parab2d Parabola(const Handle(Adaptor2d_Curve2d)& C); + static gp_Parab2d Parabola(const occ::handle& C); - static Handle(Geom2d_BezierCurve) Bezier(const Handle(Adaptor2d_Curve2d)& C); + static occ::handle Bezier(const occ::handle& C); - static Handle(Geom2d_BSplineCurve) BSpline(const Handle(Adaptor2d_Curve2d)& C); + static occ::handle BSpline(const occ::handle& C); - Standard_EXPORT static Standard_Integer NbSamples(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U0, - const Standard_Real U1); - -protected: -private: + Standard_EXPORT static int NbSamples(const occ::handle& C, + const double U0, + const double U1); }; #include diff --git a/opencascade/BRepBlend_HCurve2dTool.lxx b/opencascade/BRepBlend_HCurve2dTool.lxx index 4f363bd51..31f604da2 100644 --- a/opencascade/BRepBlend_HCurve2dTool.lxx +++ b/opencascade/BRepBlend_HCurve2dTool.lxx @@ -27,167 +27,168 @@ #include #include -#include +#include //============================================================ -inline Standard_Real BRepBlend_HCurve2dTool::FirstParameter(const Handle(Adaptor2d_Curve2d)& C) +inline double BRepBlend_HCurve2dTool::FirstParameter(const occ::handle& C) { return (C->FirstParameter()); } //============================================================ -inline Standard_Real BRepBlend_HCurve2dTool::LastParameter(const Handle(Adaptor2d_Curve2d)& C) +inline double BRepBlend_HCurve2dTool::LastParameter(const occ::handle& C) { return (C->LastParameter()); } //============================================================ -inline GeomAbs_Shape BRepBlend_HCurve2dTool::Continuity(const Handle(Adaptor2d_Curve2d)& C) +inline GeomAbs_Shape BRepBlend_HCurve2dTool::Continuity(const occ::handle& C) { return (C->Continuity()); } //============================================================ -inline Standard_Integer BRepBlend_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_Curve2d)& C, - const GeomAbs_Shape Sh) +inline int BRepBlend_HCurve2dTool::NbIntervals(const occ::handle& C, + const GeomAbs_Shape Sh) { return (C->NbIntervals(Sh)); } //============================================================ -inline void BRepBlend_HCurve2dTool::Intervals(const Handle(Adaptor2d_Curve2d)& C, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape Sh) +inline void BRepBlend_HCurve2dTool::Intervals(const occ::handle& C, + NCollection_Array1& Tab, + const GeomAbs_Shape Sh) { C->Intervals(Tab, Sh); } //============================================================ -inline Standard_Boolean BRepBlend_HCurve2dTool::IsClosed(const Handle(Adaptor2d_Curve2d)& C) +inline bool BRepBlend_HCurve2dTool::IsClosed(const occ::handle& C) { return (C->IsClosed()); } //============================================================ -inline Standard_Boolean BRepBlend_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_Curve2d)& C) +inline bool BRepBlend_HCurve2dTool::IsPeriodic(const occ::handle& C) { return (C->IsPeriodic()); } //============================================================ -inline Standard_Real BRepBlend_HCurve2dTool::Period(const Handle(Adaptor2d_Curve2d)& C) +inline double BRepBlend_HCurve2dTool::Period(const occ::handle& C) { return (C->Period()); } //============================================================ -inline gp_Pnt2d BRepBlend_HCurve2dTool::Value(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U) +inline gp_Pnt2d BRepBlend_HCurve2dTool::Value(const occ::handle& C, + const double U) { return (C->Value(U)); } //============================================================ -inline void BRepBlend_HCurve2dTool::D0(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P) +inline void BRepBlend_HCurve2dTool::D0(const occ::handle& C, + const double U, + gp_Pnt2d& P) { C->D0(U, P); } //============================================================ -inline void BRepBlend_HCurve2dTool::D1(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& T) +inline void BRepBlend_HCurve2dTool::D1(const occ::handle& C, + const double U, + gp_Pnt2d& P, + gp_Vec2d& T) { C->D1(U, P, T); } //============================================================ -inline void BRepBlend_HCurve2dTool::D2(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& T, - gp_Vec2d& N) +inline void BRepBlend_HCurve2dTool::D2(const occ::handle& C, + const double U, + gp_Pnt2d& P, + gp_Vec2d& T, + gp_Vec2d& N) { C->D2(U, P, T, N); } //============================================================ -inline void BRepBlend_HCurve2dTool::D3(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - gp_Pnt2d& P, - gp_Vec2d& V1, - gp_Vec2d& V2, - gp_Vec2d& V3) +inline void BRepBlend_HCurve2dTool::D3(const occ::handle& C, + const double U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) { C->D3(U, P, V1, V2, V3); } //============================================================ -inline gp_Vec2d BRepBlend_HCurve2dTool::DN(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real U, - const Standard_Integer N) +inline gp_Vec2d BRepBlend_HCurve2dTool::DN(const occ::handle& C, + const double U, + const int N) { return (C->DN(U, N)); } //============================================================ -inline Standard_Real BRepBlend_HCurve2dTool::Resolution(const Handle(Adaptor2d_Curve2d)& C, - const Standard_Real R3d) +inline double BRepBlend_HCurve2dTool::Resolution(const occ::handle& C, + const double R3d) { return (C->Resolution(R3d)); } //============================================================ -inline GeomAbs_CurveType BRepBlend_HCurve2dTool::GetType(const Handle(Adaptor2d_Curve2d)& C) +inline GeomAbs_CurveType BRepBlend_HCurve2dTool::GetType(const occ::handle& C) { return (C->GetType()); } //============================================================ -inline gp_Lin2d BRepBlend_HCurve2dTool::Line(const Handle(Adaptor2d_Curve2d)& C) +inline gp_Lin2d BRepBlend_HCurve2dTool::Line(const occ::handle& C) { return (C->Line()); } //============================================================ -inline gp_Circ2d BRepBlend_HCurve2dTool::Circle(const Handle(Adaptor2d_Curve2d)& C) +inline gp_Circ2d BRepBlend_HCurve2dTool::Circle(const occ::handle& C) { return (C->Circle()); } //============================================================ -inline gp_Elips2d BRepBlend_HCurve2dTool::Ellipse(const Handle(Adaptor2d_Curve2d)& C) +inline gp_Elips2d BRepBlend_HCurve2dTool::Ellipse(const occ::handle& C) { return (C->Ellipse()); } //============================================================ -inline gp_Parab2d BRepBlend_HCurve2dTool::Parabola(const Handle(Adaptor2d_Curve2d)& C) +inline gp_Parab2d BRepBlend_HCurve2dTool::Parabola(const occ::handle& C) { return (C->Parabola()); } //============================================================ -inline gp_Hypr2d BRepBlend_HCurve2dTool::Hyperbola(const Handle(Adaptor2d_Curve2d)& C) +inline gp_Hypr2d BRepBlend_HCurve2dTool::Hyperbola(const occ::handle& C) { return (C->Hyperbola()); } //============================================================ -inline Handle(Geom2d_BezierCurve) BRepBlend_HCurve2dTool::Bezier(const Handle(Adaptor2d_Curve2d)& C) +inline occ::handle BRepBlend_HCurve2dTool::Bezier( + const occ::handle& C) { return (C->Bezier()); } //============================================================ -inline Handle(Geom2d_BSplineCurve) BRepBlend_HCurve2dTool::BSpline( - const Handle(Adaptor2d_Curve2d)& C) +inline occ::handle BRepBlend_HCurve2dTool::BSpline( + const occ::handle& C) { return (C->BSpline()); } diff --git a/opencascade/BRepBlend_HCurveTool.hxx b/opencascade/BRepBlend_HCurveTool.hxx index 1eaeacf5b..b3b06165e 100644 --- a/opencascade/BRepBlend_HCurveTool.hxx +++ b/opencascade/BRepBlend_HCurveTool.hxx @@ -27,109 +27,104 @@ #include #include #include -#include +#include class BRepBlend_HCurveTool { public: DEFINE_STANDARD_ALLOC - static Standard_Real FirstParameter(const Handle(Adaptor3d_Curve)& C); + static double FirstParameter(const occ::handle& C); - static Standard_Real LastParameter(const Handle(Adaptor3d_Curve)& C); + static double LastParameter(const occ::handle& C); - static GeomAbs_Shape Continuity(const Handle(Adaptor3d_Curve)& C); + static GeomAbs_Shape Continuity(const occ::handle& C); - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(myclass) >= - static Standard_Integer NbIntervals(const Handle(Adaptor3d_Curve)& C, const GeomAbs_Shape S); + static int NbIntervals(const occ::handle& C, const GeomAbs_Shape S); - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - static void Intervals(const Handle(Adaptor3d_Curve)& C, - TColStd_Array1OfReal& T, - const GeomAbs_Shape S); + static void Intervals(const occ::handle& C, + NCollection_Array1& T, + const GeomAbs_Shape S); - static Standard_Boolean IsClosed(const Handle(Adaptor3d_Curve)& C); + static bool IsClosed(const occ::handle& C); - static Standard_Boolean IsPeriodic(const Handle(Adaptor3d_Curve)& C); + static bool IsPeriodic(const occ::handle& C); - static Standard_Real Period(const Handle(Adaptor3d_Curve)& C); + static double Period(const occ::handle& C); //! Computes the point of parameter U on the curve. - static gp_Pnt Value(const Handle(Adaptor3d_Curve)& C, const Standard_Real U); + static gp_Pnt Value(const occ::handle& C, const double U); //! Computes the point of parameter U on the curve. - static void D0(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P); + static void D0(const occ::handle& C, const double U, gp_Pnt& P); //! Computes the point of parameter U on the curve with its //! first derivative. //! Raised if the continuity of the current interval //! is not C1. - static void D1(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, gp_Pnt& P, gp_Vec& V); + static void D1(const occ::handle& C, const double U, gp_Pnt& P, gp_Vec& V); //! Returns the point P of parameter U, the first and second //! derivatives V1 and V2. //! Raised if the continuity of the current interval //! is not C2. - static void D2(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2); + static void D2(const occ::handle& C, + const double U, + gp_Pnt& P, + gp_Vec& V1, + gp_Vec& V2); //! Returns the point P of parameter U, the first, the second //! and the third derivative. //! Raised if the continuity of the current interval //! is not C3. - static void D3(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3); + static void D3(const occ::handle& C, + const double U, + gp_Pnt& P, + gp_Vec& V1, + gp_Vec& V2, + gp_Vec& V3); //! The returned vector gives the value of the derivative for the //! order of derivation N. //! Raised if the continuity of the current interval //! is not CN. //! Raised if N < 1. - static gp_Vec DN(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - const Standard_Integer N); + static gp_Vec DN(const occ::handle& C, const double U, const int N); - //! Returns the parametric resolution corresponding + //! Returns the parametric resolution corresponding //! to the real space resolution . - static Standard_Real Resolution(const Handle(Adaptor3d_Curve)& C, const Standard_Real R3d); + static double Resolution(const occ::handle& C, const double R3d); - //! Returns the type of the curve in the current - //! interval : Line, Circle, Ellipse, Hyperbola, + //! Returns the type of the curve in the current + //! interval: Line, Circle, Ellipse, Hyperbola, //! Parabola, BezierCurve, BSplineCurve, OtherCurve. - static GeomAbs_CurveType GetType(const Handle(Adaptor3d_Curve)& C); + static GeomAbs_CurveType GetType(const occ::handle& C); - static gp_Lin Line(const Handle(Adaptor3d_Curve)& C); + static gp_Lin Line(const occ::handle& C); - static gp_Circ Circle(const Handle(Adaptor3d_Curve)& C); + static gp_Circ Circle(const occ::handle& C); - static gp_Elips Ellipse(const Handle(Adaptor3d_Curve)& C); + static gp_Elips Ellipse(const occ::handle& C); - static gp_Hypr Hyperbola(const Handle(Adaptor3d_Curve)& C); + static gp_Hypr Hyperbola(const occ::handle& C); - static gp_Parab Parabola(const Handle(Adaptor3d_Curve)& C); + static gp_Parab Parabola(const occ::handle& C); - static Handle(Geom_BezierCurve) Bezier(const Handle(Adaptor3d_Curve)& C); + static occ::handle Bezier(const occ::handle& C); - static Handle(Geom_BSplineCurve) BSpline(const Handle(Adaptor3d_Curve)& C); + static occ::handle BSpline(const occ::handle& C); - Standard_EXPORT static Standard_Integer NbSamples(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U0, - const Standard_Real U1); - -protected: -private: + Standard_EXPORT static int NbSamples(const occ::handle& C, + const double U0, + const double U1); }; #include diff --git a/opencascade/BRepBlend_HCurveTool.lxx b/opencascade/BRepBlend_HCurveTool.lxx index b31e11ef1..acab625c3 100644 --- a/opencascade/BRepBlend_HCurveTool.lxx +++ b/opencascade/BRepBlend_HCurveTool.lxx @@ -27,165 +27,167 @@ #include #include -#include +#include //============================================================ -inline Standard_Real BRepBlend_HCurveTool::FirstParameter(const Handle(Adaptor3d_Curve)& C) +inline double BRepBlend_HCurveTool::FirstParameter(const occ::handle& C) { return (C->FirstParameter()); } //============================================================ -inline Standard_Real BRepBlend_HCurveTool::LastParameter(const Handle(Adaptor3d_Curve)& C) +inline double BRepBlend_HCurveTool::LastParameter(const occ::handle& C) { return (C->LastParameter()); } //============================================================ -inline GeomAbs_Shape BRepBlend_HCurveTool::Continuity(const Handle(Adaptor3d_Curve)& C) +inline GeomAbs_Shape BRepBlend_HCurveTool::Continuity(const occ::handle& C) { return (C->Continuity()); } //============================================================ -inline Standard_Integer BRepBlend_HCurveTool::NbIntervals(const Handle(Adaptor3d_Curve)& C, - const GeomAbs_Shape Sh) +inline int BRepBlend_HCurveTool::NbIntervals(const occ::handle& C, + const GeomAbs_Shape Sh) { return (C->NbIntervals(Sh)); } //============================================================ -inline void BRepBlend_HCurveTool::Intervals(const Handle(Adaptor3d_Curve)& C, - TColStd_Array1OfReal& Tab, - const GeomAbs_Shape Sh) +inline void BRepBlend_HCurveTool::Intervals(const occ::handle& C, + NCollection_Array1& Tab, + const GeomAbs_Shape Sh) { C->Intervals(Tab, Sh); } //============================================================ -inline Standard_Boolean BRepBlend_HCurveTool::IsClosed(const Handle(Adaptor3d_Curve)& C) +inline bool BRepBlend_HCurveTool::IsClosed(const occ::handle& C) { return (C->IsClosed()); } //============================================================ -inline Standard_Boolean BRepBlend_HCurveTool::IsPeriodic(const Handle(Adaptor3d_Curve)& C) +inline bool BRepBlend_HCurveTool::IsPeriodic(const occ::handle& C) { return (C->IsPeriodic()); } //============================================================ -inline Standard_Real BRepBlend_HCurveTool::Period(const Handle(Adaptor3d_Curve)& C) +inline double BRepBlend_HCurveTool::Period(const occ::handle& C) { return (C->Period()); } //============================================================ -inline gp_Pnt BRepBlend_HCurveTool::Value(const Handle(Adaptor3d_Curve)& C, const Standard_Real U) +inline gp_Pnt BRepBlend_HCurveTool::Value(const occ::handle& C, const double U) { return (C->Value(U)); } //============================================================ -inline void BRepBlend_HCurveTool::D0(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P) +inline void BRepBlend_HCurveTool::D0(const occ::handle& C, + const double U, + gp_Pnt& P) { C->D0(U, P); } //============================================================ -inline void BRepBlend_HCurveTool::D1(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& T) +inline void BRepBlend_HCurveTool::D1(const occ::handle& C, + const double U, + gp_Pnt& P, + gp_Vec& T) { C->D1(U, P, T); } //============================================================ -inline void BRepBlend_HCurveTool::D2(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& T, - gp_Vec& N) +inline void BRepBlend_HCurveTool::D2(const occ::handle& C, + const double U, + gp_Pnt& P, + gp_Vec& T, + gp_Vec& N) { C->D2(U, P, T, N); } //============================================================ -inline void BRepBlend_HCurveTool::D3(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3) +inline void BRepBlend_HCurveTool::D3(const occ::handle& C, + const double U, + gp_Pnt& P, + gp_Vec& V1, + gp_Vec& V2, + gp_Vec& V3) { C->D3(U, P, V1, V2, V3); } //============================================================ -inline gp_Vec BRepBlend_HCurveTool::DN(const Handle(Adaptor3d_Curve)& C, - const Standard_Real U, - const Standard_Integer N) +inline gp_Vec BRepBlend_HCurveTool::DN(const occ::handle& C, + const double U, + const int N) { return (C->DN(U, N)); } //============================================================ -inline Standard_Real BRepBlend_HCurveTool::Resolution(const Handle(Adaptor3d_Curve)& C, - const Standard_Real R3d) +inline double BRepBlend_HCurveTool::Resolution(const occ::handle& C, + const double R3d) { return (C->Resolution(R3d)); } //============================================================ -inline GeomAbs_CurveType BRepBlend_HCurveTool::GetType(const Handle(Adaptor3d_Curve)& C) +inline GeomAbs_CurveType BRepBlend_HCurveTool::GetType(const occ::handle& C) { return (C->GetType()); } //============================================================ -inline gp_Lin BRepBlend_HCurveTool::Line(const Handle(Adaptor3d_Curve)& C) +inline gp_Lin BRepBlend_HCurveTool::Line(const occ::handle& C) { return (C->Line()); } //============================================================ -inline gp_Circ BRepBlend_HCurveTool::Circle(const Handle(Adaptor3d_Curve)& C) +inline gp_Circ BRepBlend_HCurveTool::Circle(const occ::handle& C) { return (C->Circle()); } //============================================================ -inline gp_Elips BRepBlend_HCurveTool::Ellipse(const Handle(Adaptor3d_Curve)& C) +inline gp_Elips BRepBlend_HCurveTool::Ellipse(const occ::handle& C) { return (C->Ellipse()); } //============================================================ -inline gp_Parab BRepBlend_HCurveTool::Parabola(const Handle(Adaptor3d_Curve)& C) +inline gp_Parab BRepBlend_HCurveTool::Parabola(const occ::handle& C) { return (C->Parabola()); } //============================================================ -inline gp_Hypr BRepBlend_HCurveTool::Hyperbola(const Handle(Adaptor3d_Curve)& C) +inline gp_Hypr BRepBlend_HCurveTool::Hyperbola(const occ::handle& C) { return (C->Hyperbola()); } //============================================================ -inline Handle(Geom_BezierCurve) BRepBlend_HCurveTool::Bezier(const Handle(Adaptor3d_Curve)& C) +inline occ::handle BRepBlend_HCurveTool::Bezier( + const occ::handle& C) { return (C->Bezier()); } //============================================================ -inline Handle(Geom_BSplineCurve) BRepBlend_HCurveTool::BSpline(const Handle(Adaptor3d_Curve)& C) +inline occ::handle BRepBlend_HCurveTool::BSpline( + const occ::handle& C) { return (C->BSpline()); } diff --git a/opencascade/BRepBlend_Line.hxx b/opencascade/BRepBlend_Line.hxx index 37a678f59..f1c3a2a21 100644 --- a/opencascade/BRepBlend_Line.hxx +++ b/opencascade/BRepBlend_Line.hxx @@ -17,16 +17,14 @@ #ifndef _BRepBlend_Line_HeaderFile #define _BRepBlend_Line_HeaderFile -#include +#include +#include #include #include #include class Blend_Point; -class BRepBlend_Line; -DEFINE_STANDARD_HANDLE(BRepBlend_Line, Standard_Transient) - class BRepBlend_Line : public Standard_Transient { @@ -43,12 +41,12 @@ public: void Prepend(const Blend_Point& P); //! Adds a point in the line at the first place. - void InsertBefore(const Standard_Integer Index, const Blend_Point& P); + void InsertBefore(const int Index, const Blend_Point& P); - //! Removes from all the items of + //! Removes from all the items of //! positions between and . //! Raises an exception if the indices are out of bounds. - void Remove(const Standard_Integer FromIndex, const Standard_Integer ToIndex); + void Remove(const int FromIndex, const int ToIndex); //! Sets the value of the transition of the line on S1 and //! the line on S2. @@ -64,10 +62,10 @@ public: void SetEndPoints(const BRepBlend_Extremity& EndPt1, const BRepBlend_Extremity& EndPt2); //! Returns the number of points in the line. - Standard_Integer NbPoints() const; + int NbPoints() const; //! Returns the point of range Index. - const Blend_Point& Point(const Standard_Integer Index) const; + const Blend_Point& Point(const int Index) const; //! Returns the type of the transition of the line defined //! on the first surface. The transition is "constant" @@ -78,7 +76,7 @@ public: //! N is the normal to the first surface at a point P, //! DRac is a vector tangent to the blending patch, //! oriented towards the valid part of this patch, - //! T is the tangent to the line on S1 at P. + //! T is the tangent to the line on S1 at P. //! The transitioon is OUT when the system of vectors is //! left-handed. IntSurf_TypeTrans TransitionOnS1() const; @@ -106,17 +104,16 @@ public: DEFINE_STANDARD_RTTIEXT(BRepBlend_Line, Standard_Transient) -protected: private: - Blend_SequenceOfPoint seqpt; - IntSurf_TypeTrans tras1; - IntSurf_TypeTrans tras2; - BRepBlend_Extremity stp1; - BRepBlend_Extremity stp2; - BRepBlend_Extremity endp1; - BRepBlend_Extremity endp2; - Standard_Boolean hass1; - Standard_Boolean hass2; + NCollection_Sequence seqpt; + IntSurf_TypeTrans tras1; + IntSurf_TypeTrans tras2; + BRepBlend_Extremity stp1; + BRepBlend_Extremity stp2; + BRepBlend_Extremity endp1; + BRepBlend_Extremity endp2; + bool hass1; + bool hass2; }; #include diff --git a/opencascade/BRepBlend_Line.lxx b/opencascade/BRepBlend_Line.lxx index 916a690a1..44bbade63 100644 --- a/opencascade/BRepBlend_Line.lxx +++ b/opencascade/BRepBlend_Line.lxx @@ -12,7 +12,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include #include inline void BRepBlend_Line::Append(const Blend_Point& P) @@ -25,12 +26,12 @@ inline void BRepBlend_Line::Prepend(const Blend_Point& P) seqpt.Prepend(P); } -inline void BRepBlend_Line::InsertBefore(const Standard_Integer Index, const Blend_Point& P) +inline void BRepBlend_Line::InsertBefore(const int Index, const Blend_Point& P) { seqpt.InsertBefore(Index, P); } -inline void BRepBlend_Line::Remove(const Standard_Integer FromIndex, const Standard_Integer ToIndex) +inline void BRepBlend_Line::Remove(const int FromIndex, const int ToIndex) { seqpt.Remove(FromIndex, ToIndex); } @@ -51,12 +52,12 @@ inline void BRepBlend_Line::SetEndPoints(const BRepBlend_Extremity& EndPtOnS1, endp2 = EndPtOnS2; } -inline Standard_Integer BRepBlend_Line::NbPoints() const +inline int BRepBlend_Line::NbPoints() const { return seqpt.Length(); } -inline const Blend_Point& BRepBlend_Line::Point(const Standard_Integer Index) const +inline const Blend_Point& BRepBlend_Line::Point(const int Index) const { return seqpt(Index); } diff --git a/opencascade/BRepBlend_PointOnRst.hxx b/opencascade/BRepBlend_PointOnRst.hxx index 13ac85d20..f8ff500d6 100644 --- a/opencascade/BRepBlend_PointOnRst.hxx +++ b/opencascade/BRepBlend_PointOnRst.hxx @@ -35,21 +35,21 @@ public: //! Creates the PointOnRst on the arc A, at parameter Param, //! with the transition TLine on the walking line, and //! TArc on the arc A. - Standard_EXPORT BRepBlend_PointOnRst(const Handle(Adaptor2d_Curve2d)& A, - const Standard_Real Param, - const IntSurf_Transition& TLine, - const IntSurf_Transition& TArc); + Standard_EXPORT BRepBlend_PointOnRst(const occ::handle& A, + const double Param, + const IntSurf_Transition& TLine, + const IntSurf_Transition& TArc); //! Sets the values of a point which is on the arc //! A, at parameter Param. - Standard_EXPORT void SetArc(const Handle(Adaptor2d_Curve2d)& A, - const Standard_Real Param, - const IntSurf_Transition& TLine, - const IntSurf_Transition& TArc); + Standard_EXPORT void SetArc(const occ::handle& A, + const double Param, + const IntSurf_Transition& TLine, + const IntSurf_Transition& TArc); //! Returns the arc of restriction containing the //! vertex. - const Handle(Adaptor2d_Curve2d)& Arc() const; + const occ::handle& Arc() const; //! Returns the transition of the point on the //! line on surface. @@ -61,14 +61,13 @@ public: //! Returns the parameter of the point on the //! arc returned by the method Arc(). - Standard_Real ParameterOnArc() const; + double ParameterOnArc() const; -protected: private: - Handle(Adaptor2d_Curve2d) arc; - IntSurf_Transition traline; - IntSurf_Transition traarc; - Standard_Real prm; + occ::handle arc; + IntSurf_Transition traline; + IntSurf_Transition traarc; + double prm; }; #include diff --git a/opencascade/BRepBlend_PointOnRst.lxx b/opencascade/BRepBlend_PointOnRst.lxx index 9b7a3d195..a5e97d0f9 100644 --- a/opencascade/BRepBlend_PointOnRst.lxx +++ b/opencascade/BRepBlend_PointOnRst.lxx @@ -14,7 +14,7 @@ #include -inline const Handle(Adaptor2d_Curve2d)& BRepBlend_PointOnRst::Arc() const +inline const occ::handle& BRepBlend_PointOnRst::Arc() const { return arc; } @@ -29,7 +29,7 @@ inline const IntSurf_Transition& BRepBlend_PointOnRst::TransitionOnArc() const return traarc; } -inline Standard_Real BRepBlend_PointOnRst::ParameterOnArc() const +inline double BRepBlend_PointOnRst::ParameterOnArc() const { return prm; } diff --git a/opencascade/BRepBlend_RstRstConstRad.hxx b/opencascade/BRepBlend_RstRstConstRad.hxx index f423b679b..4b5b53e90 100644 --- a/opencascade/BRepBlend_RstRstConstRad.hxx +++ b/opencascade/BRepBlend_RstRstConstRad.hxx @@ -28,13 +28,9 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include class math_Matrix; class gp_Circ; @@ -47,233 +43,223 @@ class BRepBlend_RstRstConstRad : public Blend_RstRstFunction public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_RstRstConstRad(const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor2d_Curve2d)& Rst1, - const Handle(Adaptor3d_Surface)& Surf2, - const Handle(Adaptor2d_Curve2d)& Rst2, - const Handle(Adaptor3d_Curve)& CGuide); + Standard_EXPORT BRepBlend_RstRstConstRad(const occ::handle& Surf1, + const occ::handle& Rst1, + const occ::handle& Surf2, + const occ::handle& Rst2, + const occ::handle& CGuide); //! Returns 2. - Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; + Standard_EXPORT int NbVariables() const override; //! Returns 2. - Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, - math_Vector& F, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_EXPORT void Set(const Handle(Adaptor3d_Surface)& SurfRef1, - const Handle(Adaptor2d_Curve2d)& RstRef1, - const Handle(Adaptor3d_Surface)& SurfRef2, - const Handle(Adaptor2d_Curve2d)& RstRef2); + Standard_EXPORT void Set(const occ::handle& SurfRef1, + const occ::handle& RstRef1, + const occ::handle& SurfRef2, + const occ::handle& RstRef2); - Standard_EXPORT void Set(const Standard_Real Param) Standard_OVERRIDE; + Standard_EXPORT void Set(const double Param) override; //! Sets the bounds of the parametric interval on //! the guide line. //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT void Set(const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; + Standard_EXPORT void Set(const double First, const double Last) override; - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; - Standard_EXPORT void GetBounds(math_Vector& InfBound, - math_Vector& SupBound) const Standard_OVERRIDE; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, - const Standard_Real Tol) Standard_OVERRIDE; + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; - //! Returns the minimal Distance between two + //! Returns the minimal Distance between two //! extremities of calculated sections. - Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; + Standard_EXPORT double GetMinimalDistance() const override; - Standard_EXPORT const gp_Pnt& PointOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst1() const override; - Standard_EXPORT const gp_Pnt& PointOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst2() const override; //! Returns U,V coordinates of the point on the surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const override; - //! Returns U,V coordinates of the point on the curve on + //! Returns U,V coordinates of the point on the curve on //! surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst1() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst1() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst2() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst2() const override; - Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; + Standard_EXPORT bool IsTangencyPoint() const override; - Standard_EXPORT const gp_Vec& TangentOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst1() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const override; - Standard_EXPORT const gp_Vec& TangentOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst2() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const override; - //! Permet d ' implementer un critere de decrochage - //! specifique a la fonction. + //! Allows implementing a specific termination criterion + //! for the function. Standard_EXPORT Blend_DecrochStatus Decroch(const math_Vector& Sol, gp_Vec& NRst1, gp_Vec& TgRst1, gp_Vec& NRst2, - gp_Vec& TgRst2) const Standard_OVERRIDE; + gp_Vec& TgRst2) const override; - Standard_EXPORT void Set(const Standard_Real Radius, const Standard_Integer Choix); + Standard_EXPORT void Set(const double Radius, const int Choix); - //! Sets the type of section generation for the + //! Sets the type of section generation for the //! approximations. Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection); //! Give the center of circle define by PtRst1, PtRst2 and //! radius ray. - Standard_EXPORT Standard_Boolean CenterCircleRst1Rst2(const gp_Pnt& PtRst1, - const gp_Pnt& PtRst2, - const gp_Vec& np, - gp_Pnt& Center, - gp_Vec& VdMed) const; - - Standard_EXPORT void Section(const Standard_Real Param, - const Standard_Real U, - const Standard_Real V, - Standard_Real& Pdeb, - Standard_Real& Pfin, - gp_Circ& C); - - //! Returns if the section is rational - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool CenterCircleRst1Rst2(const gp_Pnt& PtRst1, + const gp_Pnt& PtRst2, + const gp_Vec& np, + gp_Pnt& Center, + gp_Vec& VdMed) const; + + Standard_EXPORT void Section(const double Param, + const double U, + const double V, + double& Pdeb, + double& Pfin, + gp_Circ& C); + + //! Returns if the section is rational + Standard_EXPORT bool IsRational() const override; //! Returns the length of the maximum section - Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; + Standard_EXPORT double GetSectionSize() const override; //! Compute the minimal value of weight for each poles //! of all sections. - Standard_EXPORT void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; + Standard_EXPORT void GetMinimalWeight(NCollection_Array1& Weigths) const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - Standard_EXPORT void GetShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree, - Standard_Integer& NbPoles2d) Standard_OVERRIDE; + Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override; //! Returns the tolerance to reach in approximation //! to respect //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary //! SurfTol error inside the surface. - Standard_EXPORT void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - math_Vector& Tol3d, - math_Vector& Tol1D) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + math_Vector& Tol3d, + math_Vector& Tol1D) const override; - Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; + Standard_EXPORT void Knots(NCollection_Array1& TKnots) override; - Standard_EXPORT void Mults(TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; + Standard_EXPORT void Mults(NCollection_Array1& TMults) override; //! Used for the first and last section - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; - - Standard_EXPORT void Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths) override; + + Standard_EXPORT void Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) override; //! Used for the first and last section - //! The method returns Standard_True if the derivatives - //! are computed, otherwise it returns Standard_False. - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Resolution(const Standard_Integer IC2d, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const Standard_OVERRIDE; - -protected: + //! The method returns true if the derivatives + //! are computed, otherwise it returns false. + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths) override; + + Standard_EXPORT void Resolution(const int IC2d, + const double Tol, + double& TolU, + double& TolV) const override; + private: - Handle(Adaptor3d_Surface) surf1; - Handle(Adaptor3d_Surface) surf2; - Handle(Adaptor2d_Curve2d) rst1; - Handle(Adaptor2d_Curve2d) rst2; - Adaptor3d_CurveOnSurface cons1; - Adaptor3d_CurveOnSurface cons2; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor3d_Curve) tguide; - gp_Pnt ptrst1; - gp_Pnt ptrst2; - gp_Pnt2d pt2drst1; - gp_Pnt2d pt2drst2; - Standard_Real prmrst1; - Standard_Real prmrst2; - Standard_Boolean istangent; - gp_Vec tgrst1; - gp_Vec2d tg2drst1; - gp_Vec tgrst2; - gp_Vec2d tg2drst2; - Standard_Real ray; - Standard_Integer choix; - gp_Pnt ptgui; - gp_Vec d1gui; - gp_Vec d2gui; - gp_Vec nplan; - Standard_Real normtg; - Standard_Real theD; - Handle(Adaptor3d_Surface) surfref1; - Handle(Adaptor2d_Curve2d) rstref1; - Handle(Adaptor3d_Surface) surfref2; - Handle(Adaptor2d_Curve2d) rstref2; - Standard_Real maxang; - Standard_Real minang; - Standard_Real distmin; - BlendFunc_SectionShape mySShape; - Convert_ParameterisationType myTConv; + occ::handle surf1; + occ::handle surf2; + occ::handle rst1; + occ::handle rst2; + Adaptor3d_CurveOnSurface cons1; + Adaptor3d_CurveOnSurface cons2; + occ::handle guide; + occ::handle tguide; + gp_Pnt ptrst1; + gp_Pnt ptrst2; + gp_Pnt2d pt2drst1; + gp_Pnt2d pt2drst2; + double prmrst1; + double prmrst2; + bool istangent; + gp_Vec tgrst1; + gp_Vec2d tg2drst1; + gp_Vec tgrst2; + gp_Vec2d tg2drst2; + double ray; + int choix; + gp_Pnt ptgui; + gp_Vec d1gui; + gp_Vec d2gui; + gp_Vec nplan; + double normtg; + double theD; + occ::handle surfref1; + occ::handle rstref1; + occ::handle surfref2; + occ::handle rstref2; + double maxang; + double minang; + double distmin; + BlendFunc_SectionShape mySShape; + Convert_ParameterisationType myTConv; }; #endif // _BRepBlend_RstRstConstRad_HeaderFile diff --git a/opencascade/BRepBlend_RstRstEvolRad.hxx b/opencascade/BRepBlend_RstRstEvolRad.hxx index 283bcd35a..cb9a6b287 100644 --- a/opencascade/BRepBlend_RstRstEvolRad.hxx +++ b/opencascade/BRepBlend_RstRstEvolRad.hxx @@ -28,257 +28,243 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include class Law_Function; class math_Matrix; class gp_Circ; class Blend_Point; -//! Function to approximate by AppSurface for -//! Edge/Edge and evolutif radius +//! Function to approximate by AppSurface for +//! Edge/Edge and evolutif radius class BRepBlend_RstRstEvolRad : public Blend_RstRstFunction { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_RstRstEvolRad(const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor2d_Curve2d)& Rst1, - const Handle(Adaptor3d_Surface)& Surf2, - const Handle(Adaptor2d_Curve2d)& Rst2, - const Handle(Adaptor3d_Curve)& CGuide, - const Handle(Law_Function)& Evol); + Standard_EXPORT BRepBlend_RstRstEvolRad(const occ::handle& Surf1, + const occ::handle& Rst1, + const occ::handle& Surf2, + const occ::handle& Rst2, + const occ::handle& CGuide, + const occ::handle& Evol); //! Returns 2. - Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; + Standard_EXPORT int NbVariables() const override; //! Returns 2. - Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, - math_Vector& F, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_EXPORT void Set(const Handle(Adaptor3d_Surface)& SurfRef1, - const Handle(Adaptor2d_Curve2d)& RstRef1, - const Handle(Adaptor3d_Surface)& SurfRef2, - const Handle(Adaptor2d_Curve2d)& RstRef2); + Standard_EXPORT void Set(const occ::handle& SurfRef1, + const occ::handle& RstRef1, + const occ::handle& SurfRef2, + const occ::handle& RstRef2); - Standard_EXPORT void Set(const Standard_Real Param) Standard_OVERRIDE; + Standard_EXPORT void Set(const double Param) override; //! Sets the bounds of the parametric interval on //! the guide line. //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT void Set(const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; + Standard_EXPORT void Set(const double First, const double Last) override; - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; - Standard_EXPORT void GetBounds(math_Vector& InfBound, - math_Vector& SupBound) const Standard_OVERRIDE; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, - const Standard_Real Tol) Standard_OVERRIDE; + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; - //! Returns the minimal Distance between two + //! Returns the minimal Distance between two //! extremities of calculated sections. - Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; + Standard_EXPORT double GetMinimalDistance() const override; - Standard_EXPORT const gp_Pnt& PointOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst1() const override; - Standard_EXPORT const gp_Pnt& PointOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst2() const override; //! Returns U,V coordinates of the point on the surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const override; - //! Returns U,V coordinates of the point on the curve on + //! Returns U,V coordinates of the point on the curve on //! surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst1() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst1() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst2() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst2() const override; - Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; + Standard_EXPORT bool IsTangencyPoint() const override; - Standard_EXPORT const gp_Vec& TangentOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst1() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const override; - Standard_EXPORT const gp_Vec& TangentOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst2() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const override; - //! Enables implementation of a criterion of decrochage + //! Enables implementation of a criterion of decrochage //! specific to the function. Standard_EXPORT Blend_DecrochStatus Decroch(const math_Vector& Sol, gp_Vec& NRst1, gp_Vec& TgRst1, gp_Vec& NRst2, - gp_Vec& TgRst2) const Standard_OVERRIDE; + gp_Vec& TgRst2) const override; - Standard_EXPORT void Set(const Standard_Integer Choix); + Standard_EXPORT void Set(const int Choix); - //! Sets the type of section generation for the + //! Sets the type of section generation for the //! approximations. Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection); - //! Gives the center of circle defined by PtRst1, PtRst2 and + //! Gives the center of circle defined by PtRst1, PtRst2 and //! radius ray. - Standard_EXPORT Standard_Boolean CenterCircleRst1Rst2(const gp_Pnt& PtRst1, - const gp_Pnt& PtRst2, - const gp_Vec& np, - gp_Pnt& Center, - gp_Vec& VdMed) const; - - Standard_EXPORT void Section(const Standard_Real Param, - const Standard_Real U, - const Standard_Real V, - Standard_Real& Pdeb, - Standard_Real& Pfin, - gp_Circ& C); - - //! Returns if the section is rational - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + Standard_EXPORT bool CenterCircleRst1Rst2(const gp_Pnt& PtRst1, + const gp_Pnt& PtRst2, + const gp_Vec& np, + gp_Pnt& Center, + gp_Vec& VdMed) const; + + Standard_EXPORT void Section(const double Param, + const double U, + const double V, + double& Pdeb, + double& Pfin, + gp_Circ& C); + + //! Returns if the section is rational + Standard_EXPORT bool IsRational() const override; //! Returns the length of the maximum section - Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; + Standard_EXPORT double GetSectionSize() const override; //! Compute the minimal value of weight for each poles //! of all sections. - Standard_EXPORT void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; + Standard_EXPORT void GetMinimalWeight(NCollection_Array1& Weigths) const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - Standard_EXPORT void GetShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree, - Standard_Integer& NbPoles2d) Standard_OVERRIDE; + Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override; //! Returns the tolerance to reach in approximation //! to respect //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary //! SurfTol error inside the surface. - Standard_EXPORT void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - math_Vector& Tol3d, - math_Vector& Tol1D) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + math_Vector& Tol3d, + math_Vector& Tol1D) const override; - Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; + Standard_EXPORT void Knots(NCollection_Array1& TKnots) override; - Standard_EXPORT void Mults(TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; + Standard_EXPORT void Mults(NCollection_Array1& TMults) override; //! Used for the first and last section - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; - - Standard_EXPORT void Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths) override; + + Standard_EXPORT void Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) override; //! Used for the first and last section - //! The method returns Standard_True if the derivatives - //! are computed, otherwise it returns Standard_False. - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Resolution(const Standard_Integer IC2d, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const Standard_OVERRIDE; - -protected: + //! The method returns true if the derivatives + //! are computed, otherwise it returns false. + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths) override; + + Standard_EXPORT void Resolution(const int IC2d, + const double Tol, + double& TolU, + double& TolV) const override; + private: - Handle(Adaptor3d_Surface) surf1; - Handle(Adaptor3d_Surface) surf2; - Handle(Adaptor2d_Curve2d) rst1; - Handle(Adaptor2d_Curve2d) rst2; - Adaptor3d_CurveOnSurface cons1; - Adaptor3d_CurveOnSurface cons2; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor3d_Curve) tguide; - gp_Pnt ptrst1; - gp_Pnt ptrst2; - gp_Pnt2d pt2drst1; - gp_Pnt2d pt2drst2; - Standard_Real prmrst1; - Standard_Real prmrst2; - Standard_Boolean istangent; - gp_Vec tgrst1; - gp_Vec2d tg2drst1; - gp_Vec tgrst2; - gp_Vec2d tg2drst2; - Standard_Real ray; - Standard_Real dray; - Standard_Integer choix; - gp_Pnt ptgui; - gp_Vec d1gui; - gp_Vec d2gui; - gp_Vec nplan; - Standard_Real normtg; - Standard_Real theD; - Handle(Adaptor3d_Surface) surfref1; - Handle(Adaptor2d_Curve2d) rstref1; - Handle(Adaptor3d_Surface) surfref2; - Handle(Adaptor2d_Curve2d) rstref2; - Standard_Real maxang; - Standard_Real minang; - Standard_Real distmin; - BlendFunc_SectionShape mySShape; - Convert_ParameterisationType myTConv; - Handle(Law_Function) tevol; - Handle(Law_Function) fevol; + occ::handle surf1; + occ::handle surf2; + occ::handle rst1; + occ::handle rst2; + Adaptor3d_CurveOnSurface cons1; + Adaptor3d_CurveOnSurface cons2; + occ::handle guide; + occ::handle tguide; + gp_Pnt ptrst1; + gp_Pnt ptrst2; + gp_Pnt2d pt2drst1; + gp_Pnt2d pt2drst2; + double prmrst1; + double prmrst2; + bool istangent; + gp_Vec tgrst1; + gp_Vec2d tg2drst1; + gp_Vec tgrst2; + gp_Vec2d tg2drst2; + double ray; + double dray; + int choix; + gp_Pnt ptgui; + gp_Vec d1gui; + gp_Vec d2gui; + gp_Vec nplan; + double normtg; + double theD; + occ::handle surfref1; + occ::handle rstref1; + occ::handle surfref2; + occ::handle rstref2; + double maxang; + double minang; + double distmin; + BlendFunc_SectionShape mySShape; + Convert_ParameterisationType myTConv; + occ::handle tevol; + occ::handle fevol; }; #endif // _BRepBlend_RstRstEvolRad_HeaderFile diff --git a/opencascade/BRepBlend_RstRstLineBuilder.hxx b/opencascade/BRepBlend_RstRstLineBuilder.hxx index 437184477..08f025523 100644 --- a/opencascade/BRepBlend_RstRstLineBuilder.hxx +++ b/opencascade/BRepBlend_RstRstLineBuilder.hxx @@ -33,25 +33,25 @@ class Adaptor3d_HVertex; class IntSurf_Transition; class BRepBlend_Extremity; -//! This class processes the data resulting from -//! Blend_CSWalking but it takes in consideration the Surface -//! supporting the curve to detect the breakpoint. +//! This class processes the data resulting from +//! Blend_CSWalking but it takes in consideration the Surface +//! supporting the curve to detect the breakpoint. //! -//! As a result, the criteria of distribution of -//! points on the line become more flexible because it -//! should calculate values approached -//! by an approximation of continued functions based on the +//! As a result, the criteria of distribution of +//! points on the line become more flexible because it +//! should calculate values approached +//! by an approximation of continued functions based on the //! Blend_RstRstFunction. //! -//! Thus this pseudo path necessitates 3 criteria of -//! regrouping : +//! Thus this pseudo path necessitates 3 criteria of +//! regrouping: //! -//! 1) exit of the domain of the curve +//! 1) exit of the domain of the curve //! -//! 2) exit of the domain of the surface +//! 2) exit of the domain of the surface //! -//! 3) stall as there is a solution of problem -//! surf/surf within the domain of the surface +//! 3) stall as there is a solution of problem +//! surf/surf within the domain of the surface //! of support of the restriction. //! //! Construction of a BRepBlend_Line between two pcurves @@ -67,141 +67,140 @@ class BRepBlend_RstRstLineBuilder public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_RstRstLineBuilder(const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor2d_Curve2d)& Rst1, - const Handle(Adaptor3d_TopolTool)& Domain1, - const Handle(Adaptor3d_Surface)& Surf2, - const Handle(Adaptor2d_Curve2d)& Rst2, - const Handle(Adaptor3d_TopolTool)& Domain2); + Standard_EXPORT BRepBlend_RstRstLineBuilder(const occ::handle& Surf1, + const occ::handle& Rst1, + const occ::handle& Domain1, + const occ::handle& Surf2, + const occ::handle& Rst2, + const occ::handle& Domain2); Standard_EXPORT void Perform(Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, - const Standard_Real Pdep, - const Standard_Real Pmax, - const Standard_Real MaxStep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, + const double Pdep, + const double Pmax, + const double MaxStep, + const double Tol3d, + const double TolGuide, const math_Vector& Soldep, - const Standard_Real Fleche, - const Standard_Boolean Appro = Standard_False); - - Standard_EXPORT Standard_Boolean PerformFirstSection(Blend_RstRstFunction& Func, - Blend_SurfCurvFuncInv& Finv1, - Blend_CurvPointFuncInv& FinvP1, - Blend_SurfCurvFuncInv& Finv2, - Blend_CurvPointFuncInv& FinvP2, - const Standard_Real Pdep, - const Standard_Real Pmax, - const math_Vector& Soldep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, - const Standard_Boolean RecRst1, - const Standard_Boolean RecP1, - const Standard_Boolean RecRst2, - const Standard_Boolean RecP2, - Standard_Real& Psol, - math_Vector& ParSol); - - Standard_EXPORT Standard_Boolean Complete(Blend_RstRstFunction& Func, - Blend_SurfCurvFuncInv& Finv1, - Blend_CurvPointFuncInv& FinvP1, - Blend_SurfCurvFuncInv& Finv2, - Blend_CurvPointFuncInv& FinvP2, - const Standard_Real Pmin); - - Standard_Boolean IsDone() const; - - const Handle(BRepBlend_Line)& Line() const; - - Standard_Boolean Decroch1Start() const; - - Standard_Boolean Decroch1End() const; - - Standard_Boolean Decroch2Start() const; - - Standard_Boolean Decroch2End() const; - -protected: + const double Fleche, + const bool Appro = false); + + Standard_EXPORT bool PerformFirstSection(Blend_RstRstFunction& Func, + Blend_SurfCurvFuncInv& Finv1, + Blend_CurvPointFuncInv& FinvP1, + Blend_SurfCurvFuncInv& Finv2, + Blend_CurvPointFuncInv& FinvP2, + const double Pdep, + const double Pmax, + const math_Vector& Soldep, + const double Tol3d, + const double TolGuide, + const bool RecRst1, + const bool RecP1, + const bool RecRst2, + const bool RecP2, + double& Psol, + math_Vector& ParSol); + + Standard_EXPORT bool Complete(Blend_RstRstFunction& Func, + Blend_SurfCurvFuncInv& Finv1, + Blend_CurvPointFuncInv& FinvP1, + Blend_SurfCurvFuncInv& Finv2, + Blend_CurvPointFuncInv& FinvP2, + const double Pmin); + + bool IsDone() const; + + const occ::handle& Line() const; + + bool Decroch1Start() const; + + bool Decroch1End() const; + + bool Decroch2Start() const; + + bool Decroch2End() const; + private: Standard_EXPORT void InternalPerform(Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, - const Standard_Real Bound); - - Standard_EXPORT Standard_Boolean Recadre1(Blend_RstRstFunction& Func, - Blend_SurfCurvFuncInv& Finv, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Standard_Boolean Recadre2(Blend_RstRstFunction& Func, - Blend_SurfCurvFuncInv& Finv, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Standard_Boolean Recadre1(Blend_CurvPointFuncInv& FinvP, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Standard_Boolean Recadre2(Blend_CurvPointFuncInv& FinvP, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT void Transition(const Standard_Boolean OnFirst, - const Handle(Adaptor2d_Curve2d)& Arc, - const Standard_Real Param, - IntSurf_Transition& TLine, - IntSurf_Transition& TArc); - - Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, - const Standard_Boolean OnFirst, - const Handle(Adaptor2d_Curve2d)& Arc, - const Standard_Real Param, - const Standard_Boolean IsVtx, - const Handle(Adaptor3d_HVertex)& Vtx); + const double Bound); + + Standard_EXPORT bool Recadre1(Blend_RstRstFunction& Func, + Blend_SurfCurvFuncInv& Finv, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT bool Recadre2(Blend_RstRstFunction& Func, + Blend_SurfCurvFuncInv& Finv, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT bool Recadre1(Blend_CurvPointFuncInv& FinvP, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT bool Recadre2(Blend_CurvPointFuncInv& FinvP, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT void Transition(const bool OnFirst, + const occ::handle& Arc, + const double Param, + IntSurf_Transition& TLine, + IntSurf_Transition& TArc); + + Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, + const bool OnFirst, + const occ::handle& Arc, + const double Param, + const bool IsVtx, + const occ::handle& Vtx); Standard_EXPORT Blend_Status CheckDeflectionOnRst1(const Blend_Point& CurPoint); Standard_EXPORT Blend_Status CheckDeflectionOnRst2(const Blend_Point& CurPoint); - Standard_EXPORT Blend_Status TestArret(Blend_RstRstFunction& Func, - const Standard_Boolean TestDeflection, - const Blend_Status State); - - Standard_EXPORT Standard_Boolean CheckInside(Blend_RstRstFunction& Func, - TopAbs_State& SituOnC1, - TopAbs_State& SituOnC2, - Blend_DecrochStatus& Decroch); - - Standard_Boolean done; - Handle(BRepBlend_Line) line; - math_Vector sol; - Handle(Adaptor3d_Surface) surf1; - Handle(Adaptor3d_TopolTool) domain1; - Handle(Adaptor3d_Surface) surf2; - Handle(Adaptor3d_TopolTool) domain2; - Handle(Adaptor2d_Curve2d) rst1; - Handle(Adaptor2d_Curve2d) rst2; - Standard_Real tolpoint3d; - Standard_Real tolgui; - Standard_Real pasmax; - Standard_Real fleche; - Standard_Real param; - Blend_Point previousP; - Standard_Boolean rebrou; - Standard_Boolean iscomplete; - Standard_Boolean comptra; - Standard_Real sens; - Blend_DecrochStatus decrochdeb; - Blend_DecrochStatus decrochfin; + Standard_EXPORT Blend_Status TestArret(Blend_RstRstFunction& Func, + const bool TestDeflection, + const Blend_Status State); + + Standard_EXPORT bool CheckInside(Blend_RstRstFunction& Func, + TopAbs_State& SituOnC1, + TopAbs_State& SituOnC2, + Blend_DecrochStatus& Decroch); + + bool done; + occ::handle line; + math_Vector sol; + occ::handle surf1; + occ::handle domain1; + occ::handle surf2; + occ::handle domain2; + occ::handle rst1; + occ::handle rst2; + double tolpoint3d; + double tolgui; + double pasmax; + double fleche; + double param; + Blend_Point previousP; + bool rebrou; + bool iscomplete; + bool comptra; + double sens; + Blend_DecrochStatus decrochdeb; + Blend_DecrochStatus decrochfin; }; #include diff --git a/opencascade/BRepBlend_RstRstLineBuilder.lxx b/opencascade/BRepBlend_RstRstLineBuilder.lxx index eb9112aea..85f88da46 100644 --- a/opencascade/BRepBlend_RstRstLineBuilder.lxx +++ b/opencascade/BRepBlend_RstRstLineBuilder.lxx @@ -16,22 +16,16 @@ #include -//======================================================================= -// function : IsDone -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_RstRstLineBuilder::IsDone() const +inline bool BRepBlend_RstRstLineBuilder::IsDone() const { return done; } -//======================================================================= -// function : Line -// purpose : -//======================================================================= +//================================================================================================= -inline const Handle(BRepBlend_Line)& BRepBlend_RstRstLineBuilder::Line() const +inline const occ::handle& BRepBlend_RstRstLineBuilder::Line() const { if (!done) { @@ -40,54 +34,30 @@ inline const Handle(BRepBlend_Line)& BRepBlend_RstRstLineBuilder::Line() const return line; } -//======================================================================= -// function : Decroch1Start -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_RstRstLineBuilder::Decroch1Start() const +inline bool BRepBlend_RstRstLineBuilder::Decroch1Start() const { - if (decrochdeb == Blend_DecrochRst1 || decrochdeb == Blend_DecrochBoth) - return Standard_True; - - return Standard_False; + return decrochdeb == Blend_DecrochRst1 || decrochdeb == Blend_DecrochBoth; } -//======================================================================= -// function : Decroch1End -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_RstRstLineBuilder::Decroch1End() const +inline bool BRepBlend_RstRstLineBuilder::Decroch1End() const { - if (decrochfin == Blend_DecrochRst1 || decrochfin == Blend_DecrochBoth) - return Standard_True; - - return Standard_False; + return decrochfin == Blend_DecrochRst1 || decrochfin == Blend_DecrochBoth; } -//======================================================================= -// function : Decroch2Start -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_RstRstLineBuilder::Decroch2Start() const +inline bool BRepBlend_RstRstLineBuilder::Decroch2Start() const { - if (decrochdeb == Blend_DecrochRst2 || decrochdeb == Blend_DecrochBoth) - return Standard_True; - - return Standard_False; + return decrochdeb == Blend_DecrochRst2 || decrochdeb == Blend_DecrochBoth; } -//======================================================================= -// function : Decroch2End -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_RstRstLineBuilder::Decroch2End() const +inline bool BRepBlend_RstRstLineBuilder::Decroch2End() const { - if (decrochfin == Blend_DecrochRst2 || decrochfin == Blend_DecrochBoth) - return Standard_True; - - return Standard_False; + return decrochfin == Blend_DecrochRst2 || decrochfin == Blend_DecrochBoth; } diff --git a/opencascade/BRepBlend_SequenceOfLine.hxx b/opencascade/BRepBlend_SequenceOfLine.hxx index dfb970ee2..a69e80735 100644 --- a/opencascade/BRepBlend_SequenceOfLine.hxx +++ b/opencascade/BRepBlend_SequenceOfLine.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-12-06 -// Created by: Jacques GOUSSARD -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepBlend_SequenceOfLine_HeaderFile -#define BRepBlend_SequenceOfLine_HeaderFile +//! @file BRepBlend_SequenceOfLine.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence> directly instead. +#ifndef _BRepBlend_SequenceOfLine_hxx +#define _BRepBlend_SequenceOfLine_hxx + +#include #include #include -typedef NCollection_Sequence BRepBlend_SequenceOfLine; +Standard_HEADER_DEPRECATED("BRepBlend_SequenceOfLine.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence> directly.") + + Standard_DEPRECATED("BRepBlend_SequenceOfLine is deprecated, use " + "NCollection_Sequence> directly") +typedef NCollection_Sequence> BRepBlend_SequenceOfLine; -#endif +#endif // _BRepBlend_SequenceOfLine_hxx diff --git a/opencascade/BRepBlend_SequenceOfPointOnRst.hxx b/opencascade/BRepBlend_SequenceOfPointOnRst.hxx index c66151fcd..695aa7a40 100644 --- a/opencascade/BRepBlend_SequenceOfPointOnRst.hxx +++ b/opencascade/BRepBlend_SequenceOfPointOnRst.hxx @@ -1,7 +1,4 @@ -// Created on: 1993-12-06 -// Created by: Jacques GOUSSARD -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepBlend_SequenceOfPointOnRst_HeaderFile -#define BRepBlend_SequenceOfPointOnRst_HeaderFile +//! @file BRepBlend_SequenceOfPointOnRst.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _BRepBlend_SequenceOfPointOnRst_hxx +#define _BRepBlend_SequenceOfPointOnRst_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepBlend_SequenceOfPointOnRst.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence directly.") + + Standard_DEPRECATED("BRepBlend_SequenceOfPointOnRst is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence BRepBlend_SequenceOfPointOnRst; -#endif +#endif // _BRepBlend_SequenceOfPointOnRst_hxx diff --git a/opencascade/BRepBlend_SurfCurvConstRadInv.hxx b/opencascade/BRepBlend_SurfCurvConstRadInv.hxx index e94dccf1a..2d93d945c 100644 --- a/opencascade/BRepBlend_SurfCurvConstRadInv.hxx +++ b/opencascade/BRepBlend_SurfCurvConstRadInv.hxx @@ -25,12 +25,12 @@ class math_Matrix; //! Function of reframing between a restriction surface of the //! surface and a curve. -//! Class used to compute a solution of the -//! surfRstConstRad problem on a done restriction of the +//! Class used to compute a solution of the +//! surfRstConstRad problem on a done restriction of the //! surface. -//! The vector used in Value, Values and Derivatives -//! methods has to be the vector of the parametric -//! coordinates wguide, wcurv, wrst where wguide is the +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates wguide, wcurv, wrst where wguide is the //! parameter on the guide line, wcurv is the parameter on //! the curve, wrst is the parameter on the restriction on //! the surface. @@ -39,59 +39,58 @@ class BRepBlend_SurfCurvConstRadInv : public Blend_SurfCurvFuncInv public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfCurvConstRadInv(const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor3d_Curve)& C, - const Handle(Adaptor3d_Curve)& Cg); + Standard_EXPORT BRepBlend_SurfCurvConstRadInv(const occ::handle& S, + const occ::handle& C, + const occ::handle& Cg); - Standard_EXPORT void Set(const Standard_Real R, const Standard_Integer Choix); + Standard_EXPORT void Set(const double R, const int Choix); //! returns 3. - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; //! Set the restriction on which a solution has to be found. - Standard_EXPORT void Set(const Handle(Adaptor2d_Curve2d)& Rst); + Standard_EXPORT void Set(const occ::handle& Rst) override; //! Returns in the vector Tolerance the parametric tolerance //! for each of the 3 variables; //! Tol is the tolerance used in 3d space. - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; //! Returns in the vector InfBound the lowest values allowed //! for each of the 3 variables. //! Returns in the vector SupBound the greatest values allowed //! for each of the 3 variables. - Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - //! Returns Standard_True if Sol is a zero of the function. + //! Returns true if Sol is a zero of the function. //! Tol is the tolerance used in 3d space. - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; -protected: private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Curve) curv; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor2d_Curve2d) rst; - Standard_Real ray; - Standard_Integer choix; + occ::handle surf; + occ::handle curv; + occ::handle guide; + occ::handle rst; + double ray; + int choix; }; #endif // _BRepBlend_SurfCurvConstRadInv_HeaderFile diff --git a/opencascade/BRepBlend_SurfCurvEvolRadInv.hxx b/opencascade/BRepBlend_SurfCurvEvolRadInv.hxx index 950d145ff..857c5327a 100644 --- a/opencascade/BRepBlend_SurfCurvEvolRadInv.hxx +++ b/opencascade/BRepBlend_SurfCurvEvolRadInv.hxx @@ -26,12 +26,12 @@ class math_Matrix; //! Function of reframing between a surface restriction //! of the surface and a curve. -//! Class used to compute a solution of the -//! surfRstConstRad problem on a done restriction of the +//! Class used to compute a solution of the +//! surfRstConstRad problem on a done restriction of the //! surface. -//! The vector used in Value, Values and Derivatives -//! methods has to be the vector of the parametric -//! coordinates wguide, wcurv, wrst where wguide is the +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates wguide, wcurv, wrst where wguide is the //! parameter on the guide line, wcurv is the parameter on //! the curve, wrst is the parameter on the restriction on //! the surface. @@ -40,62 +40,61 @@ class BRepBlend_SurfCurvEvolRadInv : public Blend_SurfCurvFuncInv public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfCurvEvolRadInv(const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor3d_Curve)& C, - const Handle(Adaptor3d_Curve)& Cg, - const Handle(Law_Function)& Evol); + Standard_EXPORT BRepBlend_SurfCurvEvolRadInv(const occ::handle& S, + const occ::handle& C, + const occ::handle& Cg, + const occ::handle& Evol); - Standard_EXPORT void Set(const Standard_Integer Choix); + Standard_EXPORT void Set(const int Choix); //! returns 3. - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; //! Set the restriction on which a solution has to be found. - Standard_EXPORT void Set(const Handle(Adaptor2d_Curve2d)& Rst); + Standard_EXPORT void Set(const occ::handle& Rst) override; //! Returns in the vector Tolerance the parametric tolerance //! for each of the 3 variables; //! Tol is the tolerance used in 3d space. - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; //! Returns in the vector InfBound the lowest values allowed //! for each of the 3 variables. //! Returns in the vector SupBound the greatest values allowed //! for each of the 3 variables. - Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - //! Returns Standard_True if Sol is a zero of the function. + //! Returns true if Sol is a zero of the function. //! Tol is the tolerance used in 3d space. - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; -protected: private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Curve) curv; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor2d_Curve2d) rst; - Standard_Real ray; - Standard_Integer choix; - Handle(Law_Function) tevol; - Standard_Real sg1; + occ::handle surf; + occ::handle curv; + occ::handle guide; + occ::handle rst; + double ray; + int choix; + occ::handle tevol; + double sg1; }; #endif // _BRepBlend_SurfCurvEvolRadInv_HeaderFile diff --git a/opencascade/BRepBlend_SurfPointConstRadInv.hxx b/opencascade/BRepBlend_SurfPointConstRadInv.hxx index 6a5d7e4fc..c616eb77d 100644 --- a/opencascade/BRepBlend_SurfPointConstRadInv.hxx +++ b/opencascade/BRepBlend_SurfPointConstRadInv.hxx @@ -25,70 +25,69 @@ class math_Matrix; //! Function of reframing between a point and a surface. -//! This function is used to find a solution on a done -//! point of the curve when using SurfRstConsRad or +//! This function is used to find a solution on a done +//! point of the curve when using SurfRstConsRad or //! CSConstRad... -//! The vector used in Value, Values and Derivatives -//! methods has to be the vector of the parametric -//! coordinates w, U, V where w is the parameter on the -//! guide line, U,V are the parametric coordinates of a +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates w, U, V where w is the parameter on the +//! guide line, U,V are the parametric coordinates of a //! point on the partner surface. class BRepBlend_SurfPointConstRadInv : public Blend_SurfPointFuncInv { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfPointConstRadInv(const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor3d_Curve)& C); + Standard_EXPORT BRepBlend_SurfPointConstRadInv(const occ::handle& S, + const occ::handle& C); - Standard_EXPORT void Set(const Standard_Real R, const Standard_Integer Choix); + Standard_EXPORT void Set(const double R, const int Choix); //! returns 3. - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; //! Set the Point on which a solution has to be found. - Standard_EXPORT void Set(const gp_Pnt& P); + Standard_EXPORT void Set(const gp_Pnt& P) override; //! Returns in the vector Tolerance the parametric tolerance //! for each of the 3 variables; //! Tol is the tolerance used in 3d space. - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; //! Returns in the vector InfBound the lowest values allowed //! for each of the 3 variables. //! Returns in the vector SupBound the greatest values allowed //! for each of the 3 variables. - Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - //! Returns Standard_True if Sol is a zero of the function. + //! Returns true if Sol is a zero of the function. //! Tol is the tolerance used in 3d space. - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; -protected: private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Curve) curv; - gp_Pnt point; - Standard_Real ray; - Standard_Integer choix; + occ::handle surf; + occ::handle curv; + gp_Pnt point; + double ray; + int choix; }; #endif // _BRepBlend_SurfPointConstRadInv_HeaderFile diff --git a/opencascade/BRepBlend_SurfPointEvolRadInv.hxx b/opencascade/BRepBlend_SurfPointEvolRadInv.hxx index 93f41899e..35d7d1cf5 100644 --- a/opencascade/BRepBlend_SurfPointEvolRadInv.hxx +++ b/opencascade/BRepBlend_SurfPointEvolRadInv.hxx @@ -26,73 +26,72 @@ class Law_Function; class math_Matrix; //! Function of reframing between a point and a surface. -//! This function is used to find a solution on a done -//! point of the curve when using SurfRstConsRad or +//! This function is used to find a solution on a done +//! point of the curve when using SurfRstConsRad or //! CSConstRad... -//! The vector used in Value, Values and Derivatives -//! methods has to be the vector of the parametric -//! coordinates w, U, V where w is the parameter on the -//! guide line, U,V are the parametric coordinates of a +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates w, U, V where w is the parameter on the +//! guide line, U,V are the parametric coordinates of a //! point on the partner surface. class BRepBlend_SurfPointEvolRadInv : public Blend_SurfPointFuncInv { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfPointEvolRadInv(const Handle(Adaptor3d_Surface)& S, - const Handle(Adaptor3d_Curve)& C, - const Handle(Law_Function)& Evol); + Standard_EXPORT BRepBlend_SurfPointEvolRadInv(const occ::handle& S, + const occ::handle& C, + const occ::handle& Evol); - Standard_EXPORT void Set(const Standard_Integer Choix); + Standard_EXPORT void Set(const int Choix); //! returns 3. - Standard_EXPORT Standard_Integer NbEquations() const; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; //! Set the Point on which a solution has to be found. - Standard_EXPORT void Set(const gp_Pnt& P); + Standard_EXPORT void Set(const gp_Pnt& P) override; //! Returns in the vector Tolerance the parametric tolerance //! for each of the 3 variables; //! Tol is the tolerance used in 3d space. - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; //! Returns in the vector InfBound the lowest values allowed //! for each of the 3 variables. //! Returns in the vector SupBound the greatest values allowed //! for each of the 3 variables. - Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - //! Returns Standard_True if Sol is a zero of the function. + //! Returns true if Sol is a zero of the function. //! Tol is the tolerance used in 3d space. - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; -protected: private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Curve) curv; - gp_Pnt point; - Standard_Real ray; - Standard_Integer choix; - Handle(Law_Function) tevol; - Standard_Real sg1; + occ::handle surf; + occ::handle curv; + gp_Pnt point; + double ray; + int choix; + occ::handle tevol; + double sg1; }; #endif // _BRepBlend_SurfPointEvolRadInv_HeaderFile diff --git a/opencascade/BRepBlend_SurfRstConstRad.hxx b/opencascade/BRepBlend_SurfRstConstRad.hxx index 964b23d73..0c7a6d855 100644 --- a/opencascade/BRepBlend_SurfRstConstRad.hxx +++ b/opencascade/BRepBlend_SurfRstConstRad.hxx @@ -27,13 +27,9 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include class math_Matrix; class gp_Circ; @@ -46,215 +42,203 @@ class BRepBlend_SurfRstConstRad : public Blend_SurfRstFunction public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfRstConstRad(const Handle(Adaptor3d_Surface)& Surf, - const Handle(Adaptor3d_Surface)& SurfRst, - const Handle(Adaptor2d_Curve2d)& Rst, - const Handle(Adaptor3d_Curve)& CGuide); + Standard_EXPORT BRepBlend_SurfRstConstRad(const occ::handle& Surf, + const occ::handle& SurfRst, + const occ::handle& Rst, + const occ::handle& CGuide); //! Returns 3. - Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; + Standard_EXPORT int NbVariables() const override; //! Returns 3. - Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, - math_Vector& F, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_EXPORT void Set(const Handle(Adaptor3d_Surface)& SurfRef, - const Handle(Adaptor2d_Curve2d)& RstRef); + Standard_EXPORT void Set(const occ::handle& SurfRef, + const occ::handle& RstRef); - Standard_EXPORT void Set(const Standard_Real Param) Standard_OVERRIDE; + Standard_EXPORT void Set(const double Param) override; //! Sets the bounds of the parametric interval on //! the guide line. //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT void Set(const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; + Standard_EXPORT void Set(const double First, const double Last) override; - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; - Standard_EXPORT void GetBounds(math_Vector& InfBound, - math_Vector& SupBound) const Standard_OVERRIDE; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, - const Standard_Real Tol) Standard_OVERRIDE; + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; - //! Returns the minimal Distance between two + //! Returns the minimal Distance between two //! extremities of calculated sections. - Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; + Standard_EXPORT double GetMinimalDistance() const override; - Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnS() const override; - Standard_EXPORT const gp_Pnt& PointOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst() const override; //! Returns U,V coordinates of the point on the surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const override; - //! Returns U,V coordinates of the point on the curve on + //! Returns U,V coordinates of the point on the curve on //! surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst() const override; - Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; + Standard_EXPORT bool IsTangencyPoint() const override; - Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnS() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const override; - Standard_EXPORT const gp_Vec& TangentOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const override; - //! Enables implementation of a criterion of decrochage - //! specific to the function. - //! Warning: Can be called without previous call of issolution - //! but the values calculated can be senseless. - Standard_EXPORT Standard_Boolean Decroch(const math_Vector& Sol, - gp_Vec& NS, - gp_Vec& TgS) const Standard_OVERRIDE; + //! Enables implementation of a criterion of decrochage + //! specific to the function. + //! Warning: Can be called without previous call of IsSolution + //! but the values calculated can be senseless. + Standard_EXPORT bool Decroch(const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const override; - Standard_EXPORT void Set(const Standard_Real Radius, const Standard_Integer Choix); + Standard_EXPORT void Set(const double Radius, const int Choix); - //! Sets the type of section generation for the + //! Sets the type of section generation for the //! approximations. Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection); - Standard_EXPORT void Section(const Standard_Real Param, - const Standard_Real U, - const Standard_Real V, - const Standard_Real W, - Standard_Real& Pdeb, - Standard_Real& Pfin, - gp_Circ& C); + Standard_EXPORT void Section(const double Param, + const double U, + const double V, + const double W, + double& Pdeb, + double& Pfin, + gp_Circ& C); - //! Returns if the section is rational - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + //! Returns if the section is rational + Standard_EXPORT bool IsRational() const override; //! Returns the length of the maximum section - Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; + Standard_EXPORT double GetSectionSize() const override; //! Compute the minimal value of weight for each poles //! of all sections. - Standard_EXPORT void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; + Standard_EXPORT void GetMinimalWeight(NCollection_Array1& Weigths) const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - Standard_EXPORT void GetShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree, - Standard_Integer& NbPoles2d) Standard_OVERRIDE; + Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override; //! Returns the tolerance to reach in approximation //! to respect //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary //! SurfTol error inside the surface. - Standard_EXPORT void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - math_Vector& Tol3d, - math_Vector& Tol1D) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + math_Vector& Tol3d, + math_Vector& Tol1D) const override; - Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; + Standard_EXPORT void Knots(NCollection_Array1& TKnots) override; - Standard_EXPORT void Mults(TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; + Standard_EXPORT void Mults(NCollection_Array1& TMults) override; //! Used for the first and last section - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths) override; //! Used for the first and last section - //! The method returns Standard_True if the derivatives - //! are computed, otherwise it returns Standard_False. - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Resolution(const Standard_Integer IC2d, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const Standard_OVERRIDE; - -protected: + //! The method returns true if the derivatives + //! are computed, otherwise it returns false. + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths) override; + + Standard_EXPORT void Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) override; + + Standard_EXPORT void Resolution(const int IC2d, + const double Tol, + double& TolU, + double& TolV) const override; + private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Surface) surfrst; - Handle(Adaptor2d_Curve2d) rst; - Adaptor3d_CurveOnSurface cons; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor3d_Curve) tguide; - gp_Pnt pts; - gp_Pnt ptrst; - gp_Pnt2d pt2ds; - gp_Pnt2d pt2drst; - Standard_Real prmrst; - Standard_Boolean istangent; - gp_Vec tgs; - gp_Vec2d tg2ds; - gp_Vec tgrst; - gp_Vec2d tg2drst; - Standard_Real ray; - Standard_Integer choix; - gp_Pnt ptgui; - gp_Vec d1gui; - gp_Vec d2gui; - gp_Vec nplan; - Standard_Real normtg; - Standard_Real theD; - Handle(Adaptor3d_Surface) surfref; - Handle(Adaptor2d_Curve2d) rstref; - Standard_Real maxang; - Standard_Real minang; - Standard_Real distmin; - BlendFunc_SectionShape mySShape; - Convert_ParameterisationType myTConv; + occ::handle surf; + occ::handle surfrst; + occ::handle rst; + Adaptor3d_CurveOnSurface cons; + occ::handle guide; + occ::handle tguide; + gp_Pnt pts; + gp_Pnt ptrst; + gp_Pnt2d pt2ds; + gp_Pnt2d pt2drst; + double prmrst; + bool istangent; + gp_Vec tgs; + gp_Vec2d tg2ds; + gp_Vec tgrst; + gp_Vec2d tg2drst; + double ray; + int choix; + gp_Pnt ptgui; + gp_Vec d1gui; + gp_Vec d2gui; + gp_Vec nplan; + double normtg; + double theD; + occ::handle surfref; + occ::handle rstref; + double maxang; + double minang; + double distmin; + BlendFunc_SectionShape mySShape; + Convert_ParameterisationType myTConv; }; #endif // _BRepBlend_SurfRstConstRad_HeaderFile diff --git a/opencascade/BRepBlend_SurfRstEvolRad.hxx b/opencascade/BRepBlend_SurfRstEvolRad.hxx index 2ea1333c1..6f3eeecfe 100644 --- a/opencascade/BRepBlend_SurfRstEvolRad.hxx +++ b/opencascade/BRepBlend_SurfRstEvolRad.hxx @@ -27,238 +27,222 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include class Law_Function; class math_Matrix; class gp_Circ; class Blend_Point; -//! Function to approximate by AppSurface for -//! Edge/Face and evolutif radius +//! Function to approximate by AppSurface for +//! Edge/Face and evolutif radius class BRepBlend_SurfRstEvolRad : public Blend_SurfRstFunction { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfRstEvolRad(const Handle(Adaptor3d_Surface)& Surf, - const Handle(Adaptor3d_Surface)& SurfRst, - const Handle(Adaptor2d_Curve2d)& Rst, - const Handle(Adaptor3d_Curve)& CGuide, - const Handle(Law_Function)& Evol); + Standard_EXPORT BRepBlend_SurfRstEvolRad(const occ::handle& Surf, + const occ::handle& SurfRst, + const occ::handle& Rst, + const occ::handle& CGuide, + const occ::handle& Evol); //! Returns 3. - Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; + Standard_EXPORT int NbVariables() const override; //! Returns 3. - Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; + Standard_EXPORT int NbEquations() const override; //! computes the values of the Functions for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override; //! returns the values of the derivatives for the //! variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override; //! returns the values of the functions and the derivatives //! for the variable . //! Returns True if the computation was done successfully, //! False otherwise. - Standard_EXPORT Standard_Boolean Values(const math_Vector& X, - math_Vector& F, - math_Matrix& D) Standard_OVERRIDE; + Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override; - Standard_EXPORT void Set(const Handle(Adaptor3d_Surface)& SurfRef, - const Handle(Adaptor2d_Curve2d)& RstRef); + Standard_EXPORT void Set(const occ::handle& SurfRef, + const occ::handle& RstRef); - Standard_EXPORT void Set(const Standard_Real Param) Standard_OVERRIDE; + Standard_EXPORT void Set(const double Param) override; //! Sets the bounds of the parametric interval on //! the guide line. //! This determines the derivatives in these values if the //! function is not Cn. - Standard_EXPORT void Set(const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; + Standard_EXPORT void Set(const double First, const double Last) override; - Standard_EXPORT void GetTolerance(math_Vector& Tolerance, - const Standard_Real Tol) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override; - Standard_EXPORT void GetBounds(math_Vector& InfBound, - math_Vector& SupBound) const Standard_OVERRIDE; + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override; - Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, - const Standard_Real Tol) Standard_OVERRIDE; + Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override; - //! Returns the minimal Distance between two + //! Returns the minimal Distance between two //! extremities of calculated sections. - Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; + Standard_EXPORT double GetMinimalDistance() const override; - Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnS() const override; - Standard_EXPORT const gp_Pnt& PointOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt& PointOnRst() const override; //! Returns U,V coordinates of the point on the surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const override; - //! Returns U,V coordinates of the point on the curve on + //! Returns U,V coordinates of the point on the curve on //! surface. - Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const override; //! Returns parameter of the point on the curve. - Standard_EXPORT Standard_Real ParameterOnRst() const Standard_OVERRIDE; + Standard_EXPORT double ParameterOnRst() const override; - Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; + Standard_EXPORT bool IsTangencyPoint() const override; - Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnS() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const override; - Standard_EXPORT const gp_Vec& TangentOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec& TangentOnRst() const override; - Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const Standard_OVERRIDE; + Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const override; - //! Permet d ' implementer un critere de decrochage + //! Permet d'implementer un critere de decrochage //! specifique a la fonction. - Standard_EXPORT Standard_Boolean Decroch(const math_Vector& Sol, - gp_Vec& NS, - gp_Vec& TgS) const Standard_OVERRIDE; + Standard_EXPORT bool Decroch(const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const override; - Standard_EXPORT void Set(const Standard_Integer Choix); + Standard_EXPORT void Set(const int Choix); - //! Sets the type of section generation for the + //! Sets the type of section generation for the //! approximations. Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection); - Standard_EXPORT void Section(const Standard_Real Param, - const Standard_Real U, - const Standard_Real V, - const Standard_Real W, - Standard_Real& Pdeb, - Standard_Real& Pfin, - gp_Circ& C); + Standard_EXPORT void Section(const double Param, + const double U, + const double V, + const double W, + double& Pdeb, + double& Pfin, + gp_Circ& C); - //! Returns if the section is rational - Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; + //! Returns if the section is rational + Standard_EXPORT bool IsRational() const override; //! Returns the length of the maximum section - Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; + Standard_EXPORT double GetSectionSize() const override; //! Compute the minimal value of weight for each poles //! of all sections. - Standard_EXPORT void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; + Standard_EXPORT void GetMinimalWeight(NCollection_Array1& Weigths) const override; - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override; - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, - const GeomAbs_Shape S) const Standard_OVERRIDE; + Standard_EXPORT void Intervals(NCollection_Array1& T, + const GeomAbs_Shape S) const override; - Standard_EXPORT void GetShape(Standard_Integer& NbPoles, - Standard_Integer& NbKnots, - Standard_Integer& Degree, - Standard_Integer& NbPoles2d) Standard_OVERRIDE; + Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override; //! Returns the tolerance to reach in approximation //! to respect //! BoundTol error at the Boundary //! AngleTol tangent error at the Boundary //! SurfTol error inside the surface. - Standard_EXPORT void GetTolerance(const Standard_Real BoundTol, - const Standard_Real SurfTol, - const Standard_Real AngleTol, - math_Vector& Tol3d, - math_Vector& Tol1D) const Standard_OVERRIDE; + Standard_EXPORT void GetTolerance(const double BoundTol, + const double SurfTol, + const double AngleTol, + math_Vector& Tol3d, + math_Vector& Tol1D) const override; - Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; + Standard_EXPORT void Knots(NCollection_Array1& TKnots) override; - Standard_EXPORT void Mults(TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; + Standard_EXPORT void Mults(NCollection_Array1& TMults) override; //! Used for the first and last section - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths) override; //! Used for the first and last section - //! The method returns Standard_True if the derivatives - //! are computed, otherwise it returns Standard_False. - Standard_EXPORT Standard_Boolean Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfVec& DPoles, - TColgp_Array1OfVec& D2Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColgp_Array1OfVec2d& DPoles2d, - TColgp_Array1OfVec2d& D2Poles2d, - TColStd_Array1OfReal& Weigths, - TColStd_Array1OfReal& DWeigths, - TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Section(const Blend_Point& P, - TColgp_Array1OfPnt& Poles, - TColgp_Array1OfPnt2d& Poles2d, - TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; - - Standard_EXPORT void Resolution(const Standard_Integer IC2d, - const Standard_Real Tol, - Standard_Real& TolU, - Standard_Real& TolV) const Standard_OVERRIDE; - -protected: + //! The method returns true if the derivatives + //! are computed, otherwise it returns false. + Standard_EXPORT bool Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& DPoles, + NCollection_Array1& D2Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& DPoles2d, + NCollection_Array1& D2Poles2d, + NCollection_Array1& Weigths, + NCollection_Array1& DWeigths, + NCollection_Array1& D2Weigths) override; + + Standard_EXPORT void Section(const Blend_Point& P, + NCollection_Array1& Poles, + NCollection_Array1& Poles2d, + NCollection_Array1& Weigths) override; + + Standard_EXPORT void Resolution(const int IC2d, + const double Tol, + double& TolU, + double& TolV) const override; + private: - Handle(Adaptor3d_Surface) surf; - Handle(Adaptor3d_Surface) surfrst; - Handle(Adaptor2d_Curve2d) rst; - Adaptor3d_CurveOnSurface cons; - Handle(Adaptor3d_Curve) guide; - Handle(Adaptor3d_Curve) tguide; - gp_Pnt pts; - gp_Pnt ptrst; - gp_Pnt2d pt2ds; - gp_Pnt2d pt2drst; - Standard_Real prmrst; - Standard_Boolean istangent; - gp_Vec tgs; - gp_Vec2d tg2ds; - gp_Vec tgrst; - gp_Vec2d tg2drst; - Standard_Real ray; - Standard_Real dray; - Standard_Integer choix; - gp_Pnt ptgui; - gp_Vec d1gui; - gp_Vec d2gui; - gp_Vec nplan; - Standard_Real normtg; - Standard_Real theD; - Handle(Adaptor3d_Surface) surfref; - Handle(Adaptor2d_Curve2d) rstref; - Standard_Real maxang; - Standard_Real minang; - Standard_Real distmin; - BlendFunc_SectionShape mySShape; - Convert_ParameterisationType myTConv; - Handle(Law_Function) tevol; - Handle(Law_Function) fevol; - Standard_Real sg1; + occ::handle surf; + occ::handle surfrst; + occ::handle rst; + Adaptor3d_CurveOnSurface cons; + occ::handle guide; + occ::handle tguide; + gp_Pnt pts; + gp_Pnt ptrst; + gp_Pnt2d pt2ds; + gp_Pnt2d pt2drst; + double prmrst; + bool istangent; + gp_Vec tgs; + gp_Vec2d tg2ds; + gp_Vec tgrst; + gp_Vec2d tg2drst; + double ray; + double dray; + int choix; + gp_Pnt ptgui; + gp_Vec d1gui; + gp_Vec d2gui; + gp_Vec nplan; + double normtg; + double theD; + occ::handle surfref; + occ::handle rstref; + double maxang; + double minang; + double distmin; + BlendFunc_SectionShape mySShape; + Convert_ParameterisationType myTConv; + occ::handle tevol; + occ::handle fevol; + double sg1; }; #endif // _BRepBlend_SurfRstEvolRad_HeaderFile diff --git a/opencascade/BRepBlend_SurfRstLineBuilder.hxx b/opencascade/BRepBlend_SurfRstLineBuilder.hxx index f5d526e1b..7322aeb48 100644 --- a/opencascade/BRepBlend_SurfRstLineBuilder.hxx +++ b/opencascade/BRepBlend_SurfRstLineBuilder.hxx @@ -34,24 +34,24 @@ class Adaptor3d_HVertex; class IntSurf_Transition; class BRepBlend_Extremity; -//! This class processes data resulting from -//! Blend_CSWalking taking in consideration the Surface -//! supporting the curve to detect the breakpoint. +//! This class processes data resulting from +//! Blend_CSWalking taking in consideration the Surface +//! supporting the curve to detect the breakpoint. //! -//! The criteria of distribution of points on the line are detailed -//! because it is to be used in the calculatuon of values approached -//! by an approximation of functions continued basing on +//! The criteria of distribution of points on the line are detailed +//! because it is to be used in the calculatuon of values approached +//! by an approximation of functions continued basing on //! Blend_SurfRstFunction. //! -//! Thus this pseudo path necessitates 3 criteria of regrouping : +//! Thus this pseudo path necessitates 3 criteria of regrouping: //! -//! 1) exit of the domain of the curve +//! 1) exit of the domain of the curve //! -//! 2) exit of the domain of the surface +//! 2) exit of the domain of the surface //! -//! 3) stall as there is a solution to the problem -//! surf/surf within the domain of the surface -//! of support of the restriction. +//! 3) stall as there is a solution to the problem +//! surf/surf within the domain of the surface +//! of support of the restriction. //! //! Construction of a BRepBlend_Line between a surface and //! a pcurve on surface from an approached @@ -67,134 +67,133 @@ class BRepBlend_SurfRstLineBuilder public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_SurfRstLineBuilder(const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor3d_TopolTool)& Domain1, - const Handle(Adaptor3d_Surface)& Surf2, - const Handle(Adaptor2d_Curve2d)& Rst, - const Handle(Adaptor3d_TopolTool)& Domain2); + Standard_EXPORT BRepBlend_SurfRstLineBuilder(const occ::handle& Surf1, + const occ::handle& Domain1, + const occ::handle& Surf2, + const occ::handle& Rst, + const occ::handle& Domain2); Standard_EXPORT void Perform(Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, - const Standard_Real Pdep, - const Standard_Real Pmax, - const Standard_Real MaxStep, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Real TolGuide, + const double Pdep, + const double Pmax, + const double MaxStep, + const double Tol3d, + const double Tol2d, + const double TolGuide, const math_Vector& Soldep, - const Standard_Real Fleche, - const Standard_Boolean Appro = Standard_False); - - Standard_EXPORT Standard_Boolean PerformFirstSection(Blend_SurfRstFunction& Func, - Blend_FuncInv& Finv, - Blend_SurfPointFuncInv& FinvP, - Blend_SurfCurvFuncInv& FinvC, - const Standard_Real Pdep, - const Standard_Real Pmax, - const math_Vector& Soldep, - const Standard_Real Tol3d, - const Standard_Real Tol2d, - const Standard_Real TolGuide, - const Standard_Boolean RecRst, - const Standard_Boolean RecP, - const Standard_Boolean RecS, - Standard_Real& Psol, - math_Vector& ParSol); - - Standard_EXPORT Standard_Boolean Complete(Blend_SurfRstFunction& Func, - Blend_FuncInv& Finv, - Blend_SurfPointFuncInv& FinvP, - Blend_SurfCurvFuncInv& FinvC, - const Standard_Real Pmin); - - Standard_EXPORT Standard_Integer ArcToRecadre(const math_Vector& Sol, - const Standard_Integer PrevIndex, - gp_Pnt2d& pt2d, - gp_Pnt2d& lastpt2d, - Standard_Real& ponarc); - - Standard_Boolean IsDone() const; - - const Handle(BRepBlend_Line)& Line() const; - - Standard_Boolean DecrochStart() const; - - Standard_Boolean DecrochEnd() const; - -protected: + const double Fleche, + const bool Appro = false); + + Standard_EXPORT bool PerformFirstSection(Blend_SurfRstFunction& Func, + Blend_FuncInv& Finv, + Blend_SurfPointFuncInv& FinvP, + Blend_SurfCurvFuncInv& FinvC, + const double Pdep, + const double Pmax, + const math_Vector& Soldep, + const double Tol3d, + const double Tol2d, + const double TolGuide, + const bool RecRst, + const bool RecP, + const bool RecS, + double& Psol, + math_Vector& ParSol); + + Standard_EXPORT bool Complete(Blend_SurfRstFunction& Func, + Blend_FuncInv& Finv, + Blend_SurfPointFuncInv& FinvP, + Blend_SurfCurvFuncInv& FinvC, + const double Pmin); + + Standard_EXPORT int ArcToRecadre(const math_Vector& Sol, + const int PrevIndex, + gp_Pnt2d& pt2d, + gp_Pnt2d& lastpt2d, + double& ponarc); + + bool IsDone() const; + + const occ::handle& Line() const; + + bool DecrochStart() const; + + bool DecrochEnd() const; + private: Standard_EXPORT void InternalPerform(Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, - const Standard_Real Bound); - - Standard_EXPORT Standard_Boolean Recadre(Blend_SurfCurvFuncInv& FinvC, - math_Vector& Solinv, - Handle(Adaptor2d_Curve2d)& Arc, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Standard_Boolean Recadre(Blend_SurfRstFunction& Func, - Blend_FuncInv& Finv, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Standard_Boolean Recadre(Blend_SurfPointFuncInv& FinvP, - math_Vector& Solinv, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT void Transition(const Standard_Boolean OnFirst, - const Handle(Adaptor2d_Curve2d)& Arc, - const Standard_Real Param, - IntSurf_Transition& TLine, - IntSurf_Transition& TArc); - - Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, - const Standard_Boolean OnFirst, - const Handle(Adaptor2d_Curve2d)& Arc, - const Standard_Real Param, - const Standard_Boolean IsVtx, - const Handle(Adaptor3d_HVertex)& Vtx); + const double Bound); + + Standard_EXPORT bool Recadre(Blend_SurfCurvFuncInv& FinvC, + math_Vector& Solinv, + occ::handle& Arc, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT bool Recadre(Blend_SurfRstFunction& Func, + Blend_FuncInv& Finv, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT bool Recadre(Blend_SurfPointFuncInv& FinvP, + math_Vector& Solinv, + bool& IsVtx, + occ::handle& Vtx); + + Standard_EXPORT void Transition(const bool OnFirst, + const occ::handle& Arc, + const double Param, + IntSurf_Transition& TLine, + IntSurf_Transition& TArc); + + Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, + const bool OnFirst, + const occ::handle& Arc, + const double Param, + const bool IsVtx, + const occ::handle& Vtx); Standard_EXPORT Blend_Status CheckDeflectionOnSurf(const Blend_Point& CurPoint); Standard_EXPORT Blend_Status CheckDeflectionOnRst(const Blend_Point& CurPoint); Standard_EXPORT Blend_Status TestArret(Blend_SurfRstFunction& Func, - const Standard_Boolean TestDeflection, + const bool TestDeflection, const Blend_Status State); - Standard_EXPORT Standard_Boolean CheckInside(Blend_SurfRstFunction& Func, - TopAbs_State& SituOnC, - TopAbs_State& SituOnS, - Standard_Boolean& Decroch); - - Standard_Boolean done; - Handle(BRepBlend_Line) line; - math_Vector sol; - Handle(Adaptor3d_Surface) surf1; - Handle(Adaptor3d_TopolTool) domain1; - Handle(Adaptor3d_Surface) surf2; - Handle(Adaptor2d_Curve2d) rst; - Handle(Adaptor3d_TopolTool) domain2; - Standard_Real tolpoint3d; - Standard_Real tolpoint2d; - Standard_Real tolgui; - Standard_Real pasmax; - Standard_Real fleche; - Standard_Real param; - Blend_Point previousP; - Standard_Boolean rebrou; - Standard_Boolean iscomplete; - Standard_Boolean comptra; - Standard_Real sens; - Standard_Boolean decrochdeb; - Standard_Boolean decrochfin; + Standard_EXPORT bool CheckInside(Blend_SurfRstFunction& Func, + TopAbs_State& SituOnC, + TopAbs_State& SituOnS, + bool& Decroch); + + bool done; + occ::handle line; + math_Vector sol; + occ::handle surf1; + occ::handle domain1; + occ::handle surf2; + occ::handle rst; + occ::handle domain2; + double tolpoint3d; + double tolpoint2d; + double tolgui; + double pasmax; + double fleche; + double param; + Blend_Point previousP; + bool rebrou; + bool iscomplete; + bool comptra; + double sens; + bool decrochdeb; + bool decrochfin; }; #include diff --git a/opencascade/BRepBlend_SurfRstLineBuilder.lxx b/opencascade/BRepBlend_SurfRstLineBuilder.lxx index 64fc8109b..05924ce6d 100644 --- a/opencascade/BRepBlend_SurfRstLineBuilder.lxx +++ b/opencascade/BRepBlend_SurfRstLineBuilder.lxx @@ -16,22 +16,16 @@ #include -//======================================================================= -// function : IsDone -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_SurfRstLineBuilder::IsDone() const +inline bool BRepBlend_SurfRstLineBuilder::IsDone() const { return done; } -//======================================================================= -// function : Line -// purpose : -//======================================================================= +//================================================================================================= -inline const Handle(BRepBlend_Line)& BRepBlend_SurfRstLineBuilder::Line() const +inline const occ::handle& BRepBlend_SurfRstLineBuilder::Line() const { if (!done) { @@ -40,22 +34,16 @@ inline const Handle(BRepBlend_Line)& BRepBlend_SurfRstLineBuilder::Line() const return line; } -//======================================================================= -// function : DecrochStart -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_SurfRstLineBuilder::DecrochStart() const +inline bool BRepBlend_SurfRstLineBuilder::DecrochStart() const { return decrochdeb; } -//======================================================================= -// function : DecrochEnd -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBlend_SurfRstLineBuilder::DecrochEnd() const +inline bool BRepBlend_SurfRstLineBuilder::DecrochEnd() const { return decrochfin; } diff --git a/opencascade/BRepBlend_Walking.hxx b/opencascade/BRepBlend_Walking.hxx index 71e85d27a..047f411d1 100644 --- a/opencascade/BRepBlend_Walking.hxx +++ b/opencascade/BRepBlend_Walking.hxx @@ -16,9 +16,9 @@ #define _BRepBlend_Walking_HeaderFile #include -#include +#include +#include #include -#include #include #include #include @@ -47,78 +47,74 @@ class BRepBlend_Walking public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepBlend_Walking(const Handle(Adaptor3d_Surface)& Surf1, - const Handle(Adaptor3d_Surface)& Surf2, - const Handle(Adaptor3d_TopolTool)& Domain1, - const Handle(Adaptor3d_TopolTool)& Domain2, - const Handle(ChFiDS_ElSpine)& HGuide); + Standard_EXPORT BRepBlend_Walking(const occ::handle& Surf1, + const occ::handle& Surf2, + const occ::handle& Domain1, + const occ::handle& Domain2, + const occ::handle& HGuide); //! To define different domains for control and clipping. - Standard_EXPORT void SetDomainsToRecadre(const Handle(Adaptor3d_TopolTool)& RecDomain1, - const Handle(Adaptor3d_TopolTool)& RecDomain2); + Standard_EXPORT void SetDomainsToRecadre(const occ::handle& RecDomain1, + const occ::handle& RecDomain2); //! To define singular points computed before walking. Standard_EXPORT void AddSingularPoint(const Blend_Point& P); - Standard_EXPORT void Perform(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real Pdep, - const Standard_Real Pmax, - const Standard_Real MaxStep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, - const math_Vector& Soldep, - const Standard_Real Fleche, - const Standard_Boolean Appro = Standard_False); - - Standard_EXPORT Standard_Boolean PerformFirstSection(Blend_Function& F, - const Standard_Real Pdep, - math_Vector& ParDep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, - TopAbs_State& Pos1, - TopAbs_State& Pos2); - - Standard_EXPORT Standard_Boolean PerformFirstSection(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real Pdep, - const Standard_Real Pmax, - const math_Vector& ParDep, - const Standard_Real Tol3d, - const Standard_Real TolGuide, - const Standard_Boolean RecOnS1, - const Standard_Boolean RecOnS2, - Standard_Real& Psol, - math_Vector& ParSol); - - Standard_EXPORT Standard_Boolean Continu(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real P); - - Standard_EXPORT Standard_Boolean Continu(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real P, - const Standard_Boolean OnS1); - - Standard_EXPORT Standard_Boolean Complete(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real Pmin); - - Standard_EXPORT void ClassificationOnS1(const Standard_Boolean C); - - Standard_EXPORT void ClassificationOnS2(const Standard_Boolean C); - - Standard_EXPORT void Check2d(const Standard_Boolean C); - - Standard_EXPORT void Check(const Standard_Boolean C); - - inline Standard_Boolean TwistOnS1() const { return twistflag1; } - - inline Standard_Boolean TwistOnS2() const { return twistflag2; } - - inline Standard_Boolean IsDone() const { return done; } - - inline const Handle(BRepBlend_Line)& Line() const + Standard_EXPORT void Perform(Blend_Function& F, + Blend_FuncInv& FInv, + const double Pdep, + const double Pmax, + const double MaxStep, + const double Tol3d, + const double TolGuide, + const math_Vector& Soldep, + const double Fleche, + const bool Appro = false); + + Standard_EXPORT bool PerformFirstSection(Blend_Function& F, + const double Pdep, + math_Vector& ParDep, + const double Tol3d, + const double TolGuide, + TopAbs_State& Pos1, + TopAbs_State& Pos2); + + Standard_EXPORT bool PerformFirstSection(Blend_Function& F, + Blend_FuncInv& FInv, + const double Pdep, + const double Pmax, + const math_Vector& ParDep, + const double Tol3d, + const double TolGuide, + const bool RecOnS1, + const bool RecOnS2, + double& Psol, + math_Vector& ParSol); + + Standard_EXPORT bool Continu(Blend_Function& F, Blend_FuncInv& FInv, const double P); + + Standard_EXPORT bool Continu(Blend_Function& F, + Blend_FuncInv& FInv, + const double P, + const bool OnS1); + + Standard_EXPORT bool Complete(Blend_Function& F, Blend_FuncInv& FInv, const double Pmin); + + Standard_EXPORT void ClassificationOnS1(const bool C); + + Standard_EXPORT void ClassificationOnS2(const bool C); + + Standard_EXPORT void Check2d(const bool C); + + Standard_EXPORT void Check(const bool C); + + inline bool TwistOnS1() const { return twistflag1; } + + inline bool TwistOnS2() const { return twistflag2; } + + inline bool IsDone() const { return done; } + + inline const occ::handle& Line() const { if (!done) { @@ -128,92 +124,89 @@ public: } private: - Standard_EXPORT void InternalPerform(Blend_Function& F, - Blend_FuncInv& FInv, - const Standard_Real Bound); - - Standard_EXPORT Standard_Boolean CorrectExtremityOnOneRst(const Standard_Integer IndexOfRst, - const Standard_Real theU, - const Standard_Real theV, - const Standard_Real theParam, - const gp_Pnt& thePntOnRst, - Standard_Real& NewU, - Standard_Real& NewV, - gp_Pnt& NewPoint, - Standard_Real& NewParam) const; - - Standard_EXPORT Standard_Integer ArcToRecadre(const Standard_Boolean OnFirst, - const math_Vector& Sol, - const Standard_Integer PrevIndex, - gp_Pnt2d& lpt2d, - gp_Pnt2d& pt2d, - Standard_Real& ponarc); - - Standard_EXPORT Standard_Boolean Recadre(Blend_FuncInv& FInv, - const Standard_Boolean OnFirst, - const math_Vector& Sol, - math_Vector& Solrst, - Standard_Integer& Indexsol, - Standard_Boolean& IsVtx, - Handle(Adaptor3d_HVertex)& Vtx, - const Standard_Real Extrap = 0.0); - - Standard_EXPORT void Transition(const Standard_Boolean OnFirst, - const Handle(Adaptor2d_Curve2d)& A, - const Standard_Real Param, - IntSurf_Transition& TLine, - IntSurf_Transition& TArc); - - Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, - const Standard_Boolean OnFirst, - const Standard_Integer Index, - const Standard_Real Param, - const Standard_Boolean IsVtx, - const Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT void MakeSingularExtremity(BRepBlend_Extremity& Extrem, - const Standard_Boolean OnFirst, - const Handle(Adaptor3d_HVertex)& Vtx); - - Standard_EXPORT Blend_Status CheckDeflection(const Standard_Boolean OnFirst, - const Blend_Point& CurPoint); - - Standard_EXPORT Blend_Status TestArret(Blend_Function& F, - const Blend_Status State, - const Standard_Boolean TestDeflection = Standard_True, - const Standard_Boolean TestSolution = Standard_True, - const Standard_Boolean TestLengthStep = Standard_False); - - Blend_Point previousP; - Handle(BRepBlend_Line) line; - math_Vector sol; - Blend_SequenceOfPoint jalons; - Handle(Adaptor3d_Surface) surf1; - Handle(Adaptor3d_Surface) surf2; - Handle(Adaptor3d_TopolTool) domain1; - Handle(Adaptor3d_TopolTool) domain2; - Handle(Adaptor3d_TopolTool) recdomain1; - Handle(Adaptor3d_TopolTool) recdomain2; - Handle(ChFiDS_ElSpine) hguide; - Standard_Boolean ToCorrectOnRst1; - Standard_Boolean ToCorrectOnRst2; - Standard_Real CorrectedParam; - Standard_Real tolpoint3d; - Standard_Real tolgui; - Standard_Real pasmax; - Standard_Real fleche; - Standard_Real param; - Standard_Real sens; - Standard_Boolean done; - Standard_Boolean rebrou; - Standard_Boolean iscomplete; - Standard_Boolean comptra; - Standard_Boolean clasonS1; - Standard_Boolean clasonS2; - Standard_Boolean check2d; - Standard_Boolean check; - Standard_Boolean twistflag1; - Standard_Boolean twistflag2; + Standard_EXPORT void InternalPerform(Blend_Function& F, Blend_FuncInv& FInv, const double Bound); + + Standard_EXPORT bool CorrectExtremityOnOneRst(const int IndexOfRst, + const double theU, + const double theV, + const double theParam, + const gp_Pnt& thePntOnRst, + double& NewU, + double& NewV, + gp_Pnt& NewPoint, + double& NewParam) const; + + Standard_EXPORT int ArcToRecadre(const bool OnFirst, + const math_Vector& Sol, + const int PrevIndex, + gp_Pnt2d& lpt2d, + gp_Pnt2d& pt2d, + double& ponarc); + + Standard_EXPORT bool Recadre(Blend_FuncInv& FInv, + const bool OnFirst, + const math_Vector& Sol, + math_Vector& Solrst, + int& Indexsol, + bool& IsVtx, + occ::handle& Vtx, + const double Extrap = 0.0); + + Standard_EXPORT void Transition(const bool OnFirst, + const occ::handle& A, + const double Param, + IntSurf_Transition& TLine, + IntSurf_Transition& TArc); + + Standard_EXPORT void MakeExtremity(BRepBlend_Extremity& Extrem, + const bool OnFirst, + const int Index, + const double Param, + const bool IsVtx, + const occ::handle& Vtx); + + Standard_EXPORT void MakeSingularExtremity(BRepBlend_Extremity& Extrem, + const bool OnFirst, + const occ::handle& Vtx); + + Standard_EXPORT Blend_Status CheckDeflection(const bool OnFirst, const Blend_Point& CurPoint); + + Standard_EXPORT Blend_Status TestArret(Blend_Function& F, + const Blend_Status State, + const bool TestDeflection = true, + const bool TestSolution = true, + const bool TestLengthStep = false); + + Blend_Point previousP; + occ::handle line; + math_Vector sol; + NCollection_Sequence jalons; + occ::handle surf1; + occ::handle surf2; + occ::handle domain1; + occ::handle domain2; + occ::handle recdomain1; + occ::handle recdomain2; + occ::handle hguide; + bool ToCorrectOnRst1; + bool ToCorrectOnRst2; + double CorrectedParam; + double tolpoint3d; + double tolgui; + double pasmax; + double fleche; + double param; + double sens; + bool done; + bool rebrou; + bool iscomplete; + bool comptra; + bool clasonS1; + bool clasonS2; + bool check2d; + bool check; + bool twistflag1; + bool twistflag2; }; #endif // _BRepBlend_Walking_HeaderFile diff --git a/opencascade/BRepBndLib.hxx b/opencascade/BRepBndLib.hxx index 086ed5016..90b48520f 100644 --- a/opencascade/BRepBndLib.hxx +++ b/opencascade/BRepBndLib.hxx @@ -49,9 +49,9 @@ public: //! - This algorithm is time consuming if triangulation has not //! been inserted inside the data structure of the shape S. //! - The resulting bounding box may be somewhat larger than the object. - Standard_EXPORT static void Add(const TopoDS_Shape& S, - Bnd_Box& B, - const Standard_Boolean useTriangulation = Standard_True); + Standard_EXPORT static void Add(const TopoDS_Shape& S, + Bnd_Box& B, + const bool useTriangulation = true); //! Adds the shape S to the bounding box B. //! This is a quick algorithm but only works if the shape S is @@ -75,10 +75,10 @@ public: //! these tolerances are used for numerical methods of bounding box size calculations, //! otherwise bounding box is built according to sizes of uderlined geometrical entities, //! numerical calculation use tolerance Precision::Confusion(). - Standard_EXPORT static void AddOptimal(const TopoDS_Shape& S, - Bnd_Box& B, - const Standard_Boolean useTriangulation = Standard_True, - const Standard_Boolean useShapeTolerance = Standard_False); + Standard_EXPORT static void AddOptimal(const TopoDS_Shape& S, + Bnd_Box& B, + const bool useTriangulation = true, + const bool useShapeTolerance = false); //! Computes the Oriented Bounding box for the shape . //! Two independent methods of computation are implemented: @@ -92,15 +92,11 @@ public: //! extended on the tolerance of the shape. //! theIsOptimal flag defines whether to look for the more tight //! OBB for the cost of performance or not. - Standard_EXPORT static void AddOBB( - const TopoDS_Shape& theS, - Bnd_OBB& theOBB, - const Standard_Boolean theIsTriangulationUsed = Standard_True, - const Standard_Boolean theIsOptimal = Standard_False, - const Standard_Boolean theIsShapeToleranceUsed = Standard_True); - -protected: -private: + Standard_EXPORT static void AddOBB(const TopoDS_Shape& theS, + Bnd_OBB& theOBB, + const bool theIsTriangulationUsed = true, + const bool theIsOptimal = false, + const bool theIsShapeToleranceUsed = true); }; #endif // _BRepBndLib_HeaderFile diff --git a/opencascade/BRepBuilderAPI.hxx b/opencascade/BRepBuilderAPI.hxx index b018455ec..49ffb9160 100644 --- a/opencascade/BRepBuilderAPI.hxx +++ b/opencascade/BRepBuilderAPI.hxx @@ -24,22 +24,22 @@ #include class Geom_Plane; -//! The BRepBuilderAPI package provides an Application -//! Programming Interface for the BRep topology data +//! The BRepBuilderAPI package provides an Application +//! Programming Interface for the BRep topology data //! structure. //! -//! The API is a set of classes aiming to provide : +//! The API is a set of classes aiming to provide: //! -//! * High level and simple calls for the most common +//! * High level and simple calls for the most common //! operations. //! -//! * Keeping an access on the low-level +//! * Keeping an access on the low-level //! implementation of high-level calls. //! -//! * Examples of programming of high-level operations +//! * Examples of programming of high-level operations //! from low-level operations. //! -//! * A complete coverage of modelling : +//! * A complete coverage of modelling: //! //! - Creating vertices ,edges, faces, solids. //! @@ -49,20 +49,20 @@ class Geom_Plane; //! //! - Global properties computation. //! -//! The API provides classes to build objects: +//! The API provides classes to build objects: //! -//! * The constructors of the classes provides the +//! * The constructors of the classes provides the //! different constructions methods. //! -//! * The class keeps as fields the different tools +//! * The class keeps as fields the different tools //! used to build the object. //! -//! * The class provides a casting method to get -//! automatically the result with a function-like +//! * The class provides a casting method to get +//! automatically the result with a function-like //! call. //! -//! For example to make a vertex from a point

-//! one can writes : +//! For example to make a vertex from a point

+//! one can write: //! //! V = BRepBuilderAPI_MakeVertex(P); //! @@ -71,8 +71,8 @@ class Geom_Plane; //! BRepBuilderAPI_MakeVertex MV(P); //! V = MV.Vertex(); //! -//! For tolerances a default precision is used which -//! can be changed by the packahe method +//! For tolerances a default precision is used which +//! can be changed by the packahe method //! BRepBuilderAPI::Precision. //! //! For error handling the BRepBuilderAPI commands raise only @@ -87,18 +87,18 @@ class BRepBuilderAPI public: DEFINE_STANDARD_ALLOC - //! Sets the current plane. - Standard_EXPORT static void Plane(const Handle(Geom_Plane)& P); + //! Sets the current plane. + Standard_EXPORT static void Plane(const occ::handle& P); //! Returns the current plane. - Standard_EXPORT static const Handle(Geom_Plane)& Plane(); + Standard_EXPORT static const occ::handle& Plane(); - //! Sets the default precision. The current Precision + //! Sets the default precision. The current Precision //! is returned. - Standard_EXPORT static void Precision(const Standard_Real P); + Standard_EXPORT static void Precision(const double P); //! Returns the default precision. - Standard_EXPORT static Standard_Real Precision(); + Standard_EXPORT static double Precision(); }; #endif // _BRepBuilderAPI_HeaderFile diff --git a/opencascade/BRepBuilderAPI_BndBoxTreeSelector.hxx b/opencascade/BRepBuilderAPI_BndBoxTreeSelector.hxx index a2bf5718d..a38082518 100644 --- a/opencascade/BRepBuilderAPI_BndBoxTreeSelector.hxx +++ b/opencascade/BRepBuilderAPI_BndBoxTreeSelector.hxx @@ -16,12 +16,11 @@ #ifndef BRepBuilderAPI_BndBoxTreeSelector_HeaderFile #define BRepBuilderAPI_BndBoxTreeSelector_HeaderFile -#include +#include +#include #include #include -typedef NCollection_UBTree BRepBuilderAPI_BndBoxTree; - //======================================================================= //! Class BRepBuilderAPI_BndBoxTreeSelector //! derived from UBTree::Selector @@ -30,29 +29,28 @@ typedef NCollection_UBTree BRepBuilderAPI_BndBoxTree; //! condition and to retrieve selected objects after search. //======================================================================= -class BRepBuilderAPI_BndBoxTreeSelector : public BRepBuilderAPI_BndBoxTree::Selector +class BRepBuilderAPI_BndBoxTreeSelector : public NCollection_UBTree::Selector { public: //! Constructor; calls the base class constructor BRepBuilderAPI_BndBoxTreeSelector() - : BRepBuilderAPI_BndBoxTree::Selector() - { - } + + = default; //! Implementation of rejection method //! @return //! True if the bounding box does not intersect with the current - Standard_Boolean Reject(const Bnd_Box& theBox) const { return (myBox.IsOut(theBox)); } + bool Reject(const Bnd_Box& theBox) const override { return (myBox.IsOut(theBox)); } //! Implementation of acceptance method //! This method is called when the bounding box intersect with the current. //! It stores the object - the index of box in the list of accepted objects. //! @return //! True, because the object is accepted - Standard_Boolean Accept(const Standard_Integer& theObj) + bool Accept(const int& theObj) override { myResInd.Append(theObj); - return Standard_True; + return true; } //! Clear the list of intersecting boxes @@ -62,10 +60,10 @@ public: void SetCurrent(const Bnd_Box& theBox) { myBox = theBox; } //! Get list of indexes of boxes intersecting with the current box - const TColStd_ListOfInteger& ResInd() { return myResInd; } + const NCollection_List& ResInd() { return myResInd; } private: - TColStd_ListOfInteger myResInd; + NCollection_List myResInd; Bnd_Box myBox; }; diff --git a/opencascade/BRepBuilderAPI_CellFilter.hxx b/opencascade/BRepBuilderAPI_CellFilter.hxx index a03eb18e9..d0c30a7e9 100644 --- a/opencascade/BRepBuilderAPI_CellFilter.hxx +++ b/opencascade/BRepBuilderAPI_CellFilter.hxx @@ -1,6 +1,4 @@ -// Created on: 2011-11-24 -// Created by: ANNA MASALSKAYA -// Copyright (c) 2011-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,11 +11,22 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _BRepBuilderAPI_CellFilter_HeaderFile -#define _BRepBuilderAPI_CellFilter_HeaderFile +//! @file BRepBuilderAPI_CellFilter.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_CellFilter directly instead. +#ifndef _BRepBuilderAPI_CellFilter_hxx +#define _BRepBuilderAPI_CellFilter_hxx + +#include #include +Standard_HEADER_DEPRECATED("BRepBuilderAPI_CellFilter.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_CellFilter directly.") + + Standard_DEPRECATED("BRepBuilderAPI_CellFilter is deprecated, use " + "NCollection_CellFilter directly") typedef NCollection_CellFilter BRepBuilderAPI_CellFilter; -#endif +#endif // _BRepBuilderAPI_CellFilter_hxx diff --git a/opencascade/BRepBuilderAPI_Collect.hxx b/opencascade/BRepBuilderAPI_Collect.hxx index bbbd96c31..11367c510 100644 --- a/opencascade/BRepBuilderAPI_Collect.hxx +++ b/opencascade/BRepBuilderAPI_Collect.hxx @@ -22,8 +22,10 @@ #include #include -#include -#include +#include +#include +#include +#include class BRepBuilderAPI_MakeShape; class BRepBuilderAPI_Collect @@ -41,16 +43,21 @@ public: Standard_EXPORT void Filter(const TopoDS_Shape& SF); - Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Modification() const; + Standard_EXPORT const NCollection_DataMap, + TopTools_ShapeMapHasher>& + Modification() const; - Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Generated() const; + Standard_EXPORT const NCollection_DataMap, + TopTools_ShapeMapHasher>& + Generated() const; -protected: private: - TopoDS_Shape myInitialShape; - TopTools_MapOfShape myDeleted; - TopTools_DataMapOfShapeListOfShape myMod; - TopTools_DataMapOfShapeListOfShape myGen; + TopoDS_Shape myInitialShape; + NCollection_Map myDeleted; + NCollection_DataMap, TopTools_ShapeMapHasher> myMod; + NCollection_DataMap, TopTools_ShapeMapHasher> myGen; }; #endif // _BRepBuilderAPI_Collect_HeaderFile diff --git a/opencascade/BRepBuilderAPI_Command.hxx b/opencascade/BRepBuilderAPI_Command.hxx index 7094c06d9..a69241679 100644 --- a/opencascade/BRepBuilderAPI_Command.hxx +++ b/opencascade/BRepBuilderAPI_Command.hxx @@ -39,7 +39,7 @@ public: Standard_EXPORT virtual ~BRepBuilderAPI_Command(); - Standard_EXPORT virtual Standard_Boolean IsDone() const; + Standard_EXPORT virtual bool IsDone() const; //! Raises NotDone if done is false. Standard_EXPORT void Check() const; @@ -55,7 +55,7 @@ protected: Standard_EXPORT void NotDone(); private: - Standard_Boolean myDone; + bool myDone; }; #endif // _BRepBuilderAPI_Command_HeaderFile diff --git a/opencascade/BRepBuilderAPI_Copy.hxx b/opencascade/BRepBuilderAPI_Copy.hxx index e9c0e0880..db1f97779 100644 --- a/opencascade/BRepBuilderAPI_Copy.hxx +++ b/opencascade/BRepBuilderAPI_Copy.hxx @@ -46,9 +46,9 @@ public: //! geometry and triangulation will be shared with original shape. //! Note: the constructed framework can be reused to copy //! other shapes: just specify them with the function Perform. - Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, - const Standard_Boolean copyGeom = Standard_True, - const Standard_Boolean copyMesh = Standard_False); + Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, + const bool copyGeom = true, + const bool copyMesh = false); //! Copies the shape S. //! Use the function Shape to access the result. @@ -56,9 +56,9 @@ public: //! copied along with geometry (by default, triangulation gets lost). //! If copyGeom is False, only topological objects will be copied, while //! geometry and triangulation will be shared with original shape. - Standard_EXPORT void Perform(const TopoDS_Shape& S, - const Standard_Boolean copyGeom = Standard_True, - const Standard_Boolean copyMesh = Standard_False); + Standard_EXPORT void Perform(const TopoDS_Shape& S, + const bool copyGeom = true, + const bool copyMesh = false); }; #endif // _BRepBuilderAPI_Copy_HeaderFile diff --git a/opencascade/BRepBuilderAPI_EdgeError.hxx b/opencascade/BRepBuilderAPI_EdgeError.hxx index 77dc41cac..517be8349 100644 --- a/opencascade/BRepBuilderAPI_EdgeError.hxx +++ b/opencascade/BRepBuilderAPI_EdgeError.hxx @@ -20,7 +20,7 @@ //! Indicates the outcome of the //! construction of an edge, i.e. whether it has been successful or //! not, as explained below: -//! - BRepBuilderAPI_EdgeDone No error occurred; The edge is +//! - BRepBuilderAPI_EdgeDone No error occurred; The edge is //! correctly built. //! - BRepBuilderAPI_PointProjectionFailed No parameters were given but //! the projection of the 3D points on the curve failed. This @@ -34,13 +34,13 @@ //! curve but have different locations. //! - BRepBuilderAPI_PointWithInfiniteParameter //! A finite coordinate point was associated with an infinite -//! parameter (see the Precision package for a definition of infinite values). +//! parameter (see the Precision package for a definition of infinite values). //! - BRepBuilderAPI_DifferentsPointAndParameter //! The distance between the 3D point and the point evaluated //! on the curve with the parameter is greater than the precision. //! - BRepBuilderAPI_LineThroughIdenticPoints //! Two identical points were given to define a line (construction -//! of an edge without curve); gp::Resolution is used for the confusion test. +//! of an edge without curve); gp::Resolution is used for the confusion test. enum BRepBuilderAPI_EdgeError { BRepBuilderAPI_EdgeDone, diff --git a/opencascade/BRepBuilderAPI_FaceError.hxx b/opencascade/BRepBuilderAPI_FaceError.hxx index 709699a20..571ceee62 100644 --- a/opencascade/BRepBuilderAPI_FaceError.hxx +++ b/opencascade/BRepBuilderAPI_FaceError.hxx @@ -29,7 +29,7 @@ //! - BRepBuilderAPI_CurveProjectionFailed //! Not used so far. //! - BRepBuilderAPI_ParametersOutOfRange -//! The parameters given to limit the surface are out of its bounds. +//! The parameters given to limit the surface are out of its bounds. enum BRepBuilderAPI_FaceError { BRepBuilderAPI_FaceDone, diff --git a/opencascade/BRepBuilderAPI_FastSewing.hxx b/opencascade/BRepBuilderAPI_FastSewing.hxx index 371c783a5..404f9ed51 100644 --- a/opencascade/BRepBuilderAPI_FastSewing.hxx +++ b/opencascade/BRepBuilderAPI_FastSewing.hxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -64,47 +64,47 @@ public: }; //! Creates an object with tolerance of connexity - Standard_EXPORT BRepBuilderAPI_FastSewing(const Standard_Real theTolerance = 1.0e-06); + Standard_EXPORT BRepBuilderAPI_FastSewing(const double theTolerance = 1.0e-06); //! Adds faces of a shape - Standard_EXPORT Standard_Boolean Add(const TopoDS_Shape& theShape); + Standard_EXPORT bool Add(const TopoDS_Shape& theShape); //! Adds a surface - Standard_EXPORT Standard_Boolean Add(const Handle(Geom_Surface)& theSurface); + Standard_EXPORT bool Add(const occ::handle& theSurface); //! Compute resulted shape - Standard_EXPORT void Perform(void); + Standard_EXPORT void Perform(); //! Sets tolerance - void SetTolerance(const Standard_Real theToler) { myTolerance = theToler; } + void SetTolerance(const double theToler) { myTolerance = theToler; } //! Returns tolerance - Standard_Real GetTolerance() const { return myTolerance; } + double GetTolerance() const { return myTolerance; } //! Returns resulted shape const TopoDS_Shape& GetResult() const { return myResShape; } //! Returns list of statuses. Print message if theOS != 0 - Standard_EXPORT FS_VARStatuses GetStatuses(Standard_OStream* const theOS = 0); + Standard_EXPORT FS_VARStatuses GetStatuses(Standard_OStream* const theOS = nullptr); DEFINE_STANDARD_RTTIEXT(BRepBuilderAPI_FastSewing, Standard_Transient) protected: class NodeInspector; - Standard_EXPORT void FindVertexes(const Standard_Integer theSurfID, + Standard_EXPORT void FindVertexes(const int theSurfID, NCollection_CellFilter& theCells); - Standard_EXPORT void FindEdges(const Standard_Integer theSurfID); - Standard_EXPORT void UpdateEdgeInfo(const Standard_Integer theIDPrevVertex, - const Standard_Integer theIDCurrVertex, - const Standard_Integer theFaceID, - const Standard_Integer theIDCurvOnFace); - Standard_EXPORT void CreateNewEdge(const Standard_Integer theIDPrevVertex, - const Standard_Integer theIDCurrVertex, - const Standard_Integer theFaceID, - const Standard_Integer theIDCurvOnFace); - - Standard_EXPORT Standard_Real Compute3DRange(); + Standard_EXPORT void FindEdges(const int theSurfID); + Standard_EXPORT void UpdateEdgeInfo(const int theIDPrevVertex, + const int theIDCurrVertex, + const int theFaceID, + const int theIDCurvOnFace); + Standard_EXPORT void CreateNewEdge(const int theIDPrevVertex, + const int theIDCurrVertex, + const int theFaceID, + const int theIDCurvOnFace); + + Standard_EXPORT double Compute3DRange(); //! Sets status. Returns numeric value of the status set FS_VARStatuses SetStatus(FS_Statuses theStatus) @@ -127,7 +127,7 @@ protected: : myID(-1) {}; //! Creates topological member (vertex) - void CreateTopologicalVertex(const Standard_Real theToler) + void CreateTopologicalVertex(const double theToler) { BRep_Builder aBuilder; aBuilder.MakeVertex(myTopoVert, myPnt, theToler); @@ -138,12 +138,12 @@ protected: TopoDS_Vertex myTopoVert; //! List of faces and edges which share this vertex - NCollection_List myFaces; - NCollection_List myEdges; + NCollection_List myFaces; + NCollection_List myEdges; //! Identifies the place of this Vertex in //! BRepBuilderAPI_FastSewing::myVertexVec list - Standard_Integer myID; + int myID; }; //! The struct corresponding to an face @@ -152,7 +152,7 @@ protected: FS_Face() : myID(-1) { - for (Standard_Integer i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { myVertices[i] = -1; myEdges[i] = -1; @@ -160,12 +160,12 @@ protected: }; //! Creates topological members (wire and face) - void CreateTopologicalWire(const NCollection_Vector& theEdgeVec, - const Standard_Real theToler); + void CreateTopologicalWire(const NCollection_DynamicArray& theEdgeVec, + const double theToler); void CreateTopologicalFace(); //! Sets vertex - void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID) + void SetVertex(const int thePlaceID, const int theVertID) { Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3), "FS_Face::SetVertex(): OUT of Range"); @@ -174,7 +174,7 @@ protected: } //! Sets edge - void SetEdge(const Standard_Integer thePlaceID, const Standard_Integer theEdgeID) + void SetEdge(const int thePlaceID, const int theEdgeID) { Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3), "FS_Face::SetEdge(): OUT of Range"); @@ -189,13 +189,13 @@ protected: //! myEdges[i] number of the edge in myEdgeVec //! (i==0) <-> (V=Vf); (i==1) <-> (U=Ul); //! (i==2) <-> (V=Vl); (i==3) <-> (U=Uf) - Standard_Integer myEdges[4]; + int myEdges[4]; //! myVertices[i] is Start point of myEdges[i] - Standard_Integer myVertices[4]; + int myVertices[4]; //! Identifies the place of this Face in //! BRepBuilderAPI_FastSewing::myFaceVec list - Standard_Integer myID; + int myID; }; //! The struct corresponding to a edge @@ -209,7 +209,7 @@ protected: myVertices[1] = -1; } - FS_Edge(const Standard_Integer theIDVert1, const Standard_Integer theIDVert2) + FS_Edge(const int theIDVert1, const int theIDVert2) : myID(-1) { myVertices[0] = theIDVert1; @@ -217,12 +217,12 @@ protected: }; //! Creates topological member (TopoDS_Edge) - void CreateTopologicalEdge(const NCollection_Vector& theVertexVec, - const NCollection_Vector& theFaceVec, - const Standard_Real theTol); + void CreateTopologicalEdge(const NCollection_DynamicArray& theVertexVec, + const NCollection_DynamicArray& theFaceVec, + const double theTol); //! Sets vertex - void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID) + void SetVertex(const int thePlaceID, const int theVertID) { Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 1), "FS_Face::SetVertex(): OUT of Range"); @@ -230,45 +230,54 @@ protected: myVertices[thePlaceID] = theVertID; } - Standard_Boolean IsDegenerated() const { return (myVertices[0] == myVertices[1]); } + bool IsDegenerated() const { return (myVertices[0] == myVertices[1]); } //! List of faces which are shared with this edge //! Value is the index of this shape in myFaceVec array - NCollection_Sequence myFaces; + NCollection_Sequence myFaces; //! Identifies the place of this Edge in //! BRepBuilderAPI_FastSewing::myEdgeVec list - Standard_Integer myID; + int myID; TopoDS_Edge myTopoEdge; private: //! Index of the vertex in myVertexVec array - Standard_Integer myVertices[2]; + int myVertices[2]; }; //! This inspector will find a node nearest to the given point //! not far than on the given tolerance - class NodeInspector : public NCollection_CellFilter_InspectorXYZ + class NodeInspector { public: - typedef Standard_Integer Target; + static constexpr int Dimension = 3; - NodeInspector(const NCollection_Vector& theVec, - const gp_Pnt& thePnt, - const Standard_Real theTol); + typedef gp_XYZ Point; + typedef int Target; + + static double Coord(int i, const Point& thePnt) { return thePnt.Coord(i + 1); } + + static Point Shift(const Point& thePnt, double theTol) + { + return Point(thePnt.X() + theTol, thePnt.Y() + theTol, thePnt.Z() + theTol); + } + + NodeInspector(const NCollection_DynamicArray& theVec, + const gp_Pnt& thePnt, + const double theTol); Standard_EXPORT NCollection_CellFilter_Action Inspect(const Target theId); Target GetResult() { return myResID; } private: - NodeInspector& operator=(const NodeInspector&); - const NCollection_Vector& myVecOfVertexes; - gp_Pnt myPoint; - Standard_Real mySQToler; - Target myResID; - Standard_Boolean myIsFindingEnable; + NodeInspector& operator=(const NodeInspector&) = delete; + const NCollection_DynamicArray& myVecOfVertexes; + gp_Pnt myPoint; + double mySQToler; + Target myResID; }; private: @@ -277,19 +286,17 @@ private: // myFaceVec, myVertexVec and myEdgeVec lists are filled only once!!!!! //! Vector of faces - NCollection_Vector myFaceVec; + NCollection_DynamicArray myFaceVec; //! Vector of Vertices - NCollection_Vector myVertexVec; + NCollection_DynamicArray myVertexVec; //! Vector of edges - NCollection_Vector myEdgeVec; + NCollection_DynamicArray myEdgeVec; //! Tolerance - Standard_Real myTolerance; + double myTolerance; //! Bits of computation status FS_VARStatuses myStatusList; }; -DEFINE_STANDARD_HANDLE(BRepBuilderAPI_FastSewing, Standard_Transient) - #endif // _BRepBuilderAPI_FastSewing_HeaderFile diff --git a/opencascade/BRepBuilderAPI_FindPlane.hxx b/opencascade/BRepBuilderAPI_FindPlane.hxx index 836207282..8a857fa05 100644 --- a/opencascade/BRepBuilderAPI_FindPlane.hxx +++ b/opencascade/BRepBuilderAPI_FindPlane.hxx @@ -46,7 +46,7 @@ public: //! - the largest of the tolerance values assigned to the individual edges of S. //! Use the function Found to verify that a plane is built. //! The resulting plane is then retrieved using the function Plane. - Standard_EXPORT BRepBuilderAPI_FindPlane(const TopoDS_Shape& S, const Standard_Real Tol = -1); + Standard_EXPORT BRepBuilderAPI_FindPlane(const TopoDS_Shape& S, const double Tol = -1); //! Constructs the plane containing the edges of the shape S. //! A plane is built only if all the edges are within a distance @@ -56,21 +56,20 @@ public: //! - the largest of the tolerance values assigned to the individual edges of S. //! Use the function Found to verify that a plane is built. //! The resulting plane is then retrieved using the function Plane. - Standard_EXPORT void Init(const TopoDS_Shape& S, const Standard_Real Tol = -1); + Standard_EXPORT void Init(const TopoDS_Shape& S, const double Tol = -1); //! Returns true if a plane containing the edges of the //! shape is found and built. Use the function Plane to consult the result. - Standard_EXPORT Standard_Boolean Found() const; + Standard_EXPORT bool Found() const; //! Returns the plane containing the edges of the shape. //! Warning //! Use the function Found to verify that the plane is built. If //! a plane is not found, Plane returns a null handle. - Standard_EXPORT Handle(Geom_Plane) Plane() const; + Standard_EXPORT occ::handle Plane() const; -protected: private: - Handle(Geom_Plane) myPlane; + occ::handle myPlane; }; #endif // _BRepBuilderAPI_FindPlane_HeaderFile diff --git a/opencascade/BRepBuilderAPI_GTransform.hxx b/opencascade/BRepBuilderAPI_GTransform.hxx index 163463223..c676ce762 100644 --- a/opencascade/BRepBuilderAPI_GTransform.hxx +++ b/opencascade/BRepBuilderAPI_GTransform.hxx @@ -23,7 +23,8 @@ #include #include #include -#include +#include +#include class TopoDS_Shape; //! Geometric transformation on a shape. @@ -71,9 +72,9 @@ public: //! Note: the constructed framework can be reused to //! apply the same geometric transformation to other //! shapes: just specify them with the function Perform. - Standard_EXPORT BRepBuilderAPI_GTransform(const TopoDS_Shape& S, - const gp_GTrsf& T, - const Standard_Boolean Copy = Standard_False); + Standard_EXPORT BRepBuilderAPI_GTransform(const TopoDS_Shape& S, + const gp_GTrsf& T, + const bool Copy = false); //! Applies the geometric transformation defined at the //! time of construction of this framework to the shape S. @@ -87,17 +88,15 @@ public: //! Note: this framework can be reused to apply the same //! geometric transformation to other shapes: just specify //! them by calling the function Perform again. - Standard_EXPORT void Perform(const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False); + Standard_EXPORT void Perform(const TopoDS_Shape& S, const bool Copy = false); - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& S) override; //! Returns the modified shape corresponding to . - Standard_EXPORT virtual TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const override; -protected: private: gp_GTrsf myGTrsf; BRepBuilderAPI_Collect myHist; diff --git a/opencascade/BRepBuilderAPI_MakeEdge.hxx b/opencascade/BRepBuilderAPI_MakeEdge.hxx index 8c943ecb0..08da92c78 100644 --- a/opencascade/BRepBuilderAPI_MakeEdge.hxx +++ b/opencascade/BRepBuilderAPI_MakeEdge.hxx @@ -39,34 +39,34 @@ class TopoDS_Edge; //! Provides methods to build edges. //! -//! The methods have the following syntax, where +//! The methods have the following syntax, where //! TheCurve is one of Lin, Circ, ... //! //! Create(C : TheCurve) //! -//! Makes an edge on the whole curve. Add vertices +//! Makes an edge on the whole curve. Add vertices //! on finite curves. //! //! Create(C : TheCurve; p1,p2 : Real) //! -//! Make an edge on the curve between parameters p1 +//! Make an edge on the curve between parameters p1 //! and p2. if p2 < p1 the edge will be REVERSED. If -//! p1 or p2 is infinite the curve will be open in -//! that direction. Vertices are created for finite +//! p1 or p2 is infinite the curve will be open in +//! that direction. Vertices are created for finite //! values of p1 and p2. //! //! Create(C : TheCurve; P1, P2 : Pnt from gp) //! -//! Make an edge on the curve between the points P1 -//! and P2. The points are projected on the curve -//! and the previous method is used. An error is +//! Make an edge on the curve between the points P1 +//! and P2. The points are projected on the curve +//! and the previous method is used. An error is //! raised if the points are not on the curve. //! //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS) //! -//! Make an edge on the curve between the vertices -//! V1 and V2. Same as the previous but no vertices -//! are created. If a vertex is Null the curve will +//! Make an edge on the curve between the vertices +//! V1 and V2. Same as the previous but no vertices +//! are created. If a vertex is Null the curve will //! be open in this direction. class BRepBuilderAPI_MakeEdge : public BRepBuilderAPI_MakeShape { @@ -81,9 +81,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -93,9 +91,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -105,9 +101,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -117,9 +111,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -129,9 +121,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -139,56 +129,56 @@ public: const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, - const gp_Pnt& P1, - const gp_Pnt& P2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const double p1, + const double p2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S, + const double p1, + const double p2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); //! The general method to directly create an edge is to give //! - a 3D curve C as the support (geometric domain) of the edge, @@ -254,72 +244,70 @@ public: //! parameters of the curve will then be used. //! //! Auxiliary methods - Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, const gp_Pnt& P1, const gp_Pnt& P2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle& L, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C); + + Standard_EXPORT void Init(const occ::handle& C, const double p1, const double p2); + + Standard_EXPORT void Init(const occ::handle& C, const gp_Pnt& P1, const gp_Pnt& P2); + + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, const occ::handle& S); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); //! Defines or redefines the arguments for the construction of an edge. //! This function is currently used after the empty constructor BRepAPI_MakeEdge(). - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); //! Returns true if the edge is built. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the construction status //! - BRepBuilderAPI_EdgeDone if the edge is built, or @@ -347,7 +335,6 @@ public: //! StdFail_NotDone if the edge is not built. Standard_EXPORT const TopoDS_Vertex& Vertex2() const; -protected: private: BRepLib_MakeEdge myMakeEdge; }; diff --git a/opencascade/BRepBuilderAPI_MakeEdge2d.hxx b/opencascade/BRepBuilderAPI_MakeEdge2d.hxx index ead036ad3..8a9905608 100644 --- a/opencascade/BRepBuilderAPI_MakeEdge2d.hxx +++ b/opencascade/BRepBuilderAPI_MakeEdge2d.hxx @@ -37,34 +37,34 @@ class TopoDS_Edge; //! Provides methods to build edges. //! -//! The methods have the following syntax, where +//! The methods have the following syntax, where //! TheCurve is one of Lin2d, Circ2d, ... //! //! Create(C : TheCurve) //! -//! Makes an edge on the whole curve. Add vertices +//! Makes an edge on the whole curve. Add vertices //! on finite curves. //! //! Create(C : TheCurve; p1,p2 : Real) //! -//! Make an edge on the curve between parameters p1 +//! Make an edge on the curve between parameters p1 //! and p2. if p2 < p1 the edge will be REVERSED. If -//! p1 or p2 is infinite the curve will be open in -//! that direction. Vertices are created for finite +//! p1 or p2 is infinite the curve will be open in +//! that direction. Vertices are created for finite //! values of p1 and p2. //! //! Create(C : TheCurve; P1, P2 : Pnt2d from gp) //! -//! Make an edge on the curve between the points P1 -//! and P2. The points are projected on the curve -//! and the previous method is used. An error is +//! Make an edge on the curve between the points P1 +//! and P2. The points are projected on the curve +//! and the previous method is used. An error is //! raised if the points are not on the curve. //! //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS) //! -//! Make an edge on the curve between the vertices -//! V1 and V2. Same as the previous but no vertices -//! are created. If a vertex is Null the curve will +//! Make an edge on the curve between the vertices +//! V1 and V2. Same as the previous but no vertices +//! are created. If a vertex is Null the curve will //! be open in this direction. class BRepBuilderAPI_MakeEdge2d : public BRepBuilderAPI_MakeShape { @@ -77,9 +77,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Lin2d& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Lin2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Lin2d& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Lin2d& L, const gp_Pnt2d& P1, @@ -91,9 +89,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Circ2d& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Circ2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Circ2d& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Circ2d& L, const gp_Pnt2d& P1, @@ -105,9 +101,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Elips2d& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Elips2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Elips2d& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Elips2d& L, const gp_Pnt2d& P1, @@ -119,9 +113,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Hypr2d& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Hypr2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Hypr2d& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Hypr2d& L, const gp_Pnt2d& P1, @@ -133,9 +125,7 @@ public: Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Parab2d& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Parab2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Parab2d& L, const double p1, const double p2); Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const gp_Parab2d& L, const gp_Pnt2d& P1, @@ -145,57 +135,57 @@ public: const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L, + const double p1, + const double p2); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2, + const double p1, + const double p2); - Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepBuilderAPI_MakeEdge2d(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C); + Standard_EXPORT void Init(const occ::handle& C); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, const double p1, const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, const gp_Pnt2d& P1, const gp_Pnt2d& P2); + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2, + const double p1, + const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the error description when NotDone. Standard_EXPORT BRepBuilderAPI_EdgeError Error() const; @@ -209,7 +199,6 @@ public: //! Returns the second vertex of the edge. May be Null. Standard_EXPORT const TopoDS_Vertex& Vertex2() const; -protected: private: BRepLib_MakeEdge2d myMakeEdge2d; }; diff --git a/opencascade/BRepBuilderAPI_MakeFace.hxx b/opencascade/BRepBuilderAPI_MakeFace.hxx index 7eb199ff0..6b0c256f5 100644 --- a/opencascade/BRepBuilderAPI_MakeFace.hxx +++ b/opencascade/BRepBuilderAPI_MakeFace.hxx @@ -36,7 +36,7 @@ class TopoDS_Wire; //! Provides methods to build faces. //! -//! A face may be built : +//! A face may be built: //! //! * From a surface. //! @@ -53,7 +53,7 @@ class TopoDS_Wire; //! * From a surface and a wire. //! //! - A flag Inside is given, when this flag is True -//! the wire is oriented to bound a finite area on +//! the wire is oriented to bound a finite area on //! the surface. //! //! * From a face and a wire. @@ -87,92 +87,91 @@ public: //! Make a face from a Surface. Accepts tolerance value (TolDegen) //! for resolution of degenerated edges. - Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, - const Standard_Real TolDegen); + Standard_EXPORT BRepBuilderAPI_MakeFace(const occ::handle& S, + const double TolDegen); //! Make a face from a plane. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a cylinder. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a cone. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a sphere. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a torus. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a Surface. Accepts tolerance value (TolDegen) //! for resolution of degenerated edges. - Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Real TolDegen); + Standard_EXPORT BRepBuilderAPI_MakeFace(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const double TolDegen); //! Find a surface from the wire and make a face. //! if is true, the computed surface will be //! a plane. If it is not possible to find a plane, the //! flag NotDone will be set. - Standard_EXPORT BRepBuilderAPI_MakeFace(const TopoDS_Wire& W, - const Standard_Boolean OnlyPlane = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakeFace(const TopoDS_Wire& W, const bool OnlyPlane = false); //! Make a face from a plane and a wire. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a cylinder and a wire. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a cone and a wire. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a sphere and a wire. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a torus and a wire. - Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a Surface and a wire. //! If the surface S is not plane, //! it must contain pcurves for all edges in W, //! otherwise the wrong shape will be created. - Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepBuilderAPI_MakeFace(const occ::handle& S, + const TopoDS_Wire& W, + const bool Inside = true); //! Adds the wire in the face //! A general method to create a face is to give @@ -235,9 +234,9 @@ public: //! the face after this initialization, using the function Add. //! TolDegen parameter is used for resolution of degenerated edges //! if calculation of natural bounds is turned on. - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Boolean Bound, - const Standard_Real TolDegen); + Standard_EXPORT void Init(const occ::handle& S, + const bool Bound, + const double TolDegen); //! Initializes (or reinitializes) the construction of a face on //! the surface S, limited in the u parametric direction by @@ -249,12 +248,12 @@ public: //! when the parameters given are outside the bounds of the //! surface or the basis surface of a trimmed surface. //! TolDegen parameter is used for resolution of degenerated edges. - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Real TolDegen); + Standard_EXPORT void Init(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const double TolDegen); //! Adds the wire W to the constructed face as a hole. //! Warning @@ -272,7 +271,7 @@ public: Standard_EXPORT void Add(const TopoDS_Wire& W); //! Returns true if this algorithm has a valid face. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the construction status //! BRepBuilderAPI_FaceDone if the face is built, or @@ -288,7 +287,6 @@ public: Standard_EXPORT const TopoDS_Face& Face() const; Standard_EXPORT operator TopoDS_Face() const; -protected: private: BRepLib_MakeFace myMakeFace; }; diff --git a/opencascade/BRepBuilderAPI_MakePolygon.hxx b/opencascade/BRepBuilderAPI_MakePolygon.hxx index 76186ac8d..675e19f5b 100644 --- a/opencascade/BRepBuilderAPI_MakePolygon.hxx +++ b/opencascade/BRepBuilderAPI_MakePolygon.hxx @@ -32,8 +32,8 @@ class TopoDS_Wire; //! polygonal wire can be built from any number of points //! or vertices, and consists of a sequence of connected //! rectilinear edges. -//! When a point or vertex is added to the polygon if -//! it is identic to the previous point no edge is +//! When a point or vertex is added to the polygon if +//! it is identic to the previous point no edge is //! built. The method added can be used to test it. //! Construction of a Polygonal Wire //! You can construct: @@ -58,10 +58,10 @@ public: Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2); - Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, - const gp_Pnt& P2, - const gp_Pnt& P3, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, + const gp_Pnt& P2, + const gp_Pnt& P3, + const bool Close = false); //! Constructs a polygonal wire from 2, 3 or 4 points. Vertices are //! automatically created on the given points. The polygonal wire is @@ -78,18 +78,18 @@ public: //! sequence of points p1 - p2 - p1 is found among the arguments of the //! constructor, you will create a polygonal wire with two //! consecutive coincident edges. - Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, - const gp_Pnt& P2, - const gp_Pnt& P3, - const gp_Pnt& P4, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, + const gp_Pnt& P2, + const gp_Pnt& P3, + const gp_Pnt& P4, + const bool Close = false); Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + const bool Close = false); //! Constructs a polygonal wire from //! 2, 3 or 4 vertices. The polygonal wire is closed if Close is true; @@ -98,7 +98,7 @@ public: //! construction can be consulted at any time by using the Wire function. //! Example //! //a closed triangle from three vertices - //! TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,Standard_True); + //! TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,true); //! Warning //! The process is equivalent to: //! - initializing an empty polygonal wire, @@ -107,11 +107,11 @@ public: //! polygonal wire with two consecutive coincident edges if //! the sequence of vertices v1 - v2 - v1 is found among the //! constructor's arguments. - Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3, - const TopoDS_Vertex& V4, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + const TopoDS_Vertex& V4, + const bool Close = false); Standard_EXPORT void Add(const gp_Pnt& P); @@ -143,7 +143,7 @@ public: //! Returns true if the last vertex added to the constructed //! polygonal wire is not coincident with the previous one. - Standard_EXPORT Standard_Boolean Added() const; + Standard_EXPORT bool Added() const; //! Closes the polygonal wire under construction. Note - this //! is equivalent to adding the first vertex to the polygonal @@ -160,7 +160,7 @@ public: //! wire (i.e. if there is at least one edge). //! IsDone returns false if fewer than two vertices have //! been chained together by this construction algorithm. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the edge built between the last two points or //! vertices added to the constructed polygonal wire under construction. @@ -177,7 +177,6 @@ public: Standard_EXPORT const TopoDS_Wire& Wire(); Standard_EXPORT operator TopoDS_Wire(); -protected: private: BRepLib_MakePolygon myMakePolygon; }; diff --git a/opencascade/BRepBuilderAPI_MakeShape.hxx b/opencascade/BRepBuilderAPI_MakeShape.hxx index ba3a84be2..2235ec6f8 100644 --- a/opencascade/BRepBuilderAPI_MakeShape.hxx +++ b/opencascade/BRepBuilderAPI_MakeShape.hxx @@ -22,21 +22,21 @@ #include #include -#include +#include #include #include -//! This is the root class for all shape -//! constructions. It stores the result. +//! This is the root class for all shape +//! constructions. It stores the result. //! -//! It provides deferred methods to trace the history +//! It provides deferred methods to trace the history //! of sub-shapes. class BRepBuilderAPI_MakeShape : public BRepBuilderAPI_Command { public: DEFINE_STANDARD_ALLOC - //! This is called by Shape(). It does nothing but + //! This is called by Shape(). It does nothing but //! may be redefined. Standard_EXPORT virtual void Build( const Message_ProgressRange& theRange = Message_ProgressRange()); @@ -46,24 +46,22 @@ public: Standard_EXPORT virtual const TopoDS_Shape& Shape(); Standard_EXPORT operator TopoDS_Shape(); - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S); + Standard_EXPORT virtual const NCollection_List& Generated(const TopoDS_Shape& S); - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S); + Standard_EXPORT virtual const NCollection_List& Modified(const TopoDS_Shape& S); //! Returns true if the shape S has been deleted. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& S); + Standard_EXPORT virtual bool IsDeleted(const TopoDS_Shape& S); protected: Standard_EXPORT BRepBuilderAPI_MakeShape(); - TopoDS_Shape myShape; - TopTools_ListOfShape myGenerated; - -private: + TopoDS_Shape myShape; + NCollection_List myGenerated; }; #endif // _BRepBuilderAPI_MakeShape_HeaderFile diff --git a/opencascade/BRepBuilderAPI_MakeShapeOnMesh.hxx b/opencascade/BRepBuilderAPI_MakeShapeOnMesh.hxx index 39b522ea2..9b9c32471 100644 --- a/opencascade/BRepBuilderAPI_MakeShapeOnMesh.hxx +++ b/opencascade/BRepBuilderAPI_MakeShapeOnMesh.hxx @@ -29,17 +29,17 @@ public: //! Ctor. Sets mesh to process. //! @param[in] theMesh - Mesh to construct shape for. - BRepBuilderAPI_MakeShapeOnMesh(const Handle(Poly_Triangulation)& theMesh) + BRepBuilderAPI_MakeShapeOnMesh(const occ::handle& theMesh) : myMesh(theMesh) { } //! Builds shape on mesh. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; private: - Handle(Poly_Triangulation) myMesh; + occ::handle myMesh; }; #endif // _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile diff --git a/opencascade/BRepBuilderAPI_MakeShell.hxx b/opencascade/BRepBuilderAPI_MakeShell.hxx index 7c443d9ca..e675b326e 100644 --- a/opencascade/BRepBuilderAPI_MakeShell.hxx +++ b/opencascade/BRepBuilderAPI_MakeShell.hxx @@ -64,19 +64,19 @@ public: Standard_EXPORT BRepBuilderAPI_MakeShell(); //! Constructs a shell from the surface S. - Standard_EXPORT BRepBuilderAPI_MakeShell(const Handle(Geom_Surface)& S, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakeShell(const occ::handle& S, + const bool Segment = false); //! Constructs a shell from the surface S, //! limited in the u parametric direction by the two //! parameter values UMin and UMax, and limited in the v //! parametric direction by the two parameter values VMin and VMax. - Standard_EXPORT BRepBuilderAPI_MakeShell(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT BRepBuilderAPI_MakeShell(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const bool Segment = false); //! Defines or redefines the arguments //! for the construction of a shell. The construction is initialized @@ -88,15 +88,15 @@ public: //! - BRepBuilderAPI_ShellParametersOutOfRange //! when the given parameters are outside the bounds of the //! surface or the basis surface if S is trimmed - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT void Init(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const bool Segment = false); //! Returns true if the shell is built. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the construction status: //! - BRepBuilderAPI_ShellDone if the shell is built, or @@ -110,7 +110,6 @@ public: Standard_EXPORT const TopoDS_Shell& Shell() const; Standard_EXPORT operator TopoDS_Shell() const; -protected: private: BRepLib_MakeShell myMakeShell; }; diff --git a/opencascade/BRepBuilderAPI_MakeSolid.hxx b/opencascade/BRepBuilderAPI_MakeSolid.hxx index f321310d6..2119e177f 100644 --- a/opencascade/BRepBuilderAPI_MakeSolid.hxx +++ b/opencascade/BRepBuilderAPI_MakeSolid.hxx @@ -111,15 +111,14 @@ public: //! If no shell has been added, it could be a whole-space //! solid. However, no check was done to verify the //! conditions of coherence of the resulting solid. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the new Solid. Standard_EXPORT const TopoDS_Solid& Solid(); Standard_EXPORT operator TopoDS_Solid(); - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& S) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& S) override; -protected: private: BRepLib_MakeSolid myMakeSolid; }; diff --git a/opencascade/BRepBuilderAPI_MakeVertex.hxx b/opencascade/BRepBuilderAPI_MakeVertex.hxx index 4c080af53..3651cfbea 100644 --- a/opencascade/BRepBuilderAPI_MakeVertex.hxx +++ b/opencascade/BRepBuilderAPI_MakeVertex.hxx @@ -50,7 +50,6 @@ public: Standard_EXPORT const TopoDS_Vertex& Vertex(); Standard_EXPORT operator TopoDS_Vertex(); -protected: private: BRepLib_MakeVertex myMakeVertex; }; diff --git a/opencascade/BRepBuilderAPI_MakeWire.hxx b/opencascade/BRepBuilderAPI_MakeWire.hxx index ea86a2a13..8366363d5 100644 --- a/opencascade/BRepBuilderAPI_MakeWire.hxx +++ b/opencascade/BRepBuilderAPI_MakeWire.hxx @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include class TopoDS_Edge; class TopoDS_Wire; @@ -136,20 +137,20 @@ public: //! Add the edges of to the current wire. Standard_EXPORT void Add(const TopoDS_Wire& W); - //! Adds the edges of to the current wire. The - //! edges are not to be consecutive. But they are to - //! be all connected geometrically or topologically. - //! If some of them are not connected the Status give + //! Adds the edges of to the current wire. The + //! edges are not to be consecutive. But they are to + //! be all connected geometrically or topologically. + //! If some of them are not connected the Status give //! DisconnectedWire but the "Maker" is Done() and you - //! can get the partial result. (ie connected to the - //! first edgeof the list ) - Standard_EXPORT void Add(const TopTools_ListOfShape& L); + //! can get the partial result. + //! (i.e. connected to the first edgeof the list ) + Standard_EXPORT void Add(const NCollection_List& L); //! Returns true if this algorithm contains a valid wire. //! IsDone returns false if: //! - there are no edges in the wire, or //! - the last edge which you tried to add was not connectable. - Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; + Standard_EXPORT bool IsDone() const override; //! Returns the construction status //! - BRepBuilderAPI_WireDone if the wire is built, or @@ -180,7 +181,6 @@ public: //! add was not connectableR Standard_EXPORT const TopoDS_Vertex& Vertex() const; -protected: private: BRepLib_MakeWire myMakeWire; }; diff --git a/opencascade/BRepBuilderAPI_ModifyShape.hxx b/opencascade/BRepBuilderAPI_ModifyShape.hxx index 4f95bd99a..09c6cc2d4 100644 --- a/opencascade/BRepBuilderAPI_ModifyShape.hxx +++ b/opencascade/BRepBuilderAPI_ModifyShape.hxx @@ -24,14 +24,14 @@ #include #include #include -#include +#include class BRepTools_Modification; -//! Implements the methods of MakeShape for the -//! constant topology modifications. The methods are -//! implemented when the modification uses a Modifier -//! from BRepTools. Some of them have to be redefined -//! if the modification is implemented with another +//! Implements the methods of MakeShape for the +//! constant topology modifications. The methods are +//! implemented when the modification uses a Modifier +//! from BRepTools. Some of them have to be redefined +//! if the modification is implemented with another //! tool (see Transform from BRepBuilderAPI for example). //! The BRepBuilderAPI package provides the following //! frameworks to perform modifications of this sort: @@ -47,10 +47,9 @@ class BRepBuilderAPI_ModifyShape : public BRepBuilderAPI_MakeShape public: DEFINE_STANDARD_ALLOC - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& S) override; //! Returns the modified shape corresponding to . //! S can correspond to the entire initial shape or to its subshape. @@ -66,34 +65,34 @@ protected: //! Empty constructor. Standard_EXPORT BRepBuilderAPI_ModifyShape(); - //! Initializes the modifier with the Shape , and + //! Initializes the modifier with the Shape , and //! set the field to . Standard_EXPORT BRepBuilderAPI_ModifyShape(const TopoDS_Shape& S); //! Set the field with . - Standard_EXPORT BRepBuilderAPI_ModifyShape(const Handle(BRepTools_Modification)& M); + Standard_EXPORT BRepBuilderAPI_ModifyShape(const occ::handle& M); - //! Initializes the modifier with the Shape , and + //! Initializes the modifier with the Shape , and //! set the field to , and set the - //! field with , the performs the + //! field with , the performs the //! modification. - Standard_EXPORT BRepBuilderAPI_ModifyShape(const TopoDS_Shape& S, - const Handle(BRepTools_Modification)& M); + Standard_EXPORT BRepBuilderAPI_ModifyShape(const TopoDS_Shape& S, + const occ::handle& M); - //! Performs the previously given modification on the + //! Performs the previously given modification on the //! shape . Standard_EXPORT void DoModif(const TopoDS_Shape& S); - //! Performs the modification on a previously + //! Performs the modification on a previously //! given shape. - Standard_EXPORT void DoModif(const Handle(BRepTools_Modification)& M); + Standard_EXPORT void DoModif(const occ::handle& M); - //! Performs the modification on the shape . - Standard_EXPORT void DoModif(const TopoDS_Shape& S, const Handle(BRepTools_Modification)& M); + //! Performs the modification on the shape . + Standard_EXPORT void DoModif(const TopoDS_Shape& S, const occ::handle& M); - BRepTools_Modifier myModifier; - TopoDS_Shape myInitialShape; - Handle(BRepTools_Modification) myModification; + BRepTools_Modifier myModifier; + TopoDS_Shape myInitialShape; + occ::handle myModification; private: Standard_EXPORT void DoModif(); diff --git a/opencascade/BRepBuilderAPI_NurbsConvert.hxx b/opencascade/BRepBuilderAPI_NurbsConvert.hxx index c34c26ed2..50df1d73e 100644 --- a/opencascade/BRepBuilderAPI_NurbsConvert.hxx +++ b/opencascade/BRepBuilderAPI_NurbsConvert.hxx @@ -21,7 +21,9 @@ #include #include -#include +#include +#include +#include #include class TopoDS_Shape; @@ -51,8 +53,7 @@ public: //! Note: the constructed framework can be reused to //! convert other shapes. You specify these with the //! function Perform. - Standard_EXPORT BRepBuilderAPI_NurbsConvert(const TopoDS_Shape& S, - const Standard_Boolean Copy = Standard_False); + Standard_EXPORT BRepBuilderAPI_NurbsConvert(const TopoDS_Shape& S, const bool Copy = false); //! Builds a new shape by converting the geometry of the //! shape S into NURBS geometry. @@ -62,11 +63,11 @@ public: //! Use the function Shape to access the new shape. //! Note: this framework can be reused to convert other //! shapes: you specify them by calling the function Perform again. - Standard_EXPORT void Perform(const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False); + Standard_EXPORT void Perform(const TopoDS_Shape& S, const bool Copy = false); - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S); + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& S) override; //! Returns the modified shape corresponding to . //! S can correspond to the entire initial shape or to its subshape. @@ -74,14 +75,13 @@ public: //! Standard_NoSuchObject if S is not the initial shape or //! a subshape of the initial shape to which the //! transformation has been applied. - Standard_EXPORT virtual TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const; + Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const override; -protected: private: Standard_EXPORT void CorrectVertexTol(); - TopTools_DataMapOfShapeShape myVtxToReplace; - BRepTools_ReShape mySubs; + NCollection_DataMap myVtxToReplace; + BRepTools_ReShape mySubs; }; #endif // _BRepBuilderAPI_NurbsConvert_HeaderFile diff --git a/opencascade/BRepBuilderAPI_Sewing.hxx b/opencascade/BRepBuilderAPI_Sewing.hxx index dffd77cb3..d5e23b7de 100644 --- a/opencascade/BRepBuilderAPI_Sewing.hxx +++ b/opencascade/BRepBuilderAPI_Sewing.hxx @@ -20,24 +20,18 @@ #include #include -#include #include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include @@ -49,9 +43,6 @@ class TopLoc_Location; class Geom2d_Curve; class Geom_Curve; -class BRepBuilderAPI_Sewing; -DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Sewing, Standard_Transient) - //! Provides methods to //! //! - identify possible contiguous boundaries (for control @@ -84,18 +75,18 @@ public: //! option for analysis of degenerated shapes //! option for cutting of free edges. //! option for non manifold processing - Standard_EXPORT BRepBuilderAPI_Sewing(const Standard_Real tolerance = 1.0e-06, - const Standard_Boolean option1 = Standard_True, - const Standard_Boolean option2 = Standard_True, - const Standard_Boolean option3 = Standard_True, - const Standard_Boolean option4 = Standard_False); + Standard_EXPORT BRepBuilderAPI_Sewing(const double tolerance = 1.0e-06, + const bool option1 = true, + const bool option2 = true, + const bool option3 = true, + const bool option4 = false); //! initialize the parameters if necessary - Standard_EXPORT void Init(const Standard_Real tolerance = 1.0e-06, - const Standard_Boolean option1 = Standard_True, - const Standard_Boolean option2 = Standard_True, - const Standard_Boolean option3 = Standard_True, - const Standard_Boolean option4 = Standard_False); + Standard_EXPORT void Init(const double tolerance = 1.0e-06, + const bool option1 = true, + const bool option2 = true, + const bool option3 = true, + const bool option4 = false); //! Loads the context shape. Standard_EXPORT void Load(const TopoDS_Shape& shape); @@ -113,61 +104,60 @@ public: Standard_EXPORT const TopoDS_Shape& SewedShape() const; //! set context - Standard_EXPORT void SetContext(const Handle(BRepTools_ReShape)& theContext); + Standard_EXPORT void SetContext(const occ::handle& theContext); //! return context - Standard_EXPORT const Handle(BRepTools_ReShape)& GetContext() const; + Standard_EXPORT const occ::handle& GetContext() const; //! Gives the number of free edges (edge shared by one face) - Standard_EXPORT Standard_Integer NbFreeEdges() const; + Standard_EXPORT int NbFreeEdges() const; //! Gives each free edge - Standard_EXPORT const TopoDS_Edge& FreeEdge(const Standard_Integer index) const; + Standard_EXPORT const TopoDS_Edge& FreeEdge(const int index) const; //! Gives the number of multiple edges //! (edge shared by more than two faces) - Standard_EXPORT Standard_Integer NbMultipleEdges() const; + Standard_EXPORT int NbMultipleEdges() const; //! Gives each multiple edge - Standard_EXPORT const TopoDS_Edge& MultipleEdge(const Standard_Integer index) const; + Standard_EXPORT const TopoDS_Edge& MultipleEdge(const int index) const; //! Gives the number of contiguous edges (edge shared by two faces) - Standard_EXPORT Standard_Integer NbContigousEdges() const; + Standard_EXPORT int NbContigousEdges() const; //! Gives each contiguous edge - Standard_EXPORT const TopoDS_Edge& ContigousEdge(const Standard_Integer index) const; + Standard_EXPORT const TopoDS_Edge& ContigousEdge(const int index) const; //! Gives the sections (edge) belonging to a contiguous edge - Standard_EXPORT const TopTools_ListOfShape& ContigousEdgeCouple( - const Standard_Integer index) const; + Standard_EXPORT const NCollection_List& ContigousEdgeCouple(const int index) const; //! Indicates if a section is bound (before use SectionToBoundary) - Standard_EXPORT Standard_Boolean IsSectionBound(const TopoDS_Edge& section) const; + Standard_EXPORT bool IsSectionBound(const TopoDS_Edge& section) const; //! Gives the original edge (free boundary) which becomes the - //! the section. Remember that sections constitute common edges. + //! the section. Remember that sections constitute common edges. //! This information is important for control because with //! original edge we can find the surface to which the section //! is attached. Standard_EXPORT const TopoDS_Edge& SectionToBoundary(const TopoDS_Edge& section) const; //! Gives the number of degenerated shapes - Standard_EXPORT Standard_Integer NbDegeneratedShapes() const; + Standard_EXPORT int NbDegeneratedShapes() const; //! Gives each degenerated shape - Standard_EXPORT const TopoDS_Shape& DegeneratedShape(const Standard_Integer index) const; + Standard_EXPORT const TopoDS_Shape& DegeneratedShape(const int index) const; //! Indicates if a input shape is degenerated - Standard_EXPORT Standard_Boolean IsDegenerated(const TopoDS_Shape& shape) const; + Standard_EXPORT bool IsDegenerated(const TopoDS_Shape& shape) const; //! Indicates if a input shape has been modified - Standard_EXPORT Standard_Boolean IsModified(const TopoDS_Shape& shape) const; + Standard_EXPORT bool IsModified(const TopoDS_Shape& shape) const; //! Gives a modifieded shape Standard_EXPORT const TopoDS_Shape& Modified(const TopoDS_Shape& shape) const; //! Indicates if a input subshape has been modified - Standard_EXPORT Standard_Boolean IsModifiedSubShape(const TopoDS_Shape& shape) const; + Standard_EXPORT bool IsModifiedSubShape(const TopoDS_Shape& shape) const; //! Gives a modifieded subshape Standard_EXPORT TopoDS_Shape ModifiedSubShape(const TopoDS_Shape& shape) const; @@ -176,69 +166,68 @@ public: Standard_EXPORT void Dump() const; //! Gives the number of deleted faces (faces smallest than tolerance) - Standard_EXPORT Standard_Integer NbDeletedFaces() const; + Standard_EXPORT int NbDeletedFaces() const; //! Gives each deleted face - Standard_EXPORT const TopoDS_Face& DeletedFace(const Standard_Integer index) const; + Standard_EXPORT const TopoDS_Face& DeletedFace(const int index) const; //! Gives a modified shape - Standard_EXPORT TopoDS_Face WhichFace(const TopoDS_Edge& theEdg, - const Standard_Integer index = 1) const; + Standard_EXPORT TopoDS_Face WhichFace(const TopoDS_Edge& theEdg, const int index = 1) const; //! Gets same parameter mode. - Standard_Boolean SameParameterMode() const; + bool SameParameterMode() const; //! Sets same parameter mode. - void SetSameParameterMode(const Standard_Boolean SameParameterMode); + void SetSameParameterMode(const bool SameParameterMode); //! Gives set tolerance. - Standard_Real Tolerance() const; + double Tolerance() const; //! Sets tolerance - void SetTolerance(const Standard_Real theToler); + void SetTolerance(const double theToler); //! Gives set min tolerance. - Standard_Real MinTolerance() const; + double MinTolerance() const; //! Sets min tolerance - void SetMinTolerance(const Standard_Real theMinToler); + void SetMinTolerance(const double theMinToler); //! Gives set max tolerance - Standard_Real MaxTolerance() const; + double MaxTolerance() const; //! Sets max tolerance. - void SetMaxTolerance(const Standard_Real theMaxToler); + void SetMaxTolerance(const double theMaxToler); //! Returns mode for sewing faces By default - true. - Standard_Boolean FaceMode() const; + bool FaceMode() const; //! Sets mode for sewing faces By default - true. - void SetFaceMode(const Standard_Boolean theFaceMode); + void SetFaceMode(const bool theFaceMode); //! Returns mode for sewing floating edges By default - false. - Standard_Boolean FloatingEdgesMode() const; + bool FloatingEdgesMode() const; //! Sets mode for sewing floating edges By default - false. //! Returns mode for cutting floating edges By default - false. //! Sets mode for cutting floating edges By default - false. - void SetFloatingEdgesMode(const Standard_Boolean theFloatingEdgesMode); + void SetFloatingEdgesMode(const bool theFloatingEdgesMode); //! Returns mode for accounting of local tolerances //! of edges and vertices during of merging. - Standard_Boolean LocalTolerancesMode() const; + bool LocalTolerancesMode() const; //! Sets mode for accounting of local tolerances //! of edges and vertices during of merging //! in this case WorkTolerance = myTolerance + tolEdge1+ tolEdg2; - void SetLocalTolerancesMode(const Standard_Boolean theLocalTolerancesMode); + void SetLocalTolerancesMode(const bool theLocalTolerancesMode); //! Sets mode for non-manifold sewing. - void SetNonManifoldMode(const Standard_Boolean theNonManifoldMode); + void SetNonManifoldMode(const bool theNonManifoldMode); //! Gets mode for non-manifold sewing. //! //! INTERNAL FUNCTIONS --- - Standard_Boolean NonManifoldMode() const; + bool NonManifoldMode() const; DEFINE_STANDARD_RTTIEXT(BRepBuilderAPI_Sewing, Standard_Transient) @@ -247,27 +236,27 @@ protected: //! theProgress - progress indicator of processing Standard_EXPORT void Cutting(const Message_ProgressRange& theProgress = Message_ProgressRange()); - Standard_EXPORT void Merging(const Standard_Boolean passage, + Standard_EXPORT void Merging(const bool passage, const Message_ProgressRange& theProgress = Message_ProgressRange()); - Standard_EXPORT Standard_Boolean IsMergedClosed(const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - const TopoDS_Face& fase) const; + Standard_EXPORT bool IsMergedClosed(const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const TopoDS_Face& fase) const; - Standard_EXPORT Standard_Boolean FindCandidates(TopTools_SequenceOfShape& seqSections, - TColStd_IndexedMapOfInteger& mapReference, - TColStd_SequenceOfInteger& seqCandidates, - TColStd_SequenceOfBoolean& seqOrientations); + Standard_EXPORT bool FindCandidates(NCollection_Sequence& seqSections, + NCollection_IndexedMap& mapReference, + NCollection_Sequence& seqCandidates, + NCollection_Sequence& seqOrientations); - Standard_EXPORT void AnalysisNearestEdges(const TopTools_SequenceOfShape& sequenceSec, - TColStd_SequenceOfInteger& seqIndCandidate, - TColStd_SequenceOfBoolean& seqOrientations, - const Standard_Boolean evalDist = Standard_True); + Standard_EXPORT void AnalysisNearestEdges(const NCollection_Sequence& sequenceSec, + NCollection_Sequence& seqIndCandidate, + NCollection_Sequence& seqOrientations, + const bool evalDist = true); //! Merged nearest edges. - Standard_EXPORT Standard_Boolean MergedNearestEdges(const TopoDS_Shape& edge, - TopTools_SequenceOfShape& SeqMergedEdge, - TColStd_SequenceOfBoolean& SeqMergedOri); + Standard_EXPORT bool MergedNearestEdges(const TopoDS_Shape& edge, + NCollection_Sequence& SeqMergedEdge, + NCollection_Sequence& SeqMergedOri); Standard_EXPORT void EdgeProcessing( const Message_ProgressRange& theProgress = Message_ProgressRange()); @@ -279,14 +268,14 @@ protected: Standard_EXPORT void CreateOutputInformations(); //! Defines if surface is U closed. - Standard_EXPORT virtual Standard_Boolean IsUClosedSurface(const Handle(Geom_Surface)& surf, - const TopoDS_Shape& theEdge, - const TopLoc_Location& theloc) const; + Standard_EXPORT virtual bool IsUClosedSurface(const occ::handle& surf, + const TopoDS_Shape& theEdge, + const TopLoc_Location& theloc) const; //! Defines if surface is V closed. - Standard_EXPORT virtual Standard_Boolean IsVClosedSurface(const Handle(Geom_Surface)& surf, - const TopoDS_Shape& theEdge, - const TopLoc_Location& theloc) const; + Standard_EXPORT virtual bool IsVClosedSurface(const occ::handle& surf, + const TopoDS_Shape& theEdge, + const TopLoc_Location& theloc) const; //! This method is called from Perform only //! theProgress - progress indicator of processing @@ -306,120 +295,128 @@ protected: //! Get wire from free edges. //! This method is called from EdgeProcessing only - Standard_EXPORT virtual void GetFreeWires(TopTools_IndexedMapOfShape& MapFreeEdges, - TopTools_SequenceOfShape& seqWires); + Standard_EXPORT virtual void GetFreeWires( + NCollection_IndexedMap& MapFreeEdges, + NCollection_Sequence& seqWires); //! This method is called from MergingOfSections only - Standard_EXPORT virtual void EvaluateAngulars(TopTools_SequenceOfShape& sequenceSec, - TColStd_Array1OfBoolean& secForward, - TColStd_Array1OfReal& tabAng, - const Standard_Integer indRef) const; + Standard_EXPORT virtual void EvaluateAngulars(NCollection_Sequence& sequenceSec, + NCollection_Array1& secForward, + NCollection_Array1& tabAng, + const int indRef) const; //! This method is called from MergingOfSections only - Standard_EXPORT virtual void EvaluateDistances(TopTools_SequenceOfShape& sequenceSec, - TColStd_Array1OfBoolean& secForward, - TColStd_Array1OfReal& tabAng, - TColStd_Array1OfReal& arrLen, - TColStd_Array1OfReal& tabMinDist, - const Standard_Integer indRef) const; + Standard_EXPORT virtual void EvaluateDistances(NCollection_Sequence& sequenceSec, + NCollection_Array1& secForward, + NCollection_Array1& tabAng, + NCollection_Array1& arrLen, + NCollection_Array1& tabMinDist, + const int indRef) const; //! This method is called from SameParameterEdge only - Standard_EXPORT virtual Handle(Geom2d_Curve) SameRange(const Handle(Geom2d_Curve)& CurvePtr, - const Standard_Real FirstOnCurve, - const Standard_Real LastOnCurve, - const Standard_Real RequestedFirst, - const Standard_Real RequestedLast) const; + Standard_EXPORT virtual occ::handle SameRange( + const occ::handle& CurvePtr, + const double FirstOnCurve, + const double LastOnCurve, + const double RequestedFirst, + const double RequestedLast) const; //! This method is called from SameParameterEdge only Standard_EXPORT virtual void SameParameter(const TopoDS_Edge& edge) const; //! This method is called from Merging only Standard_EXPORT virtual TopoDS_Edge SameParameterEdge( - const TopoDS_Shape& edge, - const TopTools_SequenceOfShape& seqEdges, - const TColStd_SequenceOfBoolean& seqForward, - TopTools_MapOfShape& mapMerged, - const Handle(BRepTools_ReShape)& locReShape); + const TopoDS_Shape& edge, + const NCollection_Sequence& seqEdges, + const NCollection_Sequence& seqForward, + NCollection_Map& mapMerged, + const occ::handle& locReShape); //! This method is called from Merging only Standard_EXPORT virtual TopoDS_Edge SameParameterEdge( - const TopoDS_Edge& edge1, - const TopoDS_Edge& edge2, - const TopTools_ListOfShape& listFaces1, - const TopTools_ListOfShape& listFaces2, - const Standard_Boolean secForward, - Standard_Integer& whichSec, - const Standard_Boolean firstCall = Standard_True); + const TopoDS_Edge& edge1, + const TopoDS_Edge& edge2, + const NCollection_List& listFaces1, + const NCollection_List& listFaces2, + const bool secForward, + int& whichSec, + const bool firstCall = true); //! Projects points on curve //! This method is called from Cutting only - Standard_EXPORT void ProjectPointsOnCurve(const TColgp_Array1OfPnt& arrPnt, - const Handle(Geom_Curve)& Crv, - const Standard_Real first, - const Standard_Real last, - TColStd_Array1OfReal& arrDist, - TColStd_Array1OfReal& arrPara, - TColgp_Array1OfPnt& arrProj, - const Standard_Boolean isConsiderEnds) const; + Standard_EXPORT void ProjectPointsOnCurve(const NCollection_Array1& arrPnt, + const occ::handle& Crv, + const double first, + const double last, + NCollection_Array1& arrDist, + NCollection_Array1& arrPara, + NCollection_Array1& arrProj, + const bool isConsiderEnds) const; //! Creates cutting vertices on projections //! This method is called from Cutting only - Standard_EXPORT virtual void CreateCuttingNodes(const TopTools_IndexedMapOfShape& MapVert, - const TopoDS_Shape& bound, - const TopoDS_Shape& vfirst, - const TopoDS_Shape& vlast, - const TColStd_Array1OfReal& arrDist, - const TColStd_Array1OfReal& arrPara, - const TColgp_Array1OfPnt& arrPnt, - TopTools_SequenceOfShape& seqNode, - TColStd_SequenceOfReal& seqPara); + Standard_EXPORT virtual void CreateCuttingNodes( + const NCollection_IndexedMap& MapVert, + const TopoDS_Shape& bound, + const TopoDS_Shape& vfirst, + const TopoDS_Shape& vlast, + const NCollection_Array1& arrDist, + const NCollection_Array1& arrPara, + const NCollection_Array1& arrPnt, + NCollection_Sequence& seqNode, + NCollection_Sequence& seqPara); //! Performs cutting of bound //! This method is called from Cutting only - Standard_EXPORT virtual void CreateSections(const TopoDS_Shape& bound, - const TopTools_SequenceOfShape& seqNode, - const TColStd_SequenceOfReal& seqPara, - TopTools_ListOfShape& listEdge); + Standard_EXPORT virtual void CreateSections(const TopoDS_Shape& bound, + const NCollection_Sequence& seqNode, + const NCollection_Sequence& seqPara, + NCollection_List& listEdge); //! Makes all edges from shape same parameter - //! if SameParameterMode is equal to Standard_True + //! if SameParameterMode is equal to true //! This method is called from Perform only Standard_EXPORT virtual void SameParameterShape(); - Standard_Real myTolerance; - Standard_Boolean mySewing; - Standard_Boolean myAnalysis; - Standard_Boolean myCutting; - Standard_Boolean myNonmanifold; - TopTools_IndexedDataMapOfShapeShape myOldShapes; - TopoDS_Shape mySewedShape; - TopTools_IndexedMapOfShape myDegenerated; - TopTools_IndexedMapOfShape myFreeEdges; - TopTools_IndexedMapOfShape myMultipleEdges; - TopTools_IndexedDataMapOfShapeListOfShape myContigousEdges; - TopTools_DataMapOfShapeShape myContigSecBound; - Standard_Integer myNbShapes; - Standard_Integer myNbVertices; - Standard_Integer myNbEdges; - TopTools_IndexedDataMapOfShapeListOfShape myBoundFaces; - TopTools_DataMapOfShapeListOfShape myBoundSections; - TopTools_DataMapOfShapeShape mySectionBound; - TopTools_IndexedDataMapOfShapeShape myVertexNode; - TopTools_IndexedDataMapOfShapeShape myVertexNodeFree; - TopTools_DataMapOfShapeListOfShape myNodeSections; - TopTools_DataMapOfShapeListOfShape myCuttingNode; - TopTools_IndexedMapOfShape myLittleFace; - TopoDS_Shape myShape; - Handle(BRepTools_ReShape) myReShape; + double myTolerance; + bool mySewing; + bool myAnalysis; + bool myCutting; + bool myNonmanifold; + NCollection_IndexedDataMap myOldShapes; + TopoDS_Shape mySewedShape; + NCollection_IndexedMap myDegenerated; + NCollection_IndexedMap myFreeEdges; + NCollection_IndexedMap myMultipleEdges; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myContigousEdges; + NCollection_DataMap myContigSecBound; + int myNbShapes; + int myNbVertices; + int myNbEdges; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myBoundFaces; + NCollection_DataMap, TopTools_ShapeMapHasher> + myBoundSections; + NCollection_DataMap mySectionBound; + NCollection_IndexedDataMap myVertexNode; + NCollection_IndexedDataMap myVertexNodeFree; + NCollection_DataMap, TopTools_ShapeMapHasher> + myNodeSections; + NCollection_DataMap, TopTools_ShapeMapHasher> + myCuttingNode; + NCollection_IndexedMap myLittleFace; + TopoDS_Shape myShape; + occ::handle myReShape; private: - Standard_Boolean myFaceMode; - Standard_Boolean myFloatingEdgesMode; - Standard_Boolean mySameParameterMode; - Standard_Boolean myLocalToleranceMode; - Standard_Real myMinTolerance; - Standard_Real myMaxTolerance; - TopTools_MapOfShape myMergedEdges; + bool myFaceMode; + bool myFloatingEdgesMode; + bool mySameParameterMode; + bool myLocalToleranceMode; + double myMinTolerance; + double myMaxTolerance; + NCollection_Map myMergedEdges; }; #include diff --git a/opencascade/BRepBuilderAPI_Sewing.lxx b/opencascade/BRepBuilderAPI_Sewing.lxx index be5adef96..68f5bb111 100644 --- a/opencascade/BRepBuilderAPI_Sewing.lxx +++ b/opencascade/BRepBuilderAPI_Sewing.lxx @@ -13,186 +13,131 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : SetMaxTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetMaxTolerance(const Standard_Real theMaxToler) +inline void BRepBuilderAPI_Sewing::SetMaxTolerance(const double theMaxToler) { myMaxTolerance = theMaxToler; } -//======================================================================= -// function : MaxTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Real BRepBuilderAPI_Sewing::MaxTolerance() const +inline double BRepBuilderAPI_Sewing::MaxTolerance() const { return myMaxTolerance; } -//======================================================================= -// function : Tolerance -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Real BRepBuilderAPI_Sewing::Tolerance() const +inline double BRepBuilderAPI_Sewing::Tolerance() const { return myTolerance; } -//======================================================================= -// function : SetTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetTolerance(const Standard_Real theToler) +inline void BRepBuilderAPI_Sewing::SetTolerance(const double theToler) { myTolerance = theToler; } -//======================================================================= -// function : SetMinTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetMinTolerance(const Standard_Real theMinToler) +inline void BRepBuilderAPI_Sewing::SetMinTolerance(const double theMinToler) { myMinTolerance = theMinToler; } -//======================================================================= -// function : MinTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Real BRepBuilderAPI_Sewing::MinTolerance() const +inline double BRepBuilderAPI_Sewing::MinTolerance() const { return myMinTolerance; } -//======================================================================= -// function : SetFaceMode -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetFaceMode(const Standard_Boolean theFaceMode) +inline void BRepBuilderAPI_Sewing::SetFaceMode(const bool theFaceMode) { myFaceMode = theFaceMode; } -//======================================================================= -// function : FaceMode -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::FaceMode() const +inline bool BRepBuilderAPI_Sewing::FaceMode() const { return myFaceMode; } -//======================================================================= -// function : SetFloatingEdgesMode -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetFloatingEdgesMode(const Standard_Boolean theFloatingEdgesMode) +inline void BRepBuilderAPI_Sewing::SetFloatingEdgesMode(const bool theFloatingEdgesMode) { myFloatingEdgesMode = theFloatingEdgesMode; } -//======================================================================= -// function : FloatingEdgesMode -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::FloatingEdgesMode() const +inline bool BRepBuilderAPI_Sewing::FloatingEdgesMode() const { return myFloatingEdgesMode; } /* -//======================================================================= -//function : SetCuttingFloatingEdgesMode -//purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetCuttingFloatingEdgesMode(const Standard_Boolean +inline void BRepBuilderAPI_Sewing::SetCuttingFloatingEdgesMode(const bool theCuttingFloatingEdgesMode) { myCuttingFloatingEdgesMode = theCuttingFloatingEdgesMode; } -//======================================================================= -//function : CuttingFloatingEdgesMode -//purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::CuttingFloatingEdgesMode() const +inline bool BRepBuilderAPI_Sewing::CuttingFloatingEdgesMode() const { return myCuttingFloatingEdgesMode; } */ -//======================================================================= -// function : SameParameterMode -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::SameParameterMode() const +inline bool BRepBuilderAPI_Sewing::SameParameterMode() const { return mySameParameterMode; } -//======================================================================= -// function : SetSameParameterMode -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetSameParameterMode(const Standard_Boolean SameParameterMode) +inline void BRepBuilderAPI_Sewing::SetSameParameterMode(const bool SameParameterMode) { mySameParameterMode = SameParameterMode; } -//======================================================================= -// function : SetLocalTolerancesMode -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetLocalTolerancesMode( - const Standard_Boolean theLocalTolerancesMode) +inline void BRepBuilderAPI_Sewing::SetLocalTolerancesMode(const bool theLocalTolerancesMode) { myLocalToleranceMode = theLocalTolerancesMode; } -//======================================================================= -// function : LocalTolerancesMode -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::LocalTolerancesMode() const +inline bool BRepBuilderAPI_Sewing::LocalTolerancesMode() const { return myLocalToleranceMode; } -//======================================================================= -// function : SetNonManifoldMode -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepBuilderAPI_Sewing::SetNonManifoldMode(const Standard_Boolean theNonManifoldMode) +inline void BRepBuilderAPI_Sewing::SetNonManifoldMode(const bool theNonManifoldMode) { myNonmanifold = theNonManifoldMode; } -//======================================================================= -// function : NonManifoldMode -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepBuilderAPI_Sewing::NonManifoldMode() const +inline bool BRepBuilderAPI_Sewing::NonManifoldMode() const { return myNonmanifold; } diff --git a/opencascade/BRepBuilderAPI_Transform.hxx b/opencascade/BRepBuilderAPI_Transform.hxx index 6249c2faa..b788a1284 100644 --- a/opencascade/BRepBuilderAPI_Transform.hxx +++ b/opencascade/BRepBuilderAPI_Transform.hxx @@ -23,7 +23,8 @@ #include #include -#include +#include +#include class TopoDS_Shape; //! Geometric transformation on a shape. @@ -49,17 +50,17 @@ public: //! Creates a transformation from the gp_Trsf , and //! applies it to the shape . If the transformation - //! is direct and isometric (determinant = 1) and - //! = Standard_False, the resulting shape is - //! on which a new location has been set. - //! Otherwise, the transformation is applied on a + //! is direct and isometric (determinant = 1) and + //! = false, the resulting shape is + //! on which a new location has been set. + //! Otherwise, the transformation is applied on a //! duplication of . //! If is true, the triangulation will be copied, //! and the copy will be assigned to the result shape. - Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& theShape, - const gp_Trsf& theTrsf, - const Standard_Boolean theCopyGeom = Standard_False, - const Standard_Boolean theCopyMesh = Standard_False); + Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& theShape, + const gp_Trsf& theTrsf, + const bool theCopyGeom = false, + const bool theCopyMesh = false); //! Applies the geometric transformation defined at the //! time of construction of this framework to the shape S. @@ -75,23 +76,21 @@ public: //! Note: this framework can be reused to apply the same //! geometric transformation to other shapes. You only //! need to specify them by calling the function Perform again. - Standard_EXPORT void Perform(const TopoDS_Shape& theShape, - const Standard_Boolean theCopyGeom = Standard_False, - const Standard_Boolean theCopyMesh = Standard_False); + Standard_EXPORT void Perform(const TopoDS_Shape& theShape, + const bool theCopyGeom = false, + const bool theCopyMesh = false); //! Returns the modified shape corresponding to . - Standard_EXPORT virtual TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const override; - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& S) override; -protected: private: - gp_Trsf myTrsf; - TopLoc_Location myLocation; - Standard_Boolean myUseModif; + gp_Trsf myTrsf; + TopLoc_Location myLocation; + bool myUseModif; }; #endif // _BRepBuilderAPI_Transform_HeaderFile diff --git a/opencascade/BRepBuilderAPI_TransitionMode.hxx b/opencascade/BRepBuilderAPI_TransitionMode.hxx index 44fb2a034..fff3ed88c 100644 --- a/opencascade/BRepBuilderAPI_TransitionMode.hxx +++ b/opencascade/BRepBuilderAPI_TransitionMode.hxx @@ -17,7 +17,7 @@ #ifndef _BRepBuilderAPI_TransitionMode_HeaderFile #define _BRepBuilderAPI_TransitionMode_HeaderFile -//! Option to manage discontinuities in Sweep +//! Option to manage discontinuities in Sweep enum BRepBuilderAPI_TransitionMode { BRepBuilderAPI_Transformed, diff --git a/opencascade/BRepBuilderAPI_VertexInspector.hxx b/opencascade/BRepBuilderAPI_VertexInspector.hxx index 8f13c7fdb..bd0f4bc72 100644 --- a/opencascade/BRepBuilderAPI_VertexInspector.hxx +++ b/opencascade/BRepBuilderAPI_VertexInspector.hxx @@ -16,28 +16,34 @@ #ifndef BRepBuilderAPI_VertexInspector_HeaderFile #define BRepBuilderAPI_VertexInspector_HeaderFile -#include -#include +#include +#include +#include #include #include -typedef NCollection_Vector VectorOfPoint; +typedef NCollection_DynamicArray VectorOfPoint; -//======================================================================= -//! Class BRepBuilderAPI_VertexInspector -//! derived from NCollection_CellFilter_InspectorXYZ -//! This class define the Inspector interface for CellFilter algorithm, -//! working with gp_XYZ points in 3d space. -//! Used in search of coincidence points with a certain tolerance. -//======================================================================= +//! Inspector for CellFilter algorithm working with gp_XYZ points in 3d space. +//! Used in search of coincidence points with a certain tolerance. -class BRepBuilderAPI_VertexInspector : public NCollection_CellFilter_InspectorXYZ +class BRepBuilderAPI_VertexInspector { public: - typedef Standard_Integer Target; + static constexpr int Dimension = 3; + + typedef gp_XYZ Point; + typedef int Target; + + static double Coord(int i, const Point& thePnt) { return thePnt.Coord(i + 1); } + + static Point Shift(const Point& thePnt, double theTol) + { + return Point(thePnt.X() + theTol, thePnt.Y() + theTol, thePnt.Z() + theTol); + } //! Constructor; remembers the tolerance - BRepBuilderAPI_VertexInspector(const Standard_Real theTol) + BRepBuilderAPI_VertexInspector(const double theTol) : myTol(theTol * theTol) { } @@ -52,14 +58,14 @@ public: void SetCurrent(const gp_XYZ& theCurPnt) { myCurrent = theCurPnt; } //! Get list of indexes of points adjacent with the current - const TColStd_ListOfInteger& ResInd() { return myResInd; } + const NCollection_List& ResInd() { return myResInd; } //! Implementation of inspection method - Standard_EXPORT NCollection_CellFilter_Action Inspect(const Standard_Integer theTarget); + Standard_EXPORT NCollection_CellFilter_Action Inspect(const int theTarget); private: - Standard_Real myTol; - TColStd_ListOfInteger myResInd; + double myTol; + NCollection_List myResInd; VectorOfPoint myPoints; gp_XYZ myCurrent; }; diff --git a/opencascade/BRepCheck.hxx b/opencascade/BRepCheck.hxx index 5fe2d5c74..a21a2a00e 100644 --- a/opencascade/BRepCheck.hxx +++ b/opencascade/BRepCheck.hxx @@ -18,8 +18,9 @@ #define _BRepCheck_HeaderFile #include -#include #include +#include +#include #include class TopoDS_Wire; @@ -27,27 +28,28 @@ class TopoDS_Face; class TopoDS_Edge; class Adaptor3d_Curve; -//! This package provides tools to check the validity +//! This package provides tools to check the validity //! of the BRep. class BRepCheck { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT static void Add(BRepCheck_ListOfStatus& List, const BRepCheck_Status Stat); + Standard_EXPORT static void Add(NCollection_List& List, + const BRepCheck_Status Stat); Standard_EXPORT static void Print(const BRepCheck_Status Stat, Standard_OStream& OS); - Standard_EXPORT static Standard_Boolean SelfIntersection(const TopoDS_Wire& W, - const TopoDS_Face& F, - TopoDS_Edge& E1, - TopoDS_Edge& E2); + Standard_EXPORT static bool SelfIntersection(const TopoDS_Wire& W, + const TopoDS_Face& F, + TopoDS_Edge& E1, + TopoDS_Edge& E2); //! Returns the resolution on the 3d curve - Standard_EXPORT static Standard_Real PrecCurve(const Adaptor3d_Curve& aAC3D); + Standard_EXPORT static double PrecCurve(const Adaptor3d_Curve& aAC3D); //! Returns the resolution on the surface - Standard_EXPORT static Standard_Real PrecSurface(const Handle(Adaptor3d_Surface)& aAHSurf); + Standard_EXPORT static double PrecSurface(const occ::handle& aAHSurf); }; #endif // _BRepCheck_HeaderFile diff --git a/opencascade/BRepCheck_Analyzer.hxx b/opencascade/BRepCheck_Analyzer.hxx index 31fb8b12b..ad2641bcf 100644 --- a/opencascade/BRepCheck_Analyzer.hxx +++ b/opencascade/BRepCheck_Analyzer.hxx @@ -22,7 +22,8 @@ #include #include -#include +#include +#include #include class BRepCheck_Result; @@ -39,71 +40,70 @@ public: DEFINE_STANDARD_ALLOC //! Constructs a shape validation object defined by the shape S. - //! is the shape to control. If - //! False only topological informaions are checked. + //! is the shape to control. If + //! False only topological informaions are checked. //! The geometricals controls are - //! For a Vertex : - //! BRepCheck_InvalidToleranceValue NYI - //! For an Edge : + //! For a Vertex: + //! BRepCheck_InvalidToleranceValue NYI + //! For an Edge: //! BRepCheck_InvalidCurveOnClosedSurface, //! BRepCheck_InvalidCurveOnSurface, //! BRepCheck_InvalidSameParameterFlag, - //! BRepCheck_InvalidToleranceValue NYI - //! For a face : + //! BRepCheck_InvalidToleranceValue NYI + //! For a face: //! BRepCheck_UnorientableShape, //! BRepCheck_IntersectingWires, - //! BRepCheck_InvalidToleranceValue NYI - //! For a wire : + //! BRepCheck_InvalidToleranceValue NYI + //! For a wire: //! BRepCheck_SelfIntersectingWire - BRepCheck_Analyzer(const TopoDS_Shape& S, - const Standard_Boolean GeomControls = Standard_True, - const Standard_Boolean theIsParallel = Standard_False, - const Standard_Boolean theIsExact = Standard_False) + BRepCheck_Analyzer(const TopoDS_Shape& S, + const bool GeomControls = true, + const bool theIsParallel = false, + const bool theIsExact = false) : myIsParallel(theIsParallel), myIsExact(theIsExact) { Init(S, GeomControls); } - //! is the shape to control. If - //! False only topological informaions are checked. + //! is the shape to control. If + //! False only topological informaions are checked. //! The geometricals controls are - //! For a Vertex : - //! BRepCheck_InvalidTolerance NYI - //! For an Edge : + //! For a Vertex: + //! BRepCheck_InvalidTolerance NYI + //! For an Edge: //! BRepCheck_InvalidCurveOnClosedSurface, //! BRepCheck_InvalidCurveOnSurface, //! BRepCheck_InvalidSameParameterFlag, - //! BRepCheck_InvalidTolerance NYI - //! For a face : + //! BRepCheck_InvalidTolerance NYI + //! For a face: //! BRepCheck_UnorientableShape, //! BRepCheck_IntersectingWires, - //! BRepCheck_InvalidTolerance NYI - //! For a wire : + //! BRepCheck_InvalidTolerance NYI + //! For a wire: //! BRepCheck_SelfIntersectingWire - Standard_EXPORT void Init(const TopoDS_Shape& S, - const Standard_Boolean GeomControls = Standard_True); + Standard_EXPORT void Init(const TopoDS_Shape& S, const bool GeomControls = true); //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact //! is false, faster, but possible not correct result) or exact calculating by using //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly). //! Exact method is used only when edge is SameParameter. //! Default method is calculating in finite number of points - void SetExactMethod(const Standard_Boolean theIsExact) { myIsExact = theIsExact; } + void SetExactMethod(const bool theIsExact) { myIsExact = theIsExact; } //! Returns true if exact method selected - Standard_Boolean IsExactMethod() { return myIsExact; } + bool IsExactMethod() { return myIsExact; } //! Sets parallel flag - void SetParallel(const Standard_Boolean theIsParallel) { myIsParallel = theIsParallel; } + void SetParallel(const bool theIsParallel) { myIsParallel = theIsParallel; } //! Returns true if parallel flag is set - Standard_Boolean IsParallel() { return myIsParallel; } + bool IsParallel() { return myIsParallel; } - //! is a subshape of the original shape. Returns + //! is a subshape of the original shape. Returns //! if no default has been detected on //! and any of its subshape. - Standard_EXPORT Standard_Boolean IsValid(const TopoDS_Shape& S) const; + Standard_EXPORT bool IsValid(const TopoDS_Shape& S) const; //! Returns true if no defect is //! detected on the shape S or any of its subshapes. @@ -128,15 +128,15 @@ public: //! the edge?s contextual situation. //! - if the edge is either single, or it is in the context //! of a wire or a compound, its parameterization is defined by - //! the parameterization of its 3D curve and is considered as valid. + //! the parameterization of its 3D curve and is considered as valid. //! - If the edge is in the context of a face, it should - //! have SameParameter and SameRange flags set to Standard_True. To + //! have SameParameter and SameRange flags set to true. To //! check these flags, you should call the function //! BRep_Tool::SameParameter and BRep_Tool::SameRange for an - //! edge. If at least one of these flags is set to Standard_False, + //! edge. If at least one of these flags is set to false, //! the edge is considered as invalid without any additional check. //! If the edge is contained by a face, and it has SameParameter and - //! SameRange flags set to Standard_True, IsValid checks + //! SameRange flags set to true, IsValid checks //! whether representation of the edge on face, in context of which the //! edge is considered, has the same parameterization up to the //! tolerance value coded on the edge. For a given parameter t on the edge @@ -144,26 +144,25 @@ public: //! surface of the reference face), this checks that |C(t) - S(P(t))| //! is less than or equal to tolerance, where tolerance is the tolerance //! value coded on the edge. - Standard_Boolean IsValid() const { return IsValid(myShape); } + bool IsValid() const { return IsValid(myShape); } - const Handle(BRepCheck_Result)& Result(const TopoDS_Shape& theSubS) const + const occ::handle& Result(const TopoDS_Shape& theSubS) const { return myMap.FindFromKey(theSubS); } private: - Standard_EXPORT void Put(const TopoDS_Shape& S, const Standard_Boolean Gctrl); + Standard_EXPORT void Put(const TopoDS_Shape& S, const bool Gctrl); Standard_EXPORT void Perform(); - Standard_EXPORT Standard_Boolean ValidSub(const TopoDS_Shape& S, - const TopAbs_ShapeEnum SubType) const; + Standard_EXPORT bool ValidSub(const TopoDS_Shape& S, const TopAbs_ShapeEnum SubType) const; private: - TopoDS_Shape myShape; - BRepCheck_IndexedDataMapOfShapeResult myMap; - Standard_Boolean myIsParallel; - Standard_Boolean myIsExact; + TopoDS_Shape myShape; + NCollection_IndexedDataMap> myMap; + bool myIsParallel; + bool myIsExact; }; #endif // _BRepCheck_Analyzer_HeaderFile diff --git a/opencascade/BRepCheck_DataMapOfShapeListOfStatus.hxx b/opencascade/BRepCheck_DataMapOfShapeListOfStatus.hxx index cbaca48f6..c8ba9df67 100644 --- a/opencascade/BRepCheck_DataMapOfShapeListOfStatus.hxx +++ b/opencascade/BRepCheck_DataMapOfShapeListOfStatus.hxx @@ -1,7 +1,4 @@ -// Created on: 1995-12-06 -// Created by: Jacques GOUSSARD -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,22 +11,38 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepCheck_DataMapOfShapeListOfStatus_HeaderFile -#define BRepCheck_DataMapOfShapeListOfStatus_HeaderFile +//! @file BRepCheck_DataMapOfShapeListOfStatus.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepCheck_DataMapOfShapeListOfStatus_hxx +#define _BRepCheck_DataMapOfShapeListOfStatus_hxx + +#include #include #include #include #include #include +Standard_HEADER_DEPRECATED("BRepCheck_DataMapOfShapeListOfStatus.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepCheck_DataMapOfShapeListOfStatus is deprecated, use NCollection_DataMap), TopTools_ShapeMapHasher> directly") typedef NCollection_DataMap), TopTools_ShapeMapHasher> BRepCheck_DataMapOfShapeListOfStatus; +Standard_DEPRECATED( + "BRepCheck_DataMapIteratorOfDataMapOfShapeListOfStatus is deprecated, use " + "NCollection_DataMap), " + "TopTools_ShapeMapHasher>::Iterator directly") typedef NCollection_DataMap), TopTools_ShapeMapHasher>::Iterator BRepCheck_DataMapIteratorOfDataMapOfShapeListOfStatus; -#endif +#endif // _BRepCheck_DataMapOfShapeListOfStatus_hxx diff --git a/opencascade/BRepCheck_Edge.hxx b/opencascade/BRepCheck_Edge.hxx index daf9a3974..42ddf3930 100644 --- a/opencascade/BRepCheck_Edge.hxx +++ b/opencascade/BRepCheck_Edge.hxx @@ -25,26 +25,23 @@ class BRep_CurveRepresentation; class TopoDS_Edge; class TopoDS_Shape; -class BRepCheck_Edge; -DEFINE_STANDARD_HANDLE(BRepCheck_Edge, BRepCheck_Result) - class BRepCheck_Edge : public BRepCheck_Result { public: Standard_EXPORT BRepCheck_Edge(const TopoDS_Edge& E); - Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) override; - Standard_EXPORT void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; - Standard_EXPORT void Blind() Standard_OVERRIDE; + Standard_EXPORT void Blind() override; - Standard_EXPORT Standard_Boolean GeometricControls() const; + Standard_EXPORT bool GeometricControls() const; - Standard_EXPORT void GeometricControls(const Standard_Boolean B); + Standard_EXPORT void GeometricControls(const bool B); - Standard_EXPORT Standard_Real Tolerance(); + Standard_EXPORT double Tolerance(); //! Sets status of Edge; Standard_EXPORT void SetStatus(const BRepCheck_Status theStatus); @@ -54,10 +51,10 @@ public: //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly). //! Exact method is used only when edge is SameParameter. //! Default method is calculating in finite number of points - void SetExactMethod(Standard_Boolean theIsExact) { myIsExactMethod = theIsExact; } + void SetExactMethod(bool theIsExact) { myIsExactMethod = theIsExact; } //! Returns true if exact method selected - Standard_Boolean IsExactMethod() { return myIsExactMethod; } + bool IsExactMethod() { return myIsExactMethod; } //! Checks, if polygon on triangulation of heEdge //! is out of 3D-curve of this edge. @@ -66,10 +63,10 @@ public: DEFINE_STANDARD_RTTIEXT(BRepCheck_Edge, BRepCheck_Result) private: - Handle(BRep_CurveRepresentation) myCref; - Handle(Adaptor3d_Curve) myHCurve; - Standard_Boolean myGctrl; - Standard_Boolean myIsExactMethod; + occ::handle myCref; + occ::handle myHCurve; + bool myGctrl; + bool myIsExactMethod; }; #endif // _BRepCheck_Edge_HeaderFile diff --git a/opencascade/BRepCheck_Face.hxx b/opencascade/BRepCheck_Face.hxx index ae6db5eb4..762053212 100644 --- a/opencascade/BRepCheck_Face.hxx +++ b/opencascade/BRepCheck_Face.hxx @@ -21,56 +21,55 @@ #include #include -#include +#include +#include +#include +#include #include class TopoDS_Face; class TopoDS_Shape; -class BRepCheck_Face; -DEFINE_STANDARD_HANDLE(BRepCheck_Face, BRepCheck_Result) - class BRepCheck_Face : public BRepCheck_Result { public: Standard_EXPORT BRepCheck_Face(const TopoDS_Face& F); - Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) override; - Standard_EXPORT void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; - Standard_EXPORT void Blind() Standard_OVERRIDE; + Standard_EXPORT void Blind() override; - Standard_EXPORT BRepCheck_Status IntersectWires(const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status IntersectWires(const bool Update = false); - Standard_EXPORT BRepCheck_Status ClassifyWires(const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status ClassifyWires(const bool Update = false); - Standard_EXPORT BRepCheck_Status - OrientationOfWires(const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status OrientationOfWires(const bool Update = false); Standard_EXPORT void SetUnorientable(); //! Sets status of Face; Standard_EXPORT void SetStatus(const BRepCheck_Status theStatus); - Standard_EXPORT Standard_Boolean IsUnorientable() const; + Standard_EXPORT bool IsUnorientable() const; - Standard_EXPORT Standard_Boolean GeometricControls() const; + Standard_EXPORT bool GeometricControls() const; - Standard_EXPORT void GeometricControls(const Standard_Boolean B); + Standard_EXPORT void GeometricControls(const bool B); DEFINE_STANDARD_RTTIEXT(BRepCheck_Face, BRepCheck_Result) -protected: private: - Standard_Boolean myIntdone; - BRepCheck_Status myIntres; - Standard_Boolean myImbdone; - BRepCheck_Status myImbres; - Standard_Boolean myOridone; - BRepCheck_Status myOrires; - TopTools_DataMapOfShapeListOfShape myMapImb; - Standard_Boolean myGctrl; + bool myIntdone; + BRepCheck_Status myIntres; + bool myImbdone; + BRepCheck_Status myImbres; + bool myOridone; + BRepCheck_Status myOrires; + NCollection_DataMap, TopTools_ShapeMapHasher> + myMapImb; + bool myGctrl; }; #endif // _BRepCheck_Face_HeaderFile diff --git a/opencascade/BRepCheck_IndexedDataMapOfShapeResult.hxx b/opencascade/BRepCheck_IndexedDataMapOfShapeResult.hxx index 7a14e7d2f..9716d6415 100644 --- a/opencascade/BRepCheck_IndexedDataMapOfShapeResult.hxx +++ b/opencascade/BRepCheck_IndexedDataMapOfShapeResult.hxx @@ -1,7 +1,4 @@ -// Created on: 1995-12-06 -// Created by: Jacques GOUSSARD -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,14 +11,28 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepCheck_DataMapOfShapeResult_HeaderFile -#define BRepCheck_DataMapOfShapeResult_HeaderFile +//! @file BRepCheck_IndexedDataMapOfShapeResult.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap> +//! directly instead. +#ifndef _BRepCheck_IndexedDataMapOfShapeResult_hxx +#define _BRepCheck_IndexedDataMapOfShapeResult_hxx + +#include #include #include #include -typedef NCollection_IndexedDataMap +Standard_HEADER_DEPRECATED( + "BRepCheck_IndexedDataMapOfShapeResult.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedDataMap> directly.") + + Standard_DEPRECATED( + "BRepCheck_IndexedDataMapOfShapeResult is deprecated, use " + "NCollection_IndexedDataMap> directly") +typedef NCollection_IndexedDataMap> BRepCheck_IndexedDataMapOfShapeResult; -#endif +#endif // _BRepCheck_IndexedDataMapOfShapeResult_hxx diff --git a/opencascade/BRepCheck_ListOfStatus.hxx b/opencascade/BRepCheck_ListOfStatus.hxx index 42ffcab83..5e4854317 100644 --- a/opencascade/BRepCheck_ListOfStatus.hxx +++ b/opencascade/BRepCheck_ListOfStatus.hxx @@ -1,7 +1,4 @@ -// Created on: 1995-12-06 -// Created by: Jacques GOUSSARD -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,15 +11,30 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepCheck_ListOfStatus_HeaderFile -#define BRepCheck_ListOfStatus_HeaderFile +//! @file BRepCheck_ListOfStatus.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepCheck_ListOfStatus_hxx +#define _BRepCheck_ListOfStatus_hxx + +#include #include #include #include -typedef NCollection_List BRepCheck_ListOfStatus; +Standard_HEADER_DEPRECATED( + "BRepCheck_ListOfStatus.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepCheck_ListOfStatus is deprecated, use NCollection_List directly") +typedef NCollection_List BRepCheck_ListOfStatus; +Standard_DEPRECATED( + "BRepCheck_HListOfStatus is deprecated, use NCollection_Shared directly") +typedef NCollection_Shared BRepCheck_HListOfStatus; +Standard_DEPRECATED("BRepCheck_ListIteratorOfListOfStatus is deprecated, use " + "NCollection_List::Iterator directly") typedef NCollection_List::Iterator BRepCheck_ListIteratorOfListOfStatus; -typedef NCollection_Shared BRepCheck_HListOfStatus; -#endif +#endif // _BRepCheck_ListOfStatus_hxx diff --git a/opencascade/BRepCheck_Result.hxx b/opencascade/BRepCheck_Result.hxx index 022e0108e..0ae6c0ca2 100644 --- a/opencascade/BRepCheck_Result.hxx +++ b/opencascade/BRepCheck_Result.hxx @@ -19,12 +19,14 @@ #include -#include #include -#include -#include - -DEFINE_STANDARD_HANDLE(BRepCheck_Result, Standard_Transient) +#include +#include +#include +#include +#include +#include +#include class BRepCheck_Result : public Standard_Transient { @@ -40,30 +42,31 @@ public: Standard_EXPORT void SetFailStatus(const TopoDS_Shape& S); - const BRepCheck_ListOfStatus& Status() const { return *myMap(myShape); } + const NCollection_List& Status() const { return *myMap(myShape); } - Standard_Boolean IsMinimum() const { return myMin; } + bool IsMinimum() const { return myMin; } - Standard_Boolean IsBlind() const { return myBlind; } + bool IsBlind() const { return myBlind; } Standard_EXPORT void InitContextIterator(); - Standard_Boolean MoreShapeInContext() const { return myIter.More(); } + bool MoreShapeInContext() const { return myIter.More(); } const TopoDS_Shape& ContextualShape() const { return myIter.Key(); } - const BRepCheck_ListOfStatus& StatusOnShape() const { return *myIter.Value(); } + const NCollection_List& StatusOnShape() const { return *myIter.Value(); } Standard_EXPORT void NextShapeInContext(); - Standard_EXPORT void SetParallel(Standard_Boolean theIsParallel); + //! Sets the parallel execution flag for sub-algorithms. + void SetParallel(const bool theIsParallel) { myIsParallel = theIsParallel; } - Standard_Boolean IsStatusOnShape(const TopoDS_Shape& theShape) const - { - return myMap.IsBound(theShape); - } + //! Returns TRUE if sub-algorithms should use parallel execution. + bool IsParallel() const { return myIsParallel; } - const BRepCheck_ListOfStatus& StatusOnShape(const TopoDS_Shape& theShape) const + bool IsStatusOnShape(const TopoDS_Shape& theShape) const { return myMap.IsBound(theShape); } + + const NCollection_List& StatusOnShape(const TopoDS_Shape& theShape) const { return *myMap.Find(theShape); } @@ -76,17 +79,20 @@ protected: Standard_EXPORT BRepCheck_Result(); protected: - TopoDS_Shape myShape; - Standard_Boolean myMin; - Standard_Boolean myBlind; - BRepCheck_DataMapOfShapeListOfStatus myMap; - mutable Handle(Standard_HMutex) myMutex; - -private: - Standard_HMutex* GetMutex() { return myMutex.get(); } + TopoDS_Shape myShape; + bool myMin; + bool myBlind; + bool myIsParallel = false; + NCollection_DataMap>), + TopTools_ShapeMapHasher> + myMap; + mutable std::mutex myMutex; private: - BRepCheck_DataMapIteratorOfDataMapOfShapeListOfStatus myIter; + NCollection_DataMap>), + TopTools_ShapeMapHasher>::Iterator myIter; }; #endif // _BRepCheck_Result_HeaderFile diff --git a/opencascade/BRepCheck_Shell.hxx b/opencascade/BRepCheck_Shell.hxx index e10fb86b3..c005a3376 100644 --- a/opencascade/BRepCheck_Shell.hxx +++ b/opencascade/BRepCheck_Shell.hxx @@ -20,55 +20,54 @@ #include #include -#include +#include +#include +#include +#include #include -#include class TopoDS_Shell; class TopoDS_Shape; -class BRepCheck_Shell; -DEFINE_STANDARD_HANDLE(BRepCheck_Shell, BRepCheck_Result) - class BRepCheck_Shell : public BRepCheck_Result { public: Standard_EXPORT BRepCheck_Shell(const TopoDS_Shell& S); - Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) override; - Standard_EXPORT void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; - Standard_EXPORT void Blind() Standard_OVERRIDE; + Standard_EXPORT void Blind() override; - //! Checks if the oriented faces of the shell give a - //! closed shell. If the wire is closed, returns - //! BRepCheck_NoError.If is set to - //! Standard_True, registers the status in the list. - Standard_EXPORT BRepCheck_Status Closed(const Standard_Boolean Update = Standard_False); + //! Checks if the oriented faces of the shell give a + //! closed shell. If the wire is closed, returns + //! BRepCheck_NoError. If is set to + //! true, registers the status in the list. + Standard_EXPORT BRepCheck_Status Closed(const bool Update = false); - //! Checks if the oriented faces of the shell are - //! correctly oriented. An internal call is made to - //! the method Closed. If is set to - //! Standard_True, registers the status in the list. - Standard_EXPORT BRepCheck_Status Orientation(const Standard_Boolean Update = Standard_False); + //! Checks if the oriented faces of the shell are + //! correctly oriented. An internal call is made to + //! the method Closed. If is set to + //! true, registers the status in the list. + Standard_EXPORT BRepCheck_Status Orientation(const bool Update = false); Standard_EXPORT void SetUnorientable(); - Standard_EXPORT Standard_Boolean IsUnorientable() const; + Standard_EXPORT bool IsUnorientable() const; - Standard_EXPORT Standard_Integer NbConnectedSet(TopTools_ListOfShape& theSets); + Standard_EXPORT int NbConnectedSet(NCollection_List& theSets); DEFINE_STANDARD_RTTIEXT(BRepCheck_Shell, BRepCheck_Result) -protected: private: - Standard_Integer myNbori; - Standard_Boolean myCdone; - BRepCheck_Status myCstat; - Standard_Boolean myOdone; - BRepCheck_Status myOstat; - TopTools_IndexedDataMapOfShapeListOfShape myMapEF; + int myNbori; + bool myCdone; + BRepCheck_Status myCstat; + bool myOdone; + BRepCheck_Status myOstat; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myMapEF; }; #endif // _BRepCheck_Shell_HeaderFile diff --git a/opencascade/BRepCheck_Solid.hxx b/opencascade/BRepCheck_Solid.hxx index d07877088..882ea9f24 100644 --- a/opencascade/BRepCheck_Solid.hxx +++ b/opencascade/BRepCheck_Solid.hxx @@ -22,9 +22,6 @@ class TopoDS_Solid; class TopoDS_Shape; -class BRepCheck_Solid; -DEFINE_STANDARD_HANDLE(BRepCheck_Solid, BRepCheck_Result) - //! The class is to check a solid. class BRepCheck_Solid : public BRepCheck_Result { @@ -36,7 +33,7 @@ public: //! Checks the solid in context of //! the shape - Standard_EXPORT virtual void InContext(const TopoDS_Shape& theContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& theContextShape) override; //! Checks the solid per se. //! @@ -49,22 +46,19 @@ public: //! Status: BRepCheck_BadOrientationOfSubshape //! //! 3. For closed, non-internal shells: - //! 3.1 Shells containing entities of the solid that + //! 3.1 Shells containing entities of the solid that //! are outside towards the shells //! Status: BRepCheck_SubshapeNotInShape //! //! 3.2 Shells that encloses other Shells //! (for non-holes) //! Status: BRepCheck_EnclosedRegion - Standard_EXPORT virtual void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; //! see the parent class for more details - Standard_EXPORT virtual void Blind() Standard_OVERRIDE; + Standard_EXPORT void Blind() override; DEFINE_STANDARD_RTTIEXT(BRepCheck_Solid, BRepCheck_Result) - -protected: -private: }; #endif // _BRepCheck_Solid_HeaderFile diff --git a/opencascade/BRepCheck_Vertex.hxx b/opencascade/BRepCheck_Vertex.hxx index 25195c22c..013e61342 100644 --- a/opencascade/BRepCheck_Vertex.hxx +++ b/opencascade/BRepCheck_Vertex.hxx @@ -24,27 +24,21 @@ class TopoDS_Vertex; class TopoDS_Shape; -class BRepCheck_Vertex; -DEFINE_STANDARD_HANDLE(BRepCheck_Vertex, BRepCheck_Result) - class BRepCheck_Vertex : public BRepCheck_Result { public: Standard_EXPORT BRepCheck_Vertex(const TopoDS_Vertex& V); - Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) override; - Standard_EXPORT void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; - Standard_EXPORT void Blind() Standard_OVERRIDE; + Standard_EXPORT void Blind() override; - Standard_EXPORT Standard_Real Tolerance(); + Standard_EXPORT double Tolerance(); DEFINE_STANDARD_RTTIEXT(BRepCheck_Vertex, BRepCheck_Result) - -protected: -private: }; #endif // _BRepCheck_Vertex_HeaderFile diff --git a/opencascade/BRepCheck_Wire.hxx b/opencascade/BRepCheck_Wire.hxx index 500acde92..c5f0f30f4 100644 --- a/opencascade/BRepCheck_Wire.hxx +++ b/opencascade/BRepCheck_Wire.hxx @@ -21,104 +21,102 @@ #include #include -#include +#include +#include +#include +#include #include class TopoDS_Wire; class TopoDS_Shape; class TopoDS_Face; class TopoDS_Edge; -class BRepCheck_Wire; -DEFINE_STANDARD_HANDLE(BRepCheck_Wire, BRepCheck_Result) - class BRepCheck_Wire : public BRepCheck_Result { public: Standard_EXPORT BRepCheck_Wire(const TopoDS_Wire& W); - //! if is a face, consequently checks - //! SelfIntersect(), Closed(), Orientation() and + //! if is a face, consequently checks + //! SelfIntersect(), Closed(), Orientation() and //! Closed2d until faulty is found - Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) Standard_OVERRIDE; + Standard_EXPORT void InContext(const TopoDS_Shape& ContextShape) override; - //! checks that the wire is not empty and "connex". + //! checks that the wire is not empty and "connex". //! Called by constructor - Standard_EXPORT void Minimum() Standard_OVERRIDE; + Standard_EXPORT void Minimum() override; //! Does nothing - Standard_EXPORT void Blind() Standard_OVERRIDE; - - //! Checks if the oriented edges of the wire give a - //! closed wire. If the wire is closed, returns - //! BRepCheck_NoError. Warning : if the first and - //! last edge are infinite, the wire will be - //! considered as a closed one. If is set to - //! Standard_True, registers the status in the list. + Standard_EXPORT void Blind() override; + + //! Checks if the oriented edges of the wire give a + //! closed wire. If the wire is closed, returns + //! BRepCheck_NoError. Warning: if the first and + //! last edge are infinite, the wire will be + //! considered as a closed one. If is set to + //! true, registers the status in the list. //! May return (and registers): - //! **BRepCheck_NotConnected, if wire is not + //! **BRepCheck_NotConnected, if wire is not //! topologically closed - //! **BRepCheck_RedundantEdge, if an edge is in wire - //! more than 3 times or in case of 2 occurrences if + //! **BRepCheck_RedundantEdge, if an edge is in wire + //! more than 3 times or in case of 2 occurrences if //! not with FORWARD and REVERSED orientation. //! **BRepCheck_NoError - Standard_EXPORT BRepCheck_Status Closed(const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status Closed(const bool Update = false); - //! Checks if edges of the wire give a wire closed in + //! Checks if edges of the wire give a wire closed in //! 2d space. - //! Returns BRepCheck_NoError, or BRepCheck_NotClosed - //! If is set to Standard_True, registers the + //! Returns BRepCheck_NoError, or BRepCheck_NotClosed + //! If is set to true, registers the //! status in the list. - Standard_EXPORT BRepCheck_Status Closed2d(const TopoDS_Face& F, - const Standard_Boolean Update = Standard_False); - - //! Checks if the oriented edges of the wire are - //! correctly oriented. An internal call is made to - //! the method Closed. If no face exists, call the - //! method with a null face (TopoDS_face()). If - //! is set to Standard_True, registers the + Standard_EXPORT BRepCheck_Status Closed2d(const TopoDS_Face& F, const bool Update = false); + + //! Checks if the oriented edges of the wire are + //! correctly oriented. An internal call is made to + //! the method Closed. If no face exists, call the + //! method with a null face (TopoDS_face()). If + //! is set to true, registers the //! status in the list. //! May return (and registers): //! BRepCheck_InvalidDegeneratedFlag, //! BRepCheck_BadOrientationOfSubshape, //! BRepCheck_NotClosed, //! BRepCheck_NoError - Standard_EXPORT BRepCheck_Status Orientation(const TopoDS_Face& F, - const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status Orientation(const TopoDS_Face& F, const bool Update = false); - //! Checks if the wire intersect itself on the face - //! . and are the first intersecting - //! edges found. may be a null edge when a + //! Checks if the wire intersect itself on the face + //! . and are the first intersecting + //! edges found. may be a null edge when a //! self-intersecting edge is found.If is set - //! to Standard_True, registers the status in the + //! to true, registers the status in the //! list. //! May return (and register): //! BRepCheck_EmptyWire, //! BRepCheck_SelfIntersectingWire, //! BRepCheck_NoCurveOnSurface, //! BRepCheck_NoError - Standard_EXPORT BRepCheck_Status SelfIntersect(const TopoDS_Face& F, - TopoDS_Edge& E1, - TopoDS_Edge& E2, - const Standard_Boolean Update = Standard_False); + Standard_EXPORT BRepCheck_Status SelfIntersect(const TopoDS_Face& F, + TopoDS_Edge& E1, + TopoDS_Edge& E2, + const bool Update = false); //! report SelfIntersect() check would be (is) done - Standard_EXPORT Standard_Boolean GeometricControls() const; + Standard_EXPORT bool GeometricControls() const; //! set SelfIntersect() to be checked - Standard_EXPORT void GeometricControls(const Standard_Boolean B); + Standard_EXPORT void GeometricControls(const bool B); //! Sets status of Wire; Standard_EXPORT void SetStatus(const BRepCheck_Status theStatus); DEFINE_STANDARD_RTTIEXT(BRepCheck_Wire, BRepCheck_Result) -protected: private: - Standard_Boolean myCdone; - BRepCheck_Status myCstat; - TopTools_IndexedDataMapOfShapeListOfShape myMapVE; - Standard_Boolean myGctrl; + bool myCdone; + BRepCheck_Status myCstat; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myMapVE; + bool myGctrl; }; #endif // _BRepCheck_Wire_HeaderFile diff --git a/opencascade/BRepClass3d_BndBoxTree.hxx b/opencascade/BRepClass3d_BndBoxTree.hxx index 2edf4d473..d7e592be1 100644 --- a/opencascade/BRepClass3d_BndBoxTree.hxx +++ b/opencascade/BRepClass3d_BndBoxTree.hxx @@ -18,7 +18,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -27,74 +28,72 @@ #include // Typedef to reduce code complexity. -typedef NCollection_UBTree BRepClass3d_BndBoxTree; // Class representing tree selector for point object. -class BRepClass3d_BndBoxTreeSelectorPoint : public BRepClass3d_BndBoxTree::Selector +class BRepClass3d_BndBoxTreeSelectorPoint : public NCollection_UBTree::Selector { public: - BRepClass3d_BndBoxTreeSelectorPoint(const TopTools_IndexedMapOfShape& theMapOfShape) - : BRepClass3d_BndBoxTreeSelectorPoint::Selector(), - myMapOfShape(theMapOfShape) + BRepClass3d_BndBoxTreeSelectorPoint( + const NCollection_IndexedMap& theMapOfShape) + : myMapOfShape(theMapOfShape) { } - Standard_Boolean Reject(const Bnd_Box& theBox) const { return (theBox.IsOut(myP)); } + bool Reject(const Bnd_Box& theBox) const override { return (theBox.IsOut(myP)); } - Standard_Boolean Accept(const Standard_Integer& theObj); + bool Accept(const int& theObj) override; // Sets current point for boxes-point collisions. void SetCurrentPoint(const gp_Pnt& theP) { myP = theP; } private: - BRepClass3d_BndBoxTreeSelectorPoint(const BRepClass3d_BndBoxTreeSelectorPoint&); - BRepClass3d_BndBoxTreeSelectorPoint& operator=(const BRepClass3d_BndBoxTreeSelectorPoint&); + BRepClass3d_BndBoxTreeSelectorPoint(const BRepClass3d_BndBoxTreeSelectorPoint&) = delete; + BRepClass3d_BndBoxTreeSelectorPoint& operator=(const BRepClass3d_BndBoxTreeSelectorPoint&) = + delete; private: - const TopTools_IndexedMapOfShape& myMapOfShape; // shapes (vertices + edges) - gp_Pnt myP; + const NCollection_IndexedMap& + myMapOfShape; // shapes (vertices + edges) + gp_Pnt myP; }; // Class representing tree selector for line object. -class BRepClass3d_BndBoxTreeSelectorLine : public BRepClass3d_BndBoxTree::Selector +class BRepClass3d_BndBoxTreeSelectorLine : public NCollection_UBTree::Selector { public: struct EdgeParam { - TopoDS_Edge myE; - Standard_Real myParam; // par on myE - Standard_Real myLParam; // par on line + TopoDS_Edge myE; + double myParam; // par on myE + double myLParam; // par on line }; struct VertParam { TopoDS_Vertex myV; - Standard_Real myLParam; // par on line + double myLParam; // par on line }; public: - BRepClass3d_BndBoxTreeSelectorLine(const TopTools_IndexedMapOfShape& theMapOfShape) - : BRepClass3d_BndBoxTreeSelectorLine::Selector(), - myMapOfShape(theMapOfShape), - myIsValid(Standard_True) + BRepClass3d_BndBoxTreeSelectorLine( + const NCollection_IndexedMap& theMapOfShape) + : myMapOfShape(theMapOfShape), + myIsValid(true) { } - Standard_Boolean Reject(const Bnd_Box& theBox) const { return (theBox.IsOut(myL)); } + bool Reject(const Bnd_Box& theBox) const override { return (theBox.IsOut(myL)); } - Standard_Boolean Accept(const Standard_Integer& theObj); + bool Accept(const int& theObj) override; // Sets current line for boxes-line collisions - void SetCurrentLine(const gp_Lin& theL, const Standard_Real theMaxParam) + void SetCurrentLine(const gp_Lin& theL, const double theMaxParam) { myL = theL; myLC.Load(new Geom_Line(theL), -Precision::PConfusion(), theMaxParam); } - void GetEdgeParam(const Standard_Integer i, - TopoDS_Edge& theOutE, - Standard_Real& theOutParam, - Standard_Real& outLParam) const + void GetEdgeParam(const int i, TopoDS_Edge& theOutE, double& theOutParam, double& outLParam) const { const EdgeParam& EP = myEP.Value(i); theOutE = EP.myE; @@ -102,40 +101,39 @@ public: outLParam = EP.myLParam; } - void GetVertParam(const Standard_Integer i, - TopoDS_Vertex& theOutV, - Standard_Real& outLParam) const + void GetVertParam(const int i, TopoDS_Vertex& theOutV, double& outLParam) const { const VertParam& VP = myVP.Value(i); theOutV = VP.myV; outLParam = VP.myLParam; } - Standard_Integer GetNbEdgeParam() const { return myEP.Length(); } + int GetNbEdgeParam() const { return myEP.Length(); } - Standard_Integer GetNbVertParam() const { return myVP.Length(); } + int GetNbVertParam() const { return myVP.Length(); } void ClearResults() { myEP.Clear(); myVP.Clear(); - myIsValid = Standard_True; + myIsValid = true; } //! Returns TRUE if correct classification is possible - Standard_Boolean IsCorrect() const { return myIsValid; } + bool IsCorrect() const { return myIsValid; } private: - BRepClass3d_BndBoxTreeSelectorLine(const BRepClass3d_BndBoxTreeSelectorLine&); - BRepClass3d_BndBoxTreeSelectorLine& operator=(const BRepClass3d_BndBoxTreeSelectorLine&); + BRepClass3d_BndBoxTreeSelectorLine(const BRepClass3d_BndBoxTreeSelectorLine&) = delete; + BRepClass3d_BndBoxTreeSelectorLine& operator=(const BRepClass3d_BndBoxTreeSelectorLine&) = delete; private: - const TopTools_IndexedMapOfShape& myMapOfShape; // shapes (vertices + edges) - gp_Lin myL; - NCollection_Sequence myEP; // output result (edge vs line) - NCollection_Sequence myVP; // output result (vertex vs line) - GeomAdaptor_Curve myLC; - Standard_Boolean myIsValid; + const NCollection_IndexedMap& + myMapOfShape; // shapes (vertices + edges) + gp_Lin myL; + NCollection_Sequence myEP; // output result (edge vs line) + NCollection_Sequence myVP; // output result (vertex vs line) + GeomAdaptor_Curve myLC; + bool myIsValid; }; #endif diff --git a/opencascade/BRepClass3d_DataMapIteratorOfMapOfInter.hxx b/opencascade/BRepClass3d_DataMapIteratorOfMapOfInter.hxx deleted file mode 100644 index eaea926ac..000000000 --- a/opencascade/BRepClass3d_DataMapIteratorOfMapOfInter.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepClass3d_DataMapIteratorOfMapOfInter_HeaderFile -#define BRepClass3d_DataMapIteratorOfMapOfInter_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepClass3d_Intersector3d.hxx b/opencascade/BRepClass3d_Intersector3d.hxx index 970b9993b..15387c91e 100644 --- a/opencascade/BRepClass3d_Intersector3d.hxx +++ b/opencascade/BRepClass3d_Intersector3d.hxx @@ -44,28 +44,28 @@ public: //! first point of the segment is near the face. In //! that case, the parameter of the intersection point //! on the line can be a negative value (greater than -Tol). - Standard_EXPORT void Perform(const gp_Lin& L, - const Standard_Real Prm, - const Standard_Real Tol, - const TopoDS_Face& F); + Standard_EXPORT void Perform(const gp_Lin& L, + const double Prm, + const double Tol, + const TopoDS_Face& F); //! True is returned when the intersection have been computed. - Standard_Boolean IsDone() const; + bool IsDone() const; //! True is returned if a point has been found. - Standard_Boolean HasAPoint() const; + bool HasAPoint() const; //! Returns the U parameter of the intersection point //! on the surface. - Standard_Real UParameter() const; + double UParameter() const; //! Returns the V parameter of the intersection point //! on the surface. - Standard_Real VParameter() const; + double VParameter() const; //! Returns the parameter of the intersection point //! on the line. - Standard_Real WParameter() const; + double WParameter() const; //! Returns the geometric point of the intersection //! between the line and the surface. @@ -85,15 +85,14 @@ public: //! the intersection. const TopoDS_Face& Face() const; -protected: private: gp_Pnt pnt; - Standard_Real U; - Standard_Real V; - Standard_Real W; + double U; + double V; + double W; IntCurveSurface_TransitionOnCurve transition; - Standard_Boolean done; - Standard_Boolean hasapoint; + bool done; + bool hasapoint; TopAbs_State state; TopoDS_Face face; }; diff --git a/opencascade/BRepClass3d_Intersector3d.lxx b/opencascade/BRepClass3d_Intersector3d.lxx index 6dcfcc924..a4e43b9af 100644 --- a/opencascade/BRepClass3d_Intersector3d.lxx +++ b/opencascade/BRepClass3d_Intersector3d.lxx @@ -15,13 +15,13 @@ // commercial license or contractual agreement. //============================================================================ -inline Standard_Boolean BRepClass3d_Intersector3d::IsDone() const +inline bool BRepClass3d_Intersector3d::IsDone() const { return (done); } //============================================================================ -inline Standard_Boolean BRepClass3d_Intersector3d::HasAPoint() const +inline bool BRepClass3d_Intersector3d::HasAPoint() const { return (hasapoint); } @@ -33,19 +33,19 @@ inline const gp_Pnt& BRepClass3d_Intersector3d::Pnt() const } //============================================================================ -inline Standard_Real BRepClass3d_Intersector3d::UParameter() const +inline double BRepClass3d_Intersector3d::UParameter() const { return (U); } //============================================================================ -inline Standard_Real BRepClass3d_Intersector3d::VParameter() const +inline double BRepClass3d_Intersector3d::VParameter() const { return (V); } //============================================================================ -inline Standard_Real BRepClass3d_Intersector3d::WParameter() const +inline double BRepClass3d_Intersector3d::WParameter() const { return (W); } diff --git a/opencascade/BRepClass3d_MapOfInter.hxx b/opencascade/BRepClass3d_MapOfInter.hxx index 1a9467734..820bca441 100644 --- a/opencascade/BRepClass3d_MapOfInter.hxx +++ b/opencascade/BRepClass3d_MapOfInter.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-04-18 -// Created by: Laurent BUCHARD -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,16 +11,29 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepClass3d_MapOfInter_HeaderFile -#define BRepClass3d_MapOfInter_HeaderFile +//! @file BRepClass3d_MapOfInter.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepClass3d_MapOfInter_hxx +#define _BRepClass3d_MapOfInter_hxx + +#include #include #include #include -typedef NCollection_DataMap - BRepClass3d_MapOfInter; -typedef NCollection_DataMap::Iterator +Standard_HEADER_DEPRECATED( + "BRepClass3d_MapOfInter.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BRepClass3d_MapOfInter is deprecated, use NCollection_DataMap directly") +typedef NCollection_DataMap BRepClass3d_MapOfInter; +Standard_DEPRECATED( + "BRepClass3d_DataMapIteratorOfMapOfInter is deprecated, use NCollection_DataMap::Iterator directly") +typedef NCollection_DataMap::Iterator BRepClass3d_DataMapIteratorOfMapOfInter; -#endif +#endif // _BRepClass3d_MapOfInter_hxx diff --git a/opencascade/BRepClass3d_SClassifier.hxx b/opencascade/BRepClass3d_SClassifier.hxx index a4cdeb3c6..e10ca8786 100644 --- a/opencascade/BRepClass3d_SClassifier.hxx +++ b/opencascade/BRepClass3d_SClassifier.hxx @@ -39,28 +39,26 @@ public: //! tolerance Tol on the solid S. Standard_EXPORT BRepClass3d_SClassifier(BRepClass3d_SolidExplorer& S, const gp_Pnt& P, - const Standard_Real Tol); + const double Tol); //! Classify the point P with the //! tolerance Tol on the solid S. - Standard_EXPORT void Perform(BRepClass3d_SolidExplorer& S, - const gp_Pnt& P, - const Standard_Real Tol); + Standard_EXPORT void Perform(BRepClass3d_SolidExplorer& S, const gp_Pnt& P, const double Tol); //! Classify an infinite point with the //! tolerance Tol on the solid S. - Standard_EXPORT void PerformInfinitePoint(BRepClass3d_SolidExplorer& S, const Standard_Real Tol); + Standard_EXPORT void PerformInfinitePoint(BRepClass3d_SolidExplorer& S, const double Tol); //! Returns True if the classification has been //! computed by rejection. //! The State is then OUT. - Standard_EXPORT Standard_Boolean Rejected() const; + Standard_EXPORT bool Rejected() const; //! Returns the result of the classification. Standard_EXPORT TopAbs_State State() const; //! Returns True when the point is a point of a face. - Standard_EXPORT Standard_Boolean IsOnAFace() const; + Standard_EXPORT bool IsOnAFace() const; //! Returns the face used to determine the //! classification. When the state is ON, this is the @@ -84,7 +82,7 @@ private: //! 2 - ON. //! 3 - IN. //! 4 - OUT. - Standard_Integer myState; + int myState; }; #endif // _BRepClass3d_SClassifier_HeaderFile diff --git a/opencascade/BRepClass3d_SolidClassifier.hxx b/opencascade/BRepClass3d_SolidClassifier.hxx index 324a18c3f..15e47d5f6 100644 --- a/opencascade/BRepClass3d_SolidClassifier.hxx +++ b/opencascade/BRepClass3d_SolidClassifier.hxx @@ -44,26 +44,25 @@ public: //! tolerance Tol on the solid S. Standard_EXPORT BRepClass3d_SolidClassifier(const TopoDS_Shape& S, const gp_Pnt& P, - const Standard_Real Tol); + const double Tol); //! Classify the point P with the //! tolerance Tol on the solid S. - Standard_EXPORT void Perform(const gp_Pnt& P, const Standard_Real Tol); + Standard_EXPORT void Perform(const gp_Pnt& P, const double Tol); //! Classify an infinite point with the //! tolerance Tol on the solid S. //! Useful for compute the orientation of a solid. - Standard_EXPORT void PerformInfinitePoint(const Standard_Real Tol); + Standard_EXPORT void PerformInfinitePoint(const double Tol); Standard_EXPORT void Destroy(); ~BRepClass3d_SolidClassifier() { Destroy(); } -protected: private: - Standard_Boolean aSolidLoaded; + bool aSolidLoaded; BRepClass3d_SolidExplorer explorer; - Standard_Boolean isaholeinspace; + bool isaholeinspace; }; #endif // _BRepClass3d_SolidClassifier_HeaderFile diff --git a/opencascade/BRepClass3d_SolidExplorer.hxx b/opencascade/BRepClass3d_SolidExplorer.hxx index d47510a6e..ff3de9174 100644 --- a/opencascade/BRepClass3d_SolidExplorer.hxx +++ b/opencascade/BRepClass3d_SolidExplorer.hxx @@ -17,14 +17,14 @@ #ifndef _BRepClass3d_SolidExplorer_HeaderFile #define _BRepClass3d_SolidExplorer_HeaderFile -#include #include #include -#include +#include +#include +#include #include #include -#include -#include +#include class gp_Pnt; class TopoDS_Face; @@ -49,80 +49,76 @@ public: Standard_EXPORT void InitShape(const TopoDS_Shape& S); //! Should return True if P outside of bounding vol. of the shape - Standard_EXPORT virtual Standard_Boolean Reject(const gp_Pnt& P) const; + Standard_EXPORT virtual bool Reject(const gp_Pnt& P) const; - //! compute a point P in the face F. Param is a Real in - //! ]0,1[ and is used to initialise the algorithm. For + //! compute a point P in the face F. Param is a Real in + //! ]0,1[ and is used to initialise the algorithm. For //! different values , different points are returned. - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& Param); - - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& u, - Standard_Real& v, - Standard_Real& Param); - - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& u, - Standard_Real& v, - Standard_Real& Param, - gp_Vec& theVecD1U, - gp_Vec& theVecD1V); - - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& u, - Standard_Real& v); - - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, gp_Pnt& P); - - Standard_EXPORT static Standard_Boolean FindAPointInTheFace(const TopoDS_Face& F, - Standard_Real& u, - Standard_Real& v); - - Standard_EXPORT Standard_Boolean PointInTheFace(const TopoDS_Face& F, + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, gp_Pnt& P, double& Param); + + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, + gp_Pnt& P, + double& u, + double& v, + double& Param); + + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, + gp_Pnt& P, + double& u, + double& v, + double& Param, + gp_Vec& theVecD1U, + gp_Vec& theVecD1V); + + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, gp_Pnt& P, - Standard_Real& u, - Standard_Real& v, - Standard_Real& Param, - Standard_Integer& Index) const; - - Standard_EXPORT Standard_Boolean PointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& u, - Standard_Real& v, - Standard_Real& Param, - Standard_Integer& Index, - const Handle(BRepAdaptor_Surface)& surf, - const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2) const; - - //! gives point index to search from and returns + double& u, + double& v); + + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, gp_Pnt& P); + + Standard_EXPORT static bool FindAPointInTheFace(const TopoDS_Face& F, double& u, double& v); + + Standard_EXPORT bool PointInTheFace(const TopoDS_Face& F, + gp_Pnt& P, + double& u, + double& v, + double& Param, + int& Index) const; + + Standard_EXPORT bool PointInTheFace(const TopoDS_Face& F, + gp_Pnt& P, + double& u, + double& v, + double& Param, + int& Index, + const occ::handle& surf, + const double u1, + const double v1, + const double u2, + const double v2) const; + + //! gives point index to search from and returns //! point index of succeseful search - Standard_EXPORT Standard_Boolean PointInTheFace(const TopoDS_Face& F, - gp_Pnt& P, - Standard_Real& u, - Standard_Real& v, - Standard_Real& Param, - Standard_Integer& Index, - const Handle(BRepAdaptor_Surface)& surf, - const Standard_Real u1, - const Standard_Real v1, - const Standard_Real u2, - const Standard_Real v2, - gp_Vec& theVecD1U, - gp_Vec& theVecD1V) const; + Standard_EXPORT bool PointInTheFace(const TopoDS_Face& F, + gp_Pnt& P, + double& u, + double& v, + double& Param, + int& Index, + const occ::handle& surf, + const double u1, + const double v1, + const double u2, + const double v2, + gp_Vec& theVecD1U, + gp_Vec& theVecD1V) const; //! Starts an exploration of the shells. Standard_EXPORT void InitShell(); //! Returns True if there is a current shell. - Standard_EXPORT Standard_Boolean MoreShell() const; + Standard_EXPORT bool MoreShell() const; //! Sets the explorer to the next shell. Standard_EXPORT void NextShell(); @@ -131,13 +127,13 @@ public: Standard_EXPORT TopoDS_Shell CurrentShell() const; //! Returns True if the Shell is rejected. - Standard_EXPORT virtual Standard_Boolean RejectShell(const gp_Lin& L) const; + Standard_EXPORT virtual bool RejectShell(const gp_Lin& L) const; //! Starts an exploration of the faces of the current shell. Standard_EXPORT void InitFace(); //! Returns True if current face in current shell. - Standard_EXPORT Standard_Boolean MoreFace() const; + Standard_EXPORT bool MoreFace() const; //! Sets the explorer to the next Face of the current shell. Standard_EXPORT void NextFace(); @@ -146,65 +142,65 @@ public: Standard_EXPORT TopoDS_Face CurrentFace() const; //! returns True if the face is rejected. - Standard_EXPORT virtual Standard_Boolean RejectFace(const gp_Lin& L) const; + Standard_EXPORT virtual bool RejectFace(const gp_Lin& L) const; - //! Returns in , a segment having at least - //! one intersection with the shape boundary to - //! compute intersections. - Standard_EXPORT Standard_Integer Segment(const gp_Pnt& P, gp_Lin& L, Standard_Real& Par); + //! Returns in , a segment having at least + //! one intersection with the shape boundary to + //! compute intersections. + Standard_EXPORT int Segment(const gp_Pnt& P, gp_Lin& L, double& Par); - //! Returns in , a segment having at least - //! one intersection with the shape boundary to - //! compute intersections. + //! Returns in , a segment having at least + //! one intersection with the shape boundary to + //! compute intersections. //! //! The First Call to this method returns a line which //! point to a point of the first face of the shape. //! The Second Call provide a line to the second face //! and so on. - Standard_EXPORT Standard_Integer OtherSegment(const gp_Pnt& P, gp_Lin& L, Standard_Real& Par); + Standard_EXPORT int OtherSegment(const gp_Pnt& P, gp_Lin& L, double& Par); //! Returns the index of face for which //! last segment is calculated. - Standard_EXPORT Standard_Integer GetFaceSegmentIndex() const; - - Standard_EXPORT virtual void DumpSegment(const gp_Pnt& P, - const gp_Lin& L, - const Standard_Real Par, - const TopAbs_State S) const; + Standard_EXPORT int GetFaceSegmentIndex() const; - Standard_EXPORT const Bnd_Box& Box() const; + Standard_EXPORT virtual void DumpSegment(const gp_Pnt& P, + const gp_Lin& L, + const double Par, + const TopAbs_State S) const; Standard_EXPORT const TopoDS_Shape& GetShape() const; Standard_EXPORT IntCurvesFace_Intersector& Intersector(const TopoDS_Face& F) const; //! Return UB-tree instance which is used for edge / vertex checks. - const BRepClass3d_BndBoxTree& GetTree() { return myTree; } + const NCollection_UBTree& GetTree() { return myTree; } //! Return edge/vertices map for current shape. - const TopTools_IndexedMapOfShape& GetMapEV() { return myMapEV; } + const NCollection_IndexedMap& GetMapEV() + { + return myMapEV; + } Standard_EXPORT void Destroy(); private: - Standard_EXPORT BRepClass3d_SolidExplorer(const BRepClass3d_SolidExplorer& Oth); + BRepClass3d_SolidExplorer(const BRepClass3d_SolidExplorer& Oth) = delete; protected: - Standard_EXPORT TopAbs_State ClassifyUVPoint(const IntCurvesFace_Intersector& theIntersector, - const Handle(BRepAdaptor_Surface)& theSurf, - const gp_Pnt2d& theP2d) const; + Standard_EXPORT TopAbs_State ClassifyUVPoint(const IntCurvesFace_Intersector& theIntersector, + const occ::handle& theSurf, + const gp_Pnt2d& theP2d) const; private: - Bnd_Box myBox; - TopoDS_Shape myShape; - Standard_Boolean myReject; - Standard_Integer myFirstFace; - Standard_Real myParamOnEdge; - TopExp_Explorer myShellExplorer; - TopExp_Explorer myFaceExplorer; - BRepClass3d_MapOfInter myMapOfInter; - BRepClass3d_BndBoxTree myTree; - TopTools_IndexedMapOfShape myMapEV; + TopoDS_Shape myShape; + bool myReject; + int myFirstFace; + double myParamOnEdge; + TopExp_Explorer myShellExplorer; + TopExp_Explorer myFaceExplorer; + NCollection_DataMap myMapOfInter; + NCollection_UBTree myTree; + NCollection_IndexedMap myMapEV; }; #endif // _BRepClass3d_SolidExplorer_HeaderFile diff --git a/opencascade/BRepClass3d_SolidPassiveClassifier.hxx b/opencascade/BRepClass3d_SolidPassiveClassifier.hxx index 0698c411f..b345f8298 100644 --- a/opencascade/BRepClass3d_SolidPassiveClassifier.hxx +++ b/opencascade/BRepClass3d_SolidPassiveClassifier.hxx @@ -38,22 +38,22 @@ public: //! Creates an undefined classifier. Standard_EXPORT BRepClass3d_SolidPassiveClassifier(); - //! Starts a classification process. The point to - //! classify is the origin of the line .

is - //! the original length of the segment on used to - //! compute intersections. is the tolerance + //! Starts a classification process. The point to + //! classify is the origin of the line .

is + //! the original length of the segment on used to + //! compute intersections. is the tolerance //! attached to the intersections. - Standard_EXPORT void Reset(const gp_Lin& L, const Standard_Real P, const Standard_Real Tol); + Standard_EXPORT void Reset(const gp_Lin& L, const double P, const double Tol); - //! Updates the classification process with the face + //! Updates the classification process with the face //! from the boundary. Standard_EXPORT void Compare(const TopoDS_Face& F, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - Standard_Real Parameter() const { return myParam; } + double Parameter() const { return myParam; } //! Returns True if an intersection is computed. - Standard_Boolean HasIntersection() const { return hasIntersect; } + bool HasIntersection() const { return hasIntersect; } //! Returns the intersecting algorithm. BRepClass3d_Intersector3d& Intersector() { return myIntersector; } @@ -62,13 +62,13 @@ public: TopAbs_State State() const { return myState; } private: - Standard_Boolean isSet; + bool isSet; TopoDS_Face myFace; gp_Lin myLin; - Standard_Real myParam; - Standard_Real myTolerance; + double myParam; + double myTolerance; TopAbs_State myState; - Standard_Boolean hasIntersect; + bool hasIntersect; BRepClass3d_Intersector3d myIntersector; }; diff --git a/opencascade/BRepClass_Edge.hxx b/opencascade/BRepClass_Edge.hxx index 4da864cea..1f54e6e78 100644 --- a/opencascade/BRepClass_Edge.hxx +++ b/opencascade/BRepClass_Edge.hxx @@ -20,13 +20,16 @@ #include #include #include -#include +#include +#include +#include +#include #include #include -//! This class is used to send the description of an -//! Edge to the classifier. It contains an Edge and a +//! This class is used to send the description of an +//! Edge to the classifier. It contains an Edge and a //! Face. So the PCurve of the Edge can be found. class BRepClass_Edge { @@ -38,43 +41,45 @@ public: Standard_EXPORT BRepClass_Edge(const TopoDS_Edge& E, const TopoDS_Face& F); //! Returns the current Edge - TopoDS_Edge& Edge(); - const TopoDS_Edge& Edge() const; + TopoDS_Edge& Edge() { return myEdge; } + + const TopoDS_Edge& Edge() const { return myEdge; } //! Returns the Face for the current Edge - TopoDS_Face& Face(); - const TopoDS_Face& Face() const; + TopoDS_Face& Face() { return myFace; } + + const TopoDS_Face& Face() const { return myFace; } //! Returns the next Edge const TopoDS_Edge& NextEdge() const { return myNextEdge; } //! Finds and sets the next Edge for the current - Standard_EXPORT void SetNextEdge(const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE); + Standard_EXPORT void SetNextEdge( + const NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>& theMapVE); //! Returns the maximum tolerance - Standard_Real MaxTolerance() const { return myMaxTolerance; } + double MaxTolerance() const { return myMaxTolerance; } //! Sets the maximum tolerance at //! which to start checking in the intersector - void SetMaxTolerance(const Standard_Real theValue) { myMaxTolerance = theValue; } + void SetMaxTolerance(const double theValue) { myMaxTolerance = theValue; } //! Returns true if we are using boxes //! in the intersector - Standard_Boolean UseBndBox() const { return myUseBndBox; } + bool UseBndBox() const { return myUseBndBox; } //! Sets the status of whether we are //! using boxes or not - void SetUseBndBox(const Standard_Boolean theValue) { myUseBndBox = theValue; } + void SetUseBndBox(const bool theValue) { myUseBndBox = theValue; } -protected: private: - TopoDS_Edge myEdge; - TopoDS_Face myFace; - TopoDS_Edge myNextEdge; - Standard_Real myMaxTolerance; - Standard_Boolean myUseBndBox; + TopoDS_Edge myEdge; + TopoDS_Face myFace; + TopoDS_Edge myNextEdge; + double myMaxTolerance; + bool myUseBndBox; }; -#include - #endif // _BRepClass_Edge_HeaderFile diff --git a/opencascade/BRepClass_Edge.lxx b/opencascade/BRepClass_Edge.lxx deleted file mode 100644 index f4a975680..000000000 --- a/opencascade/BRepClass_Edge.lxx +++ /dev/null @@ -1,55 +0,0 @@ -// Created on: 1992-11-19 -// Created by: Remi LEQUETTE -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//======================================================================= -// function : Edge -// purpose : -//======================================================================= - -inline TopoDS_Edge& BRepClass_Edge::Edge() -{ - return myEdge; -} - -//======================================================================= -// function : Edge -// purpose : -//======================================================================= - -inline const TopoDS_Edge& BRepClass_Edge::Edge() const -{ - return myEdge; -} - -//======================================================================= -// function : Face -// purpose : -//======================================================================= - -inline TopoDS_Face& BRepClass_Edge::Face() -{ - return myFace; -} - -//======================================================================= -// function : Face -// purpose : -//======================================================================= - -inline const TopoDS_Face& BRepClass_Edge::Face() const -{ - return myFace; -} diff --git a/opencascade/BRepClass_FClass2dOfFClassifier.hxx b/opencascade/BRepClass_FClass2dOfFClassifier.hxx index 3a0a7d6ef..3738f75ec 100644 --- a/opencascade/BRepClass_FClass2dOfFClassifier.hxx +++ b/opencascade/BRepClass_FClass2dOfFClassifier.hxx @@ -38,66 +38,49 @@ public: //! Creates an undefined classifier. Standard_EXPORT BRepClass_FClass2dOfFClassifier(); - //! Starts a classification process. The point to - //! classify is the origin of the line .

is - //! the original length of the segment on used to - //! compute intersections. is the tolerance + //! Starts a classification process. The point to + //! classify is the origin of the line .

is + //! the original length of the segment on used to + //! compute intersections. is the tolerance //! attached to the line segment in intersections. - Standard_EXPORT void Reset(const gp_Lin2d& L, const Standard_Real P, const Standard_Real Tol); + Standard_EXPORT void Reset(const gp_Lin2d& L, const double P, const double Tol); - //! Updates the classification process with the edge + //! Updates the classification process with the edge //! from the boundary. Standard_EXPORT void Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - Standard_Real Parameter() const; + double Parameter() const { return myParam; } //! Returns the intersecting algorithm. - BRepClass_Intersector& Intersector(); + BRepClass_Intersector& Intersector() { return myIntersector; } - //! Returns 0 if the last compared edge had no - //! relevant intersection. Else returns the index of - //! this intersection in the last intersection + //! Returns 0 if the last compared edge had no + //! relevant intersection. Else returns the index of + //! this intersection in the last intersection //! algorithm. - Standard_Integer ClosestIntersection() const; + int ClosestIntersection() const { return myClosest; } //! Returns the current state of the point. - TopAbs_State State() const; + TopAbs_State State() const { return myState; } - //! Returns the Standard_True if the closest intersection point - //! represents head or end of the edge. Returns Standard_False + //! Returns the true if the closest intersection point + //! represents head or end of the edge. Returns false //! otherwise. - Standard_Boolean IsHeadOrEnd() const; + bool IsHeadOrEnd() const { return myIsHeadOrEnd; } -protected: private: - Standard_Boolean myIsSet; - Standard_Boolean myFirstCompare; - Standard_Boolean myFirstTrans; + bool myIsSet; + bool myFirstCompare; + bool myFirstTrans; gp_Lin2d myLin; - Standard_Real myParam; - Standard_Real myTolerance; + double myParam; + double myTolerance; TopTrans_CurveTransition myTrans; BRepClass_Intersector myIntersector; - Standard_Integer myClosest; + int myClosest; TopAbs_State myState; - Standard_Boolean myIsHeadOrEnd; + bool myIsHeadOrEnd; }; -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FClass2dOfFClassifier -#define TopClass_Classifier2d_hxx - -#include - -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersector -#undef TheIntersector_hxx -#undef TopClass_Classifier2d -#undef TopClass_Classifier2d_hxx - #endif // _BRepClass_FClass2dOfFClassifier_HeaderFile diff --git a/opencascade/BRepClass_FClassifier.hxx b/opencascade/BRepClass_FClassifier.hxx index 9f5467198..7ff0d0b6b 100644 --- a/opencascade/BRepClass_FClassifier.hxx +++ b/opencascade/BRepClass_FClassifier.hxx @@ -39,75 +39,47 @@ public: //! Empty constructor, undefined algorithm. Standard_EXPORT BRepClass_FClassifier(); - //! Creates an algorithm to classify the Point P with + //! Creates an algorithm to classify the Point P with //! Tolerance on the face described by . Standard_EXPORT BRepClass_FClassifier(BRepClass_FaceExplorer& F, const gp_Pnt2d& P, - const Standard_Real Tol); + const double Tol); - //! Classify the Point P with Tolerance on the + //! Classify the Point P with Tolerance on the //! face described by . - Standard_EXPORT void Perform(BRepClass_FaceExplorer& F, - const gp_Pnt2d& P, - const Standard_Real Tol); + Standard_EXPORT void Perform(BRepClass_FaceExplorer& F, const gp_Pnt2d& P, const double Tol); //! Returns the result of the classification. Standard_EXPORT TopAbs_State State() const; - //! Returns True when the state was computed by a + //! Returns True when the state was computed by a //! rejection. The state is OUT. - Standard_Boolean Rejected() const; + bool Rejected() const { return rejected; } - //! Returns True if the face contains no wire. The + //! Returns True if the face contains no wire. The //! state is IN. - Standard_Boolean NoWires() const; + bool NoWires() const { return nowires; } - //! Returns the Edge used to determine the - //! classification. When the State is ON this is the + //! Returns the Edge used to determine the + //! classification. When the State is ON this is the //! Edge containing the point. Standard_EXPORT const BRepClass_Edge& Edge() const; - //! Returns the parameter on Edge() used to determine the + //! Returns the parameter on Edge() used to determine the //! classification. - Standard_EXPORT Standard_Real EdgeParameter() const; + Standard_EXPORT double EdgeParameter() const; - //! Returns the position of the point on the edge + //! Returns the position of the point on the edge //! returned by Edge. - IntRes2d_Position Position() const; + IntRes2d_Position Position() const { return myPosition; } protected: BRepClass_FClass2dOfFClassifier myClassifier; BRepClass_Edge myEdge; - Standard_Real myEdgeParameter; + double myEdgeParameter; IntRes2d_Position myPosition; - Standard_Boolean rejected; - Standard_Boolean nowires; - -private: + bool rejected; + bool nowires; }; -#define TheFaceExplorer BRepClass_FaceExplorer -#define TheFaceExplorer_hxx -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersection2d BRepClass_Intersector -#define TheIntersection2d_hxx -#define TopClass_FClass2d BRepClass_FClass2dOfFClassifier -#define TopClass_FClass2d_hxx -#define TopClass_FaceClassifier BRepClass_FClassifier -#define TopClass_FaceClassifier_hxx - -#include - -#undef TheFaceExplorer -#undef TheFaceExplorer_hxx -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersection2d -#undef TheIntersection2d_hxx -#undef TopClass_FClass2d -#undef TopClass_FClass2d_hxx -#undef TopClass_FaceClassifier -#undef TopClass_FaceClassifier_hxx - #endif // _BRepClass_FClassifier_HeaderFile diff --git a/opencascade/BRepClass_FaceClassifier.hxx b/opencascade/BRepClass_FaceClassifier.hxx index 443ed0886..cdd54cfc0 100644 --- a/opencascade/BRepClass_FaceClassifier.hxx +++ b/opencascade/BRepClass_FaceClassifier.hxx @@ -36,54 +36,51 @@ public: //! Empty constructor, undefined algorithm. Standard_EXPORT BRepClass_FaceClassifier(); - //! Creates an algorithm to classify the Point P with + //! Creates an algorithm to classify the Point P with //! Tolerance on the face described by . Standard_EXPORT BRepClass_FaceClassifier(BRepClass_FaceExplorer& F, const gp_Pnt2d& P, - const Standard_Real Tol); + const double Tol); - //! Creates an algorithm to classify the Point P with + //! Creates an algorithm to classify the Point P with //! Tolerance on the face . //! Recommended to use Bnd_Box if the number of edges > 10 //! and the geometry is mostly spline - Standard_EXPORT BRepClass_FaceClassifier(const TopoDS_Face& theF, - const gp_Pnt2d& theP, - const Standard_Real theTol, - const Standard_Boolean theUseBndBox = Standard_False, - const Standard_Real theGapCheckTol = 0.1); + Standard_EXPORT BRepClass_FaceClassifier(const TopoDS_Face& theF, + const gp_Pnt2d& theP, + const double theTol, + const bool theUseBndBox = false, + const double theGapCheckTol = 0.1); - //! Classify the Point P with Tolerance on the + //! Classify the Point P with Tolerance on the //! face described by . //! Recommended to use Bnd_Box if the number of edges > 10 //! and the geometry is mostly spline - Standard_EXPORT void Perform(const TopoDS_Face& theF, - const gp_Pnt2d& theP, - const Standard_Real theTol, - const Standard_Boolean theUseBndBox = Standard_False, - const Standard_Real theGapCheckTol = 0.1); + Standard_EXPORT void Perform(const TopoDS_Face& theF, + const gp_Pnt2d& theP, + const double theTol, + const bool theUseBndBox = false, + const double theGapCheckTol = 0.1); - //! Creates an algorithm to classify the Point P with + //! Creates an algorithm to classify the Point P with //! Tolerance on the face . //! Recommended to use Bnd_Box if the number of edges > 10 //! and the geometry is mostly spline - Standard_EXPORT BRepClass_FaceClassifier(const TopoDS_Face& theF, - const gp_Pnt& theP, - const Standard_Real theTol, - const Standard_Boolean theUseBndBox = Standard_False, - const Standard_Real theGapCheckTol = 0.1); + Standard_EXPORT BRepClass_FaceClassifier(const TopoDS_Face& theF, + const gp_Pnt& theP, + const double theTol, + const bool theUseBndBox = false, + const double theGapCheckTol = 0.1); - //! Classify the Point P with Tolerance on the + //! Classify the Point P with Tolerance on the //! face described by . //! Recommended to use Bnd_Box if the number of edges > 10 //! and the geometry is mostly spline - Standard_EXPORT void Perform(const TopoDS_Face& theF, - const gp_Pnt& theP, - const Standard_Real theTol, - const Standard_Boolean theUseBndBox = Standard_False, - const Standard_Real theGapCheckTol = 0.1); - -protected: -private: + Standard_EXPORT void Perform(const TopoDS_Face& theF, + const gp_Pnt& theP, + const double theTol, + const bool theUseBndBox = false, + const double theGapCheckTol = 0.1); }; #endif // _BRepClass_FaceClassifier_HeaderFile diff --git a/opencascade/BRepClass_FaceExplorer.hxx b/opencascade/BRepClass_FaceExplorer.hxx index 4866d7eb3..761f815e6 100644 --- a/opencascade/BRepClass_FaceExplorer.hxx +++ b/opencascade/BRepClass_FaceExplorer.hxx @@ -19,7 +19,10 @@ #include #include -#include +#include +#include +#include +#include #include #include @@ -29,7 +32,7 @@ class gp_Pnt2d; class gp_Lin2d; class BRepClass_Edge; -//! Provide an exploration of a BRep Face for the +//! Provide an exploration of a BRep Face for the //! classification. Return UV edges. class BRepClass_FaceExplorer { @@ -42,87 +45,86 @@ public: //! from the bounding box of the face. New Coordinates of the point //! will be on the line between the point and the center of the //! bounding box. Returns True if point was not changed. - Standard_EXPORT Standard_Boolean CheckPoint(gp_Pnt2d& thePoint); + Standard_EXPORT bool CheckPoint(gp_Pnt2d& thePoint); - //! Should return True if the point is outside a + //! Should return True if the point is outside a //! bounding volume of the face. - Standard_EXPORT Standard_Boolean Reject(const gp_Pnt2d& P) const; + Standard_EXPORT bool Reject(const gp_Pnt2d& P) const; - //! Returns in , a segment having at least - //! one intersection with the face boundary to - //! compute intersections. - Standard_EXPORT Standard_Boolean Segment(const gp_Pnt2d& P, gp_Lin2d& L, Standard_Real& Par); + //! Returns in , a segment having at least + //! one intersection with the face boundary to + //! compute intersections. + Standard_EXPORT bool Segment(const gp_Pnt2d& P, gp_Lin2d& L, double& Par); - //! Returns in , a segment having at least - //! one intersection with the face boundary to - //! compute intersections. Each call gives another segment. - Standard_EXPORT Standard_Boolean OtherSegment(const gp_Pnt2d& P, gp_Lin2d& L, Standard_Real& Par); + //! Returns in , a segment having at least + //! one intersection with the face boundary to + //! compute intersections. Each call gives another segment. + Standard_EXPORT bool OtherSegment(const gp_Pnt2d& P, gp_Lin2d& L, double& Par); //! Starts an exploration of the wires. Standard_EXPORT void InitWires(); - //! Returns True if there is a current wire. - Standard_Boolean MoreWires() const; + //! Returns True if there is a current wire. + bool MoreWires() const { return myWExplorer.More(); } - //! Sets the explorer to the next wire. - void NextWire(); + //! Sets the explorer to the next wire. + void NextWire() { myWExplorer.Next(); } - //! Returns True if the wire bounding volume does not + //! Returns True if the wire bounding volume does not //! intersect the segment. - Standard_EXPORT Standard_Boolean RejectWire(const gp_Lin2d& L, const Standard_Real Par) const; + Standard_EXPORT bool RejectWire(const gp_Lin2d& L, const double Par) const; - //! Starts an exploration of the edges of the current + //! Starts an exploration of the edges of the current //! wire. Standard_EXPORT void InitEdges(); //! Returns True if there is a current edge. - Standard_Boolean MoreEdges() const; + bool MoreEdges() const { return myEExplorer.More(); } - //! Sets the explorer to the next edge. - void NextEdge(); + //! Sets the explorer to the next edge. + void NextEdge() { myEExplorer.Next(); } - //! Returns True if the edge bounding volume does not + //! Returns True if the edge bounding volume does not //! intersect the segment. - Standard_EXPORT Standard_Boolean RejectEdge(const gp_Lin2d& L, const Standard_Real Par) const; + Standard_EXPORT bool RejectEdge(const gp_Lin2d& L, const double Par) const; //! Current edge in current wire and its orientation. Standard_EXPORT void CurrentEdge(BRepClass_Edge& E, TopAbs_Orientation& Or) const; //! Returns the maximum tolerance - Standard_Real MaxTolerance() const { return myMaxTolerance; } + double MaxTolerance() const { return myMaxTolerance; } //! Sets the maximum tolerance at //! which to start checking in the intersector - void SetMaxTolerance(const Standard_Real theValue) { myMaxTolerance = theValue; } + void SetMaxTolerance(const double theValue) { myMaxTolerance = theValue; } //! Returns true if we are using boxes //! in the intersector - Standard_Boolean UseBndBox() const { return myUseBndBox; } + bool UseBndBox() const { return myUseBndBox; } //! Sets the status of whether we are //! using boxes or not - void SetUseBndBox(const Standard_Boolean theValue) { myUseBndBox = theValue; } + void SetUseBndBox(const bool theValue) { myUseBndBox = theValue; } protected: //! Computes UV bounds of a face Standard_EXPORT void ComputeFaceBounds(); private: - TopoDS_Face myFace; - TopExp_Explorer myWExplorer; - TopExp_Explorer myEExplorer; - Standard_Integer myCurEdgeInd; - Standard_Real myCurEdgePar; - Standard_Real myMaxTolerance; - Standard_Boolean myUseBndBox; - TopTools_IndexedDataMapOfShapeListOfShape myMapVE; - - Standard_Real myUMin; - Standard_Real myUMax; - Standard_Real myVMin; - Standard_Real myVMax; + TopoDS_Face myFace; + TopExp_Explorer myWExplorer; + TopExp_Explorer myEExplorer; + int myCurEdgeInd; + double myCurEdgePar; + double myMaxTolerance; + bool myUseBndBox; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myMapVE; + + double myUMin; + double myUMax; + double myVMin; + double myVMax; }; -#include - #endif // _BRepClass_FaceExplorer_HeaderFile diff --git a/opencascade/BRepClass_FaceExplorer.lxx b/opencascade/BRepClass_FaceExplorer.lxx deleted file mode 100644 index d47873b8d..000000000 --- a/opencascade/BRepClass_FaceExplorer.lxx +++ /dev/null @@ -1,55 +0,0 @@ -// Created on: 1993-01-25 -// Created by: Remi LEQUETTE -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//======================================================================= -// function : MoreWires -// purpose : -//======================================================================= - -inline Standard_Boolean BRepClass_FaceExplorer::MoreWires() const -{ - return myWExplorer.More(); -} - -//======================================================================= -// function : NextWire -// purpose : -//======================================================================= - -inline void BRepClass_FaceExplorer::NextWire() -{ - myWExplorer.Next(); -} - -//======================================================================= -// function : MoreEdges -// purpose : -//======================================================================= - -inline Standard_Boolean BRepClass_FaceExplorer::MoreEdges() const -{ - return myEExplorer.More(); -} - -//======================================================================= -// function : NextEdge -// purpose : -//======================================================================= - -inline void BRepClass_FaceExplorer::NextEdge() -{ - myEExplorer.Next(); -} diff --git a/opencascade/BRepClass_FacePassiveClassifier.hxx b/opencascade/BRepClass_FacePassiveClassifier.hxx index d428433ac..ac83bc9cf 100644 --- a/opencascade/BRepClass_FacePassiveClassifier.hxx +++ b/opencascade/BRepClass_FacePassiveClassifier.hxx @@ -39,66 +39,49 @@ public: //! Creates an undefined classifier. Standard_EXPORT BRepClass_FacePassiveClassifier(); - //! Starts a classification process. The point to - //! classify is the origin of the line .

is - //! the original length of the segment on used to - //! compute intersections. is the tolerance + //! Starts a classification process. The point to + //! classify is the origin of the line .

is + //! the original length of the segment on used to + //! compute intersections. is the tolerance //! attached to the line segment in intersections. - Standard_EXPORT void Reset(const gp_Lin2d& L, const Standard_Real P, const Standard_Real Tol); + Standard_EXPORT void Reset(const gp_Lin2d& L, const double P, const double Tol); - //! Updates the classification process with the edge + //! Updates the classification process with the edge //! from the boundary. Standard_EXPORT void Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or); //! Returns the current value of the parameter. - Standard_Real Parameter() const; + double Parameter() const { return myParam; } //! Returns the intersecting algorithm. - BRepClass_Intersector& Intersector(); + BRepClass_Intersector& Intersector() { return myIntersector; } - //! Returns 0 if the last compared edge had no - //! relevant intersection. Else returns the index of - //! this intersection in the last intersection + //! Returns 0 if the last compared edge had no + //! relevant intersection. Else returns the index of + //! this intersection in the last intersection //! algorithm. - Standard_Integer ClosestIntersection() const; + int ClosestIntersection() const { return myClosest; } //! Returns the current state of the point. - TopAbs_State State() const; + TopAbs_State State() const { return myState; } - //! Returns the Standard_True if the closest intersection point - //! represents head or end of the edge. Returns Standard_False + //! Returns the true if the closest intersection point + //! represents head or end of the edge. Returns false //! otherwise. - Standard_Boolean IsHeadOrEnd() const; + bool IsHeadOrEnd() const { return myIsHeadOrEnd; } -protected: private: - Standard_Boolean myIsSet; - Standard_Boolean myFirstCompare; - Standard_Boolean myFirstTrans; + bool myIsSet; + bool myFirstCompare; + bool myFirstTrans; gp_Lin2d myLin; - Standard_Real myParam; - Standard_Real myTolerance; + double myParam; + double myTolerance; TopTrans_CurveTransition myTrans; BRepClass_Intersector myIntersector; - Standard_Integer myClosest; + int myClosest; TopAbs_State myState; - Standard_Boolean myIsHeadOrEnd; + bool myIsHeadOrEnd; }; -#define TheEdge BRepClass_Edge -#define TheEdge_hxx -#define TheIntersector BRepClass_Intersector -#define TheIntersector_hxx -#define TopClass_Classifier2d BRepClass_FacePassiveClassifier -#define TopClass_Classifier2d_hxx - -#include - -#undef TheEdge -#undef TheEdge_hxx -#undef TheIntersector -#undef TheIntersector_hxx -#undef TopClass_Classifier2d -#undef TopClass_Classifier2d_hxx - #endif // _BRepClass_FacePassiveClassifier_HeaderFile diff --git a/opencascade/BRepClass_Intersector.hxx b/opencascade/BRepClass_Intersector.hxx index e92310133..9103bf641 100644 --- a/opencascade/BRepClass_Intersector.hxx +++ b/opencascade/BRepClass_Intersector.hxx @@ -25,7 +25,7 @@ class gp_Lin2d; class BRepClass_Edge; class gp_Dir2d; -//! Intersect an Edge with a segment. +//! Intersect an Edge with a segment. //! Implement the Intersector2d required by the classifier. class BRepClass_Intersector : public Geom2dInt_IntConicCurveOfGInter { @@ -36,21 +36,18 @@ public: //! Intersect the line segment and the edge. Standard_EXPORT void Perform(const gp_Lin2d& L, - const Standard_Real P, - const Standard_Real Tol, + const double P, + const double Tol, const BRepClass_Edge& E); - //! Returns in , and the tangent, normal - //! and curvature of the edge at parameter value + //! Returns in , and the tangent, normal + //! and curvature of the edge at parameter value //! . Standard_EXPORT void LocalGeometry(const BRepClass_Edge& E, - const Standard_Real U, + const double U, gp_Dir2d& T, gp_Dir2d& N, - Standard_Real& C) const; - -protected: -private: + double& C) const; }; #endif // _BRepClass_Intersector_HeaderFile diff --git a/opencascade/BRepExtrema_DistShapeShape.hxx b/opencascade/BRepExtrema_DistShapeShape.hxx index 7afb9d867..4615d8741 100644 --- a/opencascade/BRepExtrema_DistShapeShape.hxx +++ b/opencascade/BRepExtrema_DistShapeShape.hxx @@ -14,8 +14,9 @@ #ifndef _BRepExtrema_DistShapeShape_HeaderFile #define _BRepExtrema_DistShapeShape_HeaderFile -#include -#include +#include +#include +#include #include #include #include @@ -24,9 +25,10 @@ #include #include #include -#include +#include +#include -//! This class provides tools to compute minimum distance +//! This class provides tools to compute minimum distance //! between two Shapes (Compound,CompSolid, Solid, Shell, Face, Wire, Edge, Vertex). class BRepExtrema_DistShapeShape { @@ -37,8 +39,8 @@ public: Standard_EXPORT BRepExtrema_DistShapeShape(); //! create tool and computation of the minimum distance (value and pair of points) - //! using default deflection in single thread mode.
- //! Default deflection value is Precision::Confusion().
+ //! using default deflection in single thread mode. + //! Default deflection value is Precision::Confusion(). //! @param Shape1 - the first shape for distance computation //! @param Shape2 - the second shape for distance computation //! @param F and @param A are not used in computation and are obsolete. @@ -50,8 +52,8 @@ public: const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad, const Message_ProgressRange& theRange = Message_ProgressRange()); //! create tool and computation of the minimum distance - //! (value and pair of points) in single thread mode.
- //! Default deflection value is Precision::Confusion().
+ //! (value and pair of points) in single thread mode. + //! Default deflection value is Precision::Confusion(). //! @param Shape1 - the first shape for distance computation //! @param Shape2 - the second shape for distance computation //! @param theDeflection - the presition of distance computation @@ -60,103 +62,92 @@ public: Standard_EXPORT BRepExtrema_DistShapeShape( const TopoDS_Shape& Shape1, const TopoDS_Shape& Shape2, - const Standard_Real theDeflection, + const double theDeflection, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad, const Message_ProgressRange& theRange = Message_ProgressRange()); - //! Sets deflection to computation of the minimum distance
- void SetDeflection(const Standard_Real theDeflection) { myEps = theDeflection; } + //! Sets deflection to computation of the minimum distance + void SetDeflection(const double theDeflection) { myEps = theDeflection; } - //! load first shape into extrema
+ //! load first shape into extrema Standard_EXPORT void LoadS1(const TopoDS_Shape& Shape1); - //! load second shape into extrema
+ //! load second shape into extrema Standard_EXPORT void LoadS2(const TopoDS_Shape& Shape1); - //! computation of the minimum distance (value and
- //! couple of points). Parameter theDeflection is used
- //! to specify a maximum deviation of extreme distances
- //! from the minimum one.
- //! Returns IsDone status.
+ //! computation of the minimum distance (value and + //! couple of points). Parameter theDeflection is used + //! to specify a maximum deviation of extreme distances + //! from the minimum one. + //! Returns IsDone status. //! theRange - the progress indicator of algorithm - Standard_EXPORT Standard_Boolean - Perform(const Message_ProgressRange& theRange = Message_ProgressRange()); + Standard_EXPORT bool Perform(const Message_ProgressRange& theRange = Message_ProgressRange()); - //! True if the minimum distance is found.
- Standard_Boolean IsDone() const { return myIsDone; } + //! True if the minimum distance is found. + bool IsDone() const { return myIsDone; } - //! Returns the number of solutions satisfying the minimum distance.
- Standard_Integer NbSolution() const { return mySolutionsShape1.Length(); } + //! Returns the number of solutions satisfying the minimum distance. + int NbSolution() const { return mySolutionsShape1.Length(); } - //! Returns the value of the minimum distance.
- Standard_EXPORT Standard_Real Value() const; + //! Returns the value of the minimum distance. + Standard_EXPORT double Value() const; - //! True if one of the shapes is a solid and the other shape
- //! is completely or partially inside the solid.
- Standard_Boolean InnerSolution() const { return myInnerSol; } + //! True if one of the shapes is a solid and the other shape + //! is completely or partially inside the solid. + bool InnerSolution() const { return myInnerSol; } - //! Returns the Point corresponding to the th solution on the first Shape
- const gp_Pnt& PointOnShape1(const Standard_Integer N) const - { - return mySolutionsShape1.Value(N).Point(); - } + //! Returns the Point corresponding to the th solution on the first Shape + const gp_Pnt& PointOnShape1(const int N) const { return mySolutionsShape1.Value(N).Point(); } - //! Returns the Point corresponding to the th solution on the second Shape
- const gp_Pnt& PointOnShape2(const Standard_Integer N) const - { - return mySolutionsShape2.Value(N).Point(); - } + //! Returns the Point corresponding to the th solution on the second Shape + const gp_Pnt& PointOnShape2(const int N) const { return mySolutionsShape2.Value(N).Point(); } - //! gives the type of the support where the Nth solution on the first shape is situated:
- //! IsVertex => the Nth solution on the first shape is a Vertex
- //! IsOnEdge => the Nth soluion on the first shape is on a Edge
- //! IsInFace => the Nth solution on the first shape is inside a face
- //! the corresponding support is obtained by the method SupportOnShape1
- BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const + //! gives the type of the support where the Nth solution on the first shape is situated: + //! IsVertex => the Nth solution on the first shape is a Vertex + //! IsOnEdge => the Nth soluion on the first shape is on a Edge + //! IsInFace => the Nth solution on the first shape is inside a face + //! the corresponding support is obtained by the method SupportOnShape1 + BRepExtrema_SupportType SupportTypeShape1(const int N) const { return mySolutionsShape1.Value(N).SupportKind(); } - //! gives the type of the support where the Nth solution on the second shape is situated:
- //! IsVertex => the Nth solution on the second shape is a Vertex
- //! IsOnEdge => the Nth soluion on the secondt shape is on a Edge
- //! IsInFace => the Nth solution on the second shape is inside a face
- //! the corresponding support is obtained by the method SupportOnShape2
- BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const + //! gives the type of the support where the Nth solution on the second shape is situated: + //! IsVertex => the Nth solution on the second shape is a Vertex + //! IsOnEdge => the Nth soluion on the secondt shape is on a Edge + //! IsInFace => the Nth solution on the second shape is inside a face + //! the corresponding support is obtained by the method SupportOnShape2 + BRepExtrema_SupportType SupportTypeShape2(const int N) const { return mySolutionsShape2.Value(N).SupportKind(); } - //! gives the support where the Nth solution on the first shape is situated.
- //! This support can be a Vertex, an Edge or a Face.
- Standard_EXPORT TopoDS_Shape SupportOnShape1(const Standard_Integer N) const; + //! gives the support where the Nth solution on the first shape is situated. + //! This support can be a Vertex, an Edge or a Face. + Standard_EXPORT TopoDS_Shape SupportOnShape1(const int N) const; - //! gives the support where the Nth solution on the second shape is situated.
- //! This support can be a Vertex, an Edge or a Face.
- Standard_EXPORT TopoDS_Shape SupportOnShape2(const Standard_Integer N) const; + //! gives the support where the Nth solution on the second shape is situated. + //! This support can be a Vertex, an Edge or a Face. + Standard_EXPORT TopoDS_Shape SupportOnShape2(const int N) const; - //! gives the corresponding parameter t if the Nth solution
- //! is situated on an Edge of the first shape
- Standard_EXPORT void ParOnEdgeS1(const Standard_Integer N, Standard_Real& t) const; + //! gives the corresponding parameter t if the Nth solution + //! is situated on an Edge of the first shape + Standard_EXPORT void ParOnEdgeS1(const int N, double& t) const; - //! gives the corresponding parameter t if the Nth solution
- //! is situated on an Edge of the first shape
- Standard_EXPORT void ParOnEdgeS2(const Standard_Integer N, Standard_Real& t) const; + //! gives the corresponding parameter t if the Nth solution + //! is situated on an Edge of the first shape + Standard_EXPORT void ParOnEdgeS2(const int N, double& t) const; - //! gives the corresponding parameters (U,V) if the Nth solution
- //! is situated on an face of the first shape
- Standard_EXPORT void ParOnFaceS1(const Standard_Integer N, - Standard_Real& u, - Standard_Real& v) const; + //! gives the corresponding parameters (U,V) if the Nth solution + //! is situated on an face of the first shape + Standard_EXPORT void ParOnFaceS1(const int N, double& u, double& v) const; - //! gives the corresponding parameters (U,V) if the Nth solution
- //! is situated on an Face of the second shape
- Standard_EXPORT void ParOnFaceS2(const Standard_Integer N, - Standard_Real& u, - Standard_Real& v) const; + //! gives the corresponding parameters (U,V) if the Nth solution + //! is situated on an Face of the second shape + Standard_EXPORT void ParOnFaceS2(const int N, double& u, double& v) const; - //! Prints on the stream o information on the current state of the object.
+ //! Prints on the stream o information on the current state of the object. Standard_EXPORT void Dump(Standard_OStream& o) const; //! Sets unused parameter @@ -167,56 +158,57 @@ public: //! Obsolete void SetAlgo(const Extrema_ExtAlgo A) { myAlgo = A; } - //! If isMultiThread == Standard_True then computation will be performed in parallel. - void SetMultiThread(Standard_Boolean theIsMultiThread) { myIsMultiThread = theIsMultiThread; } + //! If isMultiThread == true then computation will be performed in parallel. + void SetMultiThread(bool theIsMultiThread) { myIsMultiThread = theIsMultiThread; } - //! Returns Standard_True then computation will be performed in parallel - //! Default value is Standard_False - Standard_Boolean IsMultiThread() const { return myIsMultiThread; } + //! Returns true then computation will be performed in parallel + //! Default value is false + bool IsMultiThread() const { return myIsMultiThread; } private: - //! computes the minimum distance between two maps of shapes (Face,Edge,Vertex)
- Standard_Boolean DistanceMapMap(const TopTools_IndexedMapOfShape& Map1, - const TopTools_IndexedMapOfShape& Map2, - const Bnd_Array1OfBox& LBox1, - const Bnd_Array1OfBox& LBox2, - const Message_ProgressRange& theRange); - - //! computes the minimum distance between two maps of vertices
- Standard_Boolean DistanceVertVert(const TopTools_IndexedMapOfShape& theMap1, - const TopTools_IndexedMapOfShape& theMap2, - const Message_ProgressRange& theRange); - - Standard_Boolean SolidTreatment(const TopoDS_Shape& theShape, - const TopTools_IndexedMapOfShape& theMap, - const Message_ProgressRange& theRange); + //! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) + bool DistanceMapMap(const NCollection_IndexedMap& Map1, + const NCollection_IndexedMap& Map2, + const NCollection_Array1& LBox1, + const NCollection_Array1& LBox2, + const Message_ProgressRange& theRange); + + //! computes the minimum distance between two maps of vertices + bool DistanceVertVert( + const NCollection_IndexedMap& theMap1, + const NCollection_IndexedMap& theMap2, + const Message_ProgressRange& theRange); + + bool SolidTreatment(const TopoDS_Shape& theShape, + const NCollection_IndexedMap& theMap, + const Message_ProgressRange& theRange); private: - Standard_Real myDistRef; - Standard_Boolean myIsDone; - BRepExtrema_SeqOfSolution mySolutionsShape1; - BRepExtrema_SeqOfSolution mySolutionsShape2; - Standard_Boolean myInnerSol; - Standard_Real myEps; - TopoDS_Shape myShape1; - TopoDS_Shape myShape2; - TopTools_IndexedMapOfShape myMapV1; - TopTools_IndexedMapOfShape myMapV2; - TopTools_IndexedMapOfShape myMapE1; - TopTools_IndexedMapOfShape myMapE2; - TopTools_IndexedMapOfShape myMapF1; - TopTools_IndexedMapOfShape myMapF2; - Standard_Boolean myIsInitS1; - Standard_Boolean myIsInitS2; - Extrema_ExtFlag myFlag; - Extrema_ExtAlgo myAlgo; - Bnd_Array1OfBox myBV1; - Bnd_Array1OfBox myBV2; - Bnd_Array1OfBox myBE1; - Bnd_Array1OfBox myBE2; - Bnd_Array1OfBox myBF1; - Bnd_Array1OfBox myBF2; - Standard_Boolean myIsMultiThread; + double myDistRef; + bool myIsDone; + NCollection_Sequence mySolutionsShape1; + NCollection_Sequence mySolutionsShape2; + bool myInnerSol; + double myEps; + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; + NCollection_IndexedMap myMapV1; + NCollection_IndexedMap myMapV2; + NCollection_IndexedMap myMapE1; + NCollection_IndexedMap myMapE2; + NCollection_IndexedMap myMapF1; + NCollection_IndexedMap myMapF2; + bool myIsInitS1; + bool myIsInitS2; + Extrema_ExtFlag myFlag; + Extrema_ExtAlgo myAlgo; + NCollection_Array1 myBV1; + NCollection_Array1 myBV2; + NCollection_Array1 myBE1; + NCollection_Array1 myBE2; + NCollection_Array1 myBF1; + NCollection_Array1 myBF2; + bool myIsMultiThread; }; #endif diff --git a/opencascade/BRepExtrema_DistanceSS.hxx b/opencascade/BRepExtrema_DistanceSS.hxx index 4d696bdba..812199199 100644 --- a/opencascade/BRepExtrema_DistanceSS.hxx +++ b/opencascade/BRepExtrema_DistanceSS.hxx @@ -14,7 +14,8 @@ #ifndef _BRepExtrema_DistanceSS_HeaderFile #define _BRepExtrema_DistanceSS_HeaderFile -#include +#include +#include #include #include #include @@ -50,12 +51,12 @@ public: //! @name Constructor from two shapes const TopoDS_Shape& theS2, const Bnd_Box& theBox1, const Bnd_Box& theBox2, - const Standard_Real theDstRef, - const Standard_Real theDeflection = Precision::Confusion(), + const double theDstRef, + const double theDeflection = Precision::Confusion(), const Extrema_ExtFlag theExtFlag = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo theExtAlgo = Extrema_ExtAlgo_Grad) : myDstRef(theDstRef), - myModif(Standard_False), + myModif(false), myEps(theDeflection), myFlag(theExtFlag), myAlgo(theExtAlgo) @@ -65,16 +66,16 @@ public: //! @name Constructor from two shapes public: //! @name Results //! Returns true if the distance has been computed, false otherwise. - Standard_Boolean IsDone() const { return myModif; } + bool IsDone() const { return myModif; } //! Returns the distance value. - Standard_Real DistValue() const { return myDstRef; } + double DistValue() const { return myDstRef; } //! Returns the list of solutions on the first shape. - const BRepExtrema_SeqOfSolution& Seq1Value() const { return mySeqSolShape1; } + const NCollection_Sequence& Seq1Value() const { return mySeqSolShape1; } //! Returns the list of solutions on the second shape. - const BRepExtrema_SeqOfSolution& Seq2Value() const { return mySeqSolShape2; } + const NCollection_Sequence& Seq2Value() const { return mySeqSolShape2; } private: //! @name private methods performing the search //! Computes the distance between two Shapes (face edge vertex). @@ -85,49 +86,49 @@ private: //! @name private methods performing the search const Bnd_Box& theBox2); //! Computes the distance between two vertices. - void Perform(const TopoDS_Vertex& S1, - const TopoDS_Vertex& S2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); + void Perform(const TopoDS_Vertex& S1, + const TopoDS_Vertex& S2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); //! Computes the minimum distance between a vertex and an edge. - void Perform(const TopoDS_Vertex& theS1, - const TopoDS_Edge& theS2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); + void Perform(const TopoDS_Vertex& theS1, + const TopoDS_Edge& theS2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); //! Computes the minimum distance between a vertex and a face. - void Perform(const TopoDS_Vertex& theS1, - const TopoDS_Face& theS2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); + void Perform(const TopoDS_Vertex& theS1, + const TopoDS_Face& theS2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); //! Computes the minimum distance between two edges. - void Perform(const TopoDS_Edge& theS1, - const TopoDS_Edge& theS2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); + void Perform(const TopoDS_Edge& theS1, + const TopoDS_Edge& theS2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); //! Computes the minimum distance between an edge and a face. - void Perform(const TopoDS_Edge& theS1, - const TopoDS_Face& theS2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); + void Perform(const TopoDS_Edge& theS1, + const TopoDS_Face& theS2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); //! Computes the minimum distance between two faces. - void Perform(const TopoDS_Face& theS1, - const TopoDS_Face& theS2, - BRepExtrema_SeqOfSolution& theSeqSolShape1, - BRepExtrema_SeqOfSolution& theSeqSolShape2); - -private: //! @name Fields - BRepExtrema_SeqOfSolution mySeqSolShape1; //!< Solutions on the first shape - BRepExtrema_SeqOfSolution mySeqSolShape2; //!< Solutions on the second shape - Standard_Real myDstRef; //!< The minimal distance found - Standard_Boolean myModif; //!< Flag indicating whether the solution was improved or not - Standard_Real myEps; //!< Deflection - Extrema_ExtFlag myFlag; //!< Extrema flag indicating what solutions to look for - Extrema_ExtAlgo myAlgo; //!< Extrema algo to be used to look for solutions + void Perform(const TopoDS_Face& theS1, + const TopoDS_Face& theS2, + NCollection_Sequence& theSeqSolShape1, + NCollection_Sequence& theSeqSolShape2); + +private: //! @name Fields + NCollection_Sequence mySeqSolShape1; //!< Solutions on the first shape + NCollection_Sequence mySeqSolShape2; //!< Solutions on the second shape + double myDstRef; //!< The minimal distance found + bool myModif; //!< Flag indicating whether the solution was improved or not + double myEps; //!< Deflection + Extrema_ExtFlag myFlag; //!< Extrema flag indicating what solutions to look for + Extrema_ExtAlgo myAlgo; //!< Extrema algo to be used to look for solutions }; #endif diff --git a/opencascade/BRepExtrema_ElementFilter.hxx b/opencascade/BRepExtrema_ElementFilter.hxx index 7eb2f6d3f..6017f7e37 100644 --- a/opencascade/BRepExtrema_ElementFilter.hxx +++ b/opencascade/BRepExtrema_ElementFilter.hxx @@ -31,18 +31,14 @@ struct BRepExtrema_ElementFilter }; //! Releases resources of element filter. - virtual ~BRepExtrema_ElementFilter() - { - // - } + virtual ~BRepExtrema_ElementFilter() = default; //! Checks if two mesh elements should be tested for overlapping/intersection //! (used for detection correct/incorrect cases of shared edges and vertices). - virtual FilterResult PreCheckElements(const Standard_Integer /*theIndex1*/, - const Standard_Integer /*theIndex2*/) + virtual FilterResult PreCheckElements(const int /*theIndex1*/, const int /*theIndex2*/) { return DoCheck; } }; -#endif // _BRepExtrema_ElementFilter_HeaderFile \ No newline at end of file +#endif // _BRepExtrema_ElementFilter_HeaderFile diff --git a/opencascade/BRepExtrema_ExtCC.hxx b/opencascade/BRepExtrema_ExtCC.hxx index c531052b3..649d1bec0 100644 --- a/opencascade/BRepExtrema_ExtCC.hxx +++ b/opencascade/BRepExtrema_ExtCC.hxx @@ -26,51 +26,51 @@ class BRepExtrema_ExtCC public: DEFINE_STANDARD_ALLOC - BRepExtrema_ExtCC() {} + BRepExtrema_ExtCC() = default; - //! It calculates all the distances.
+ //! It calculates all the distances. Standard_EXPORT BRepExtrema_ExtCC(const TopoDS_Edge& E1, const TopoDS_Edge& E2); Standard_EXPORT void Initialize(const TopoDS_Edge& E2); - //! An exception is raised if the fields have not been initialized.
+ //! An exception is raised if the fields have not been initialized. Standard_EXPORT void Perform(const TopoDS_Edge& E1); - //! True if the distances are found.
- Standard_Boolean IsDone() const { return myExtCC.IsDone(); } + //! True if the distances are found. + bool IsDone() const { return myExtCC.IsDone(); } - //! Returns the number of extremum distances.
- Standard_Integer NbExt() const { return myExtCC.NbExt(); } + //! Returns the number of extremum distances. + int NbExt() const { return myExtCC.NbExt(); } - //! Returns True if E1 and E2 are parallel.
- Standard_Boolean IsParallel() const { return myExtCC.IsParallel(); } + //! Returns True if E1 and E2 are parallel. + bool IsParallel() const { return myExtCC.IsParallel(); } - //! Returns the value of the th extremum square distance.
- Standard_Real SquareDistance(const Standard_Integer N) const { return myExtCC.SquareDistance(N); } + //! Returns the value of the th extremum square distance. + double SquareDistance(const int N) const { return myExtCC.SquareDistance(N); } - //! Returns the parameter on the first edge of the th extremum distance.
- Standard_EXPORT Standard_Real ParameterOnE1(const Standard_Integer N) const; - //! Returns the Point of the th extremum distance on the edge E1.
- Standard_EXPORT gp_Pnt PointOnE1(const Standard_Integer N) const; - //! Returns the parameter on the second edge of the th extremum distance.
- Standard_EXPORT Standard_Real ParameterOnE2(const Standard_Integer N) const; - //! Returns the Point of the th extremum distance on the edge E2.
- Standard_EXPORT gp_Pnt PointOnE2(const Standard_Integer N) const; - //! if the edges is a trimmed curve,
- //! dist11 is a square distance between the point on E1
- //! of parameter FirstParameter and the point of
- //! parameter FirstParameter on E2.
- Standard_EXPORT void TrimmedSquareDistances(Standard_Real& dist11, - Standard_Real& distP12, - Standard_Real& distP21, - Standard_Real& distP22, - gp_Pnt& P11, - gp_Pnt& P12, - gp_Pnt& P21, - gp_Pnt& P22) const; + //! Returns the parameter on the first edge of the th extremum distance. + Standard_EXPORT double ParameterOnE1(const int N) const; + //! Returns the Point of the th extremum distance on the edge E1. + Standard_EXPORT gp_Pnt PointOnE1(const int N) const; + //! Returns the parameter on the second edge of the th extremum distance. + Standard_EXPORT double ParameterOnE2(const int N) const; + //! Returns the Point of the th extremum distance on the edge E2. + Standard_EXPORT gp_Pnt PointOnE2(const int N) const; + //! if the edges is a trimmed curve, + //! dist11 is a square distance between the point on E1 + //! of parameter FirstParameter and the point of + //! parameter FirstParameter on E2. + Standard_EXPORT void TrimmedSquareDistances(double& dist11, + double& distP12, + double& distP21, + double& distP22, + gp_Pnt& P11, + gp_Pnt& P12, + gp_Pnt& P21, + gp_Pnt& P22) const; private: - Extrema_ExtCC myExtCC; - Handle(BRepAdaptor_Curve) myHC; + Extrema_ExtCC myExtCC; + occ::handle myHC; }; #endif diff --git a/opencascade/BRepExtrema_ExtCF.hxx b/opencascade/BRepExtrema_ExtCF.hxx index a916fa4d5..7852eb859 100644 --- a/opencascade/BRepExtrema_ExtCF.hxx +++ b/opencascade/BRepExtrema_ExtCF.hxx @@ -15,12 +15,10 @@ #define _BRepExtrema_ExtCF_HeaderFile #include -#include -#include -#include -#include -#include +#include #include +#include +#include #include class TopoDS_Edge; @@ -31,52 +29,49 @@ class BRepExtrema_ExtCF public: DEFINE_STANDARD_ALLOC - BRepExtrema_ExtCF() {} + BRepExtrema_ExtCF() = default; - //! It calculates all the distances.
+ //! It calculates all the distances. Standard_EXPORT BRepExtrema_ExtCF(const TopoDS_Edge& E, const TopoDS_Face& F); Standard_EXPORT void Initialize(const TopoDS_Edge& E, const TopoDS_Face& F); - //! An exception is raised if the fields have not been initialized.
- //! Be careful: this method uses the Face only for classify not for the fields.
+ //! An exception is raised if the fields have not been initialized. + //! Be careful: this method uses the Face only for classify not for the fields. Standard_EXPORT void Perform(const TopoDS_Edge& E, const TopoDS_Face& F); - //! True if the distances are found.
- Standard_Boolean IsDone() const { return myExtCS.IsDone(); } + //! True if the distances are found. + bool IsDone() const { return myExtCS.IsDone(); } - //! Returns the number of extremum distances.
- Standard_Integer NbExt() const { return mySqDist.Length(); } + //! Returns the number of extremum distances. + int NbExt() const { return mySqDist.Length(); } - //! Returns the value of the th extremum square distance.
- Standard_Real SquareDistance(const Standard_Integer N) const { return mySqDist.Value(N); } + //! Returns the value of the th extremum square distance. + double SquareDistance(const int N) const { return mySqDist.Value(N); } - //! Returns True if the curve is on a parallel surface.
- Standard_Boolean IsParallel() const { return myExtCS.IsParallel(); } + //! Returns True if the curve is on a parallel surface. + bool IsParallel() const { return myExtCS.IsParallel(); } - //! Returns the parameters on the Edge of the th extremum distance.
- Standard_Real ParameterOnEdge(const Standard_Integer N) const - { - return myPointsOnC.Value(N).Parameter(); - } + //! Returns the parameters on the Edge of the th extremum distance. + double ParameterOnEdge(const int N) const { return myPointsOnC.Value(N).Parameter(); } - //! Returns the parameters on the Face of the th extremum distance.
- void ParameterOnFace(const Standard_Integer N, Standard_Real& U, Standard_Real& V) const + //! Returns the parameters on the Face of the th extremum distance. + void ParameterOnFace(const int N, double& U, double& V) const { myPointsOnS.Value(N).Parameter(U, V); } - //! Returns the Point of the th extremum distance.
- gp_Pnt PointOnEdge(const Standard_Integer N) const { return myPointsOnC.Value(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt PointOnEdge(const int N) const { return myPointsOnC.Value(N).Value(); } - //! Returns the Point of the th extremum distance.
- gp_Pnt PointOnFace(const Standard_Integer N) const { return myPointsOnS.Value(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt PointOnFace(const int N) const { return myPointsOnS.Value(N).Value(); } private: - Extrema_ExtCS myExtCS; - TColStd_SequenceOfReal mySqDist; - Extrema_SequenceOfPOnSurf myPointsOnS; - Extrema_SequenceOfPOnCurv myPointsOnC; - Handle(BRepAdaptor_Surface) myHS; + Extrema_ExtCS myExtCS; + NCollection_Sequence mySqDist; + NCollection_Sequence myPointsOnS; + NCollection_Sequence myPointsOnC; + occ::handle myHS; }; #endif diff --git a/opencascade/BRepExtrema_ExtFF.hxx b/opencascade/BRepExtrema_ExtFF.hxx index ed1e55f07..74091bca2 100644 --- a/opencascade/BRepExtrema_ExtFF.hxx +++ b/opencascade/BRepExtrema_ExtFF.hxx @@ -15,10 +15,9 @@ #define _BRepExtrema_ExtFF_HeaderFile #include -#include -#include -#include +#include #include +#include #include class TopoDS_Face; @@ -28,52 +27,52 @@ class BRepExtrema_ExtFF public: DEFINE_STANDARD_ALLOC - BRepExtrema_ExtFF() {} + BRepExtrema_ExtFF() = default; - //! It calculates all the distances.
+ //! It calculates all the distances. Standard_EXPORT BRepExtrema_ExtFF(const TopoDS_Face& F1, const TopoDS_Face& F2); Standard_EXPORT void Initialize(const TopoDS_Face& F2); - //! An exception is raised if the fields have not been initialized.
- //! Be careful: this method uses the Face F2 only for classify, not for the fields.
+ //! An exception is raised if the fields have not been initialized. + //! Be careful: this method uses the Face F2 only for classify, not for the fields. Standard_EXPORT void Perform(const TopoDS_Face& F1, const TopoDS_Face& F2); - //! True if the distances are found.
- Standard_Boolean IsDone() const { return myExtSS.IsDone(); } + //! True if the distances are found. + bool IsDone() const { return myExtSS.IsDone(); } - //! Returns True if the surfaces are parallel.
- Standard_Boolean IsParallel() const { return myExtSS.IsParallel(); } + //! Returns True if the surfaces are parallel. + bool IsParallel() const { return myExtSS.IsParallel(); } - //! Returns the number of extremum distances.
- Standard_Integer NbExt() const { return mySqDist.Length(); } + //! Returns the number of extremum distances. + int NbExt() const { return mySqDist.Length(); } - //! Returns the value of the th extremum square distance.
- Standard_Real SquareDistance(const Standard_Integer N) const { return mySqDist.Value(N); } + //! Returns the value of the th extremum square distance. + double SquareDistance(const int N) const { return mySqDist.Value(N); } - //! Returns the parameters on the Face F1 of the th extremum distance.
- void ParameterOnFace1(const Standard_Integer N, Standard_Real& U, Standard_Real& V) const + //! Returns the parameters on the Face F1 of the th extremum distance. + void ParameterOnFace1(const int N, double& U, double& V) const { myPointsOnS1.Value(N).Parameter(U, V); } - //! Returns the parameters on the Face F2 of the th extremum distance.
- void ParameterOnFace2(const Standard_Integer N, Standard_Real& U, Standard_Real& V) const + //! Returns the parameters on the Face F2 of the th extremum distance. + void ParameterOnFace2(const int N, double& U, double& V) const { myPointsOnS2.Value(N).Parameter(U, V); } - //! Returns the Point of the th extremum distance.
- gp_Pnt PointOnFace1(const Standard_Integer N) const { return myPointsOnS1.Value(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt PointOnFace1(const int N) const { return myPointsOnS1.Value(N).Value(); } - //! Returns the Point of the th extremum distance.
- gp_Pnt PointOnFace2(const Standard_Integer N) const { return myPointsOnS2.Value(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt PointOnFace2(const int N) const { return myPointsOnS2.Value(N).Value(); } private: - Extrema_ExtSS myExtSS; - TColStd_SequenceOfReal mySqDist; - Extrema_SequenceOfPOnSurf myPointsOnS1; - Extrema_SequenceOfPOnSurf myPointsOnS2; - Handle(BRepAdaptor_Surface) myHS; + Extrema_ExtSS myExtSS; + NCollection_Sequence mySqDist; + NCollection_Sequence myPointsOnS1; + NCollection_Sequence myPointsOnS2; + occ::handle myHS; }; #endif diff --git a/opencascade/BRepExtrema_ExtPC.hxx b/opencascade/BRepExtrema_ExtPC.hxx index cefeb7895..722d8ef04 100644 --- a/opencascade/BRepExtrema_ExtPC.hxx +++ b/opencascade/BRepExtrema_ExtPC.hxx @@ -26,49 +26,46 @@ class BRepExtrema_ExtPC public: DEFINE_STANDARD_ALLOC - BRepExtrema_ExtPC() {} + BRepExtrema_ExtPC() = default; - //! It calculates all the distances.
+ //! It calculates all the distances. Standard_EXPORT BRepExtrema_ExtPC(const TopoDS_Vertex& V, const TopoDS_Edge& E); Standard_EXPORT void Initialize(const TopoDS_Edge& E); - //! An exception is raised if the fields have not been initialized.
+ //! An exception is raised if the fields have not been initialized. Standard_EXPORT void Perform(const TopoDS_Vertex& V); - //! True if the distances are found.
- Standard_Boolean IsDone() const { return myExtPC.IsDone(); } + //! True if the distances are found. + bool IsDone() const { return myExtPC.IsDone(); } - //! Returns the number of extremum distances.
- Standard_Integer NbExt() const { return myExtPC.NbExt(); } + //! Returns the number of extremum distances. + int NbExt() const { return myExtPC.NbExt(); } - //! Returns True if the th extremum distance is a minimum.
- Standard_Boolean IsMin(const Standard_Integer N) const { return myExtPC.IsMin(N); } + //! Returns True if the th extremum distance is a minimum. + bool IsMin(const int N) const { return myExtPC.IsMin(N); } - //! Returns the value of the th extremum square distance.
- Standard_Real SquareDistance(const Standard_Integer N) const { return myExtPC.SquareDistance(N); } + //! Returns the value of the th extremum square distance. + double SquareDistance(const int N) const { return myExtPC.SquareDistance(N); } - //! Returns the parameter on the edge of the th extremum distance.
- Standard_Real Parameter(const Standard_Integer N) const { return myExtPC.Point(N).Parameter(); } + //! Returns the parameter on the edge of the th extremum distance. + double Parameter(const int N) const { return myExtPC.Point(N).Parameter(); } - //! Returns the Point of the th extremum distance.
- gp_Pnt Point(const Standard_Integer N) const { return myExtPC.Point(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt Point(const int N) const { return myExtPC.Point(N).Value(); } - //! if the curve is a trimmed curve,
- //! dist1 is a square distance between

and the point
- //! of parameter FirstParameter and
- //! dist2 is a square distance between

and the point
- //! of parameter LastParameter .
- void TrimmedSquareDistances(Standard_Real& dist1, - Standard_Real& dist2, - gp_Pnt& pnt1, - gp_Pnt& pnt2) const + //! if the curve is a trimmed curve, + //! dist1 is a square distance between

and the point + //! of parameter FirstParameter and + //! dist2 is a square distance between

and the point + //! of parameter LastParameter . + void TrimmedSquareDistances(double& dist1, double& dist2, gp_Pnt& pnt1, gp_Pnt& pnt2) const { myExtPC.TrimmedSquareDistances(dist1, dist2, pnt1, pnt2); } private: - Extrema_ExtPC myExtPC; - Handle(BRepAdaptor_Curve) myHC; + Extrema_ExtPC myExtPC; + occ::handle myHC; }; #endif diff --git a/opencascade/BRepExtrema_ExtPF.hxx b/opencascade/BRepExtrema_ExtPF.hxx index 50622a6cb..64853db4a 100644 --- a/opencascade/BRepExtrema_ExtPF.hxx +++ b/opencascade/BRepExtrema_ExtPF.hxx @@ -15,8 +15,8 @@ #define _BRepExtrema_ExtPF_HeaderFile #include -#include -#include +#include +#include #include #include #include @@ -29,9 +29,9 @@ class BRepExtrema_ExtPF public: DEFINE_STANDARD_ALLOC - BRepExtrema_ExtPF() {} + BRepExtrema_ExtPF() = default; - //! It calculates all the distances.
+ //! It calculates all the distances. Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace, const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX, @@ -41,37 +41,34 @@ public: const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad); - //! An exception is raised if the fields have not been initialized.
- //! Be careful: this method uses the Face only for classify not for the fields.
+ //! An exception is raised if the fields have not been initialized. + //! Be careful: this method uses the Face only for classify not for the fields. Standard_EXPORT void Perform(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace); - //! True if the distances are found.
- Standard_Boolean IsDone() const { return myExtPS.IsDone(); } + //! True if the distances are found. + bool IsDone() const { return myExtPS.IsDone(); } - //! Returns the number of extremum distances.
- Standard_Integer NbExt() const { return myPoints.Length(); } + //! Returns the number of extremum distances. + int NbExt() const { return myPoints.Length(); } - //! Returns the value of the th extremum square distance.
- Standard_Real SquareDistance(const Standard_Integer N) const { return mySqDist.Value(N); } + //! Returns the value of the th extremum square distance. + double SquareDistance(const int N) const { return mySqDist.Value(N); } - //! Returns the parameters on the Face of the th extremum distance.
- void Parameter(const Standard_Integer N, Standard_Real& U, Standard_Real& V) const - { - myPoints.Value(N).Parameter(U, V); - } + //! Returns the parameters on the Face of the th extremum distance. + void Parameter(const int N, double& U, double& V) const { myPoints.Value(N).Parameter(U, V); } - //! Returns the Point of the th extremum distance.
- gp_Pnt Point(const Standard_Integer N) const { return myPoints.Value(N).Value(); } + //! Returns the Point of the th extremum distance. + gp_Pnt Point(const int N) const { return myPoints.Value(N).Value(); } void SetFlag(const Extrema_ExtFlag F) { myExtPS.SetFlag(F); } void SetAlgo(const Extrema_ExtAlgo A) { myExtPS.SetAlgo(A); } private: - Extrema_ExtPS myExtPS; - TColStd_SequenceOfReal mySqDist; - Extrema_SequenceOfPOnSurf myPoints; - BRepAdaptor_Surface mySurf; + Extrema_ExtPS myExtPS; + NCollection_Sequence mySqDist; + NCollection_Sequence myPoints; + BRepAdaptor_Surface mySurf; }; #endif diff --git a/opencascade/BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx b/opencascade/BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx index 2906b69f2..7bf366b3f 100644 --- a/opencascade/BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx +++ b/opencascade/BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx @@ -1,6 +1,4 @@ -// Created on: 2015-05-13 -// Created by: Denis BOGOLEPOV -// Copyright (c) 2015 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -13,14 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _BRepExtrema_MapOfIntegerPackedMapOfInteger_HeaderFile -#define _BRepExtrema_MapOfIntegerPackedMapOfInteger_HeaderFile +//! @file BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_DataMap directly instead. +#ifndef _BRepExtrema_MapOfIntegerPackedMapOfInteger_hxx +#define _BRepExtrema_MapOfIntegerPackedMapOfInteger_hxx + +#include #include #include -//! Set of overlapped sub-shapes. -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED( + "BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_DataMap directly.") + + Standard_DEPRECATED("BRepExtrema_MapOfIntegerPackedMapOfInteger is deprecated, use " + "NCollection_DataMap directly") +typedef NCollection_DataMap BRepExtrema_MapOfIntegerPackedMapOfInteger; -#endif // _BRepExtrema_MapOfIntegerPackedMapOfInteger_HeaderFile +#endif // _BRepExtrema_MapOfIntegerPackedMapOfInteger_hxx diff --git a/opencascade/BRepExtrema_OverlapTool.hxx b/opencascade/BRepExtrema_OverlapTool.hxx index e8bc4c43a..ec881c0fa 100644 --- a/opencascade/BRepExtrema_OverlapTool.hxx +++ b/opencascade/BRepExtrema_OverlapTool.hxx @@ -18,7 +18,8 @@ #include #include -#include +#include +#include #include //! Enables storing of individual overlapped triangles (useful for debug). @@ -35,38 +36,38 @@ //! In second case, tessellation of single shape will be tested for self- //! intersections. Please note that algorithm results are approximate and //! depend greatly on the quality of input tessellation(s). -class BRepExtrema_OverlapTool : public BVH_PairTraverse +class BRepExtrema_OverlapTool : public BVH_PairTraverse { public: //! Creates new uninitialized overlap tool. BRepExtrema_OverlapTool(); //! Creates new overlap tool for the given element sets. - BRepExtrema_OverlapTool(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Handle(BRepExtrema_TriangleSet)& theSet2); + BRepExtrema_OverlapTool(const occ::handle& theSet1, + const occ::handle& theSet2); public: //! Loads the given element sets into the overlap tool. - void LoadTriangleSets(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Handle(BRepExtrema_TriangleSet)& theSet2); + void LoadTriangleSets(const occ::handle& theSet1, + const occ::handle& theSet2); //! Performs searching of overlapped mesh elements. - void Perform(const Standard_Real theTolerance = 0.0); + void Perform(const double theTolerance = 0.0); //! Is overlap test completed? - Standard_Boolean IsDone() const { return myIsDone; } + bool IsDone() const { return myIsDone; } //! Marks test results as outdated. - void MarkDirty() { myIsDone = Standard_False; } + void MarkDirty() { myIsDone = false; } //! Returns set of overlapped sub-shapes of 1st shape (currently only faces are detected). - const BRepExtrema_MapOfIntegerPackedMapOfInteger& OverlapSubShapes1() const + const NCollection_DataMap& OverlapSubShapes1() const { return myOverlapSubShapes1; } //! Returns set of overlapped sub-shapes of 2nd shape (currently only faces are detected). - const BRepExtrema_MapOfIntegerPackedMapOfInteger& OverlapSubShapes2() const + const NCollection_DataMap& OverlapSubShapes2() const { return myOverlapSubShapes2; } @@ -84,39 +85,34 @@ public: public: //! @name Reject/Accept implementations //! Defines the rules for node rejection by bounding box - Standard_EXPORT virtual Standard_Boolean RejectNode(const BVH_Vec3d& theCornerMin1, - const BVH_Vec3d& theCornerMax1, - const BVH_Vec3d& theCornerMin2, - const BVH_Vec3d& theCornerMax2, - Standard_Real&) const Standard_OVERRIDE; + Standard_EXPORT bool RejectNode(const BVH_Vec3d& theCornerMin1, + const BVH_Vec3d& theCornerMax1, + const BVH_Vec3d& theCornerMin2, + const BVH_Vec3d& theCornerMax2, + double&) const override; //! Defines the rules for leaf acceptance - Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer theLeaf1, - const Standard_Integer theLeaf2) - Standard_OVERRIDE; + Standard_EXPORT bool Accept(const int theLeaf1, const int theLeaf2) override; protected: //! Performs narrow-phase of overlap test (exact intersection). - void intersectTrianglesExact(const Standard_Integer theTrgIdx1, - const Standard_Integer theTrgIdx2); + void intersectTrianglesExact(const int theTrgIdx1, const int theTrgIdx2); //! Performs narrow-phase of overlap test (intersection with non-zero tolerance). - void intersectTrianglesToler(const Standard_Integer theTrgIdx1, - const Standard_Integer theTrgIdx2, - const Standard_Real theToler); + void intersectTrianglesToler(const int theTrgIdx1, const int theTrgIdx2, const double theToler); private: //! Set of all mesh elements (triangles) of the 1st shape. - Handle(BRepExtrema_TriangleSet) mySet1; + occ::handle mySet1; //! Set of all mesh elements (triangles) of the 2nd shape. - Handle(BRepExtrema_TriangleSet) mySet2; + occ::handle mySet2; //! Filter for preliminary checking pairs of mesh elements. BRepExtrema_ElementFilter* myFilter; //! Resulted set of overlapped sub-shapes of 1st shape (only faces). - BRepExtrema_MapOfIntegerPackedMapOfInteger myOverlapSubShapes1; + NCollection_DataMap myOverlapSubShapes1; //! Resulted set of overlapped sub-shapes of 2nd shape (only faces). - BRepExtrema_MapOfIntegerPackedMapOfInteger myOverlapSubShapes2; + NCollection_DataMap myOverlapSubShapes2; #ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES //! Set of overlapped elements from the 1st shape (only triangles). @@ -126,9 +122,9 @@ private: #endif //! Is overlap test test completed? - Standard_Boolean myIsDone; + bool myIsDone; - Standard_Real myTolerance; + double myTolerance; }; #endif // _BRepExtrema_OverlapTool_HeaderFile diff --git a/opencascade/BRepExtrema_Poly.hxx b/opencascade/BRepExtrema_Poly.hxx index 3cf1669b7..ac532b5ee 100644 --- a/opencascade/BRepExtrema_Poly.hxx +++ b/opencascade/BRepExtrema_Poly.hxx @@ -22,12 +22,12 @@ class gp_Pnt; class BRepExtrema_Poly { public: - //! returns Standard_True if OK. - Standard_EXPORT static Standard_Boolean Distance(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - gp_Pnt& P1, - gp_Pnt& P2, - Standard_Real& dist); + //! returns true if OK. + Standard_EXPORT static bool Distance(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + gp_Pnt& P1, + gp_Pnt& P2, + double& dist); }; #endif diff --git a/opencascade/BRepExtrema_ProximityDistTool.hxx b/opencascade/BRepExtrema_ProximityDistTool.hxx index 9af9dc6c5..bb9aff340 100644 --- a/opencascade/BRepExtrema_ProximityDistTool.hxx +++ b/opencascade/BRepExtrema_ProximityDistTool.hxx @@ -17,7 +17,8 @@ #define _BRepExtrema_ProximityDistTool_HeaderFile #include -#include +#include +#include #include #include #include @@ -34,10 +35,10 @@ //! Please note that algorithm results are approximate and depend greatly //! on the quality of input tessellation(s). class BRepExtrema_ProximityDistTool - : public BVH_Distance + : public BVH_Distance { public: - typedef typename BVH_Tools::BVH_PrjStateInTriangle BVH_PrjState; + typedef typename BVH_Tools::BVH_PrjStateInTriangle BVH_PrjState; enum ProxPnt_Status { @@ -59,10 +60,10 @@ public: { } - PrjState(const Standard_Integer theTrgIdx, - const BVH_PrjState thePrjState, - const Standard_Integer theNumberOfFirstNode, - const Standard_Integer theNumberOfLastNode) + PrjState(const int theTrgIdx, + const BVH_PrjState thePrjState, + const int theNumberOfFirstNode, + const int theNumberOfLastNode) : myTrgIdx(theTrgIdx), myPrjState(thePrjState), myNumberOfFirstNode(theNumberOfFirstNode), @@ -70,21 +71,21 @@ public: { } - Standard_Integer GetTrgIdx() const { return myTrgIdx; } + int GetTrgIdx() const { return myTrgIdx; } BVH_PrjState GetPrjState() const { return myPrjState; } - Standard_Integer GetNumberOfFirstNode() const { return myNumberOfFirstNode; } + int GetNumberOfFirstNode() const { return myNumberOfFirstNode; } - Standard_Integer GetNumberOfLastNode() const { return myNumberOfLastNode; } + int GetNumberOfLastNode() const { return myNumberOfLastNode; } private: - Standard_Integer myTrgIdx; //!< Index of triangle on which the projection is located - BVH_PrjState myPrjState; //!< Position of a projection on the triangle (vertex, edge, inner) - // clang-format off - Standard_Integer myNumberOfFirstNode; //!< The 1st vtx of the triangle edge on which the projection is located - Standard_Integer myNumberOfLastNode; //!< The 2nd vtx of the triangle edge on which the projection is located - // clang-format on + int myTrgIdx; //!< Index of triangle on which the projection is located + BVH_PrjState myPrjState; //!< Position of a projection on the triangle (vertex, edge, inner) + // clang-format off + int myNumberOfFirstNode; //!< The 1st vtx of the triangle edge on which the projection is located + int myNumberOfLastNode; //!< The 2nd vtx of the triangle edge on which the projection is located + // clang-format on }; public: @@ -93,52 +94,49 @@ public: //! Creates new tool for the given element sets. Standard_EXPORT BRepExtrema_ProximityDistTool( - const Handle(BRepExtrema_TriangleSet)& theSet1, - const Standard_Integer theNbSamples1, - const BVH_Array3d& theAddVertices1, - const NCollection_Vector& theAddStatus1, - const Handle(BRepExtrema_TriangleSet)& theSet2, - const BRepExtrema_ShapeList& theShapeList1, - const BRepExtrema_ShapeList& theShapeList2); + const occ::handle& theSet1, + const int theNbSamples1, + const BVH_Array3d& theAddVertices1, + const NCollection_DynamicArray& theAddStatus1, + const occ::handle& theSet2, + const NCollection_DynamicArray& theShapeList1, + const NCollection_DynamicArray& theShapeList2); public: //! Loads the given element sets into the tool. - Standard_EXPORT void LoadTriangleSets(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Handle(BRepExtrema_TriangleSet)& theSet2); + Standard_EXPORT void LoadTriangleSets(const occ::handle& theSet1, + const occ::handle& theSet2); //! Loads the given list of subshapes into the tool. - Standard_EXPORT void LoadShapeLists(const BRepExtrema_ShapeList& theShapeList1, - const BRepExtrema_ShapeList& theShapeList2); + Standard_EXPORT void LoadShapeLists(const NCollection_DynamicArray& theShapeList1, + const NCollection_DynamicArray& theShapeList2); //! Loads given additional vertices and their statuses. - void LoadAdditionalPointsFirstSet(const BVH_Array3d& theAddVertices1, - const NCollection_Vector& theAddStatus1); + void LoadAdditionalPointsFirstSet(const BVH_Array3d& theAddVertices1, + const NCollection_DynamicArray& theAddStatus1); //! Performs searching of the proximity distance. Standard_EXPORT void Perform(); public: //! @name Reject/Accept implementations //! Defines the rules for node rejection by bounding box. - Standard_EXPORT virtual Standard_Boolean RejectNode(const BVH_Vec3d& theCornerMin, - const BVH_Vec3d& theCornerMax, - Standard_Real& theMetric) const - Standard_OVERRIDE; + Standard_EXPORT bool RejectNode(const BVH_Vec3d& theCornerMin, + const BVH_Vec3d& theCornerMax, + double& theMetric) const override; //! Defines the rules for leaf acceptance. - Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer theSgmIdx, - const Standard_Real&) Standard_OVERRIDE; + Standard_EXPORT bool Accept(const int theSgmIdx, const double&) override; public: //! Returns true if the node is on the boarder. - Standard_EXPORT static Standard_Boolean IsNodeOnBorder(const Standard_Integer theNodeIdx, - const Handle(Poly_Triangulation)& theTr); + Standard_EXPORT static bool IsNodeOnBorder(const int theNodeIdx, + const occ::handle& theTr); //! Returns true if the edge is on the boarder. - Standard_EXPORT static Standard_Boolean IsEdgeOnBorder( - const Standard_Integer theTrgIdx, - const Standard_Integer theFirstEdgeNodeIdx, - const Standard_Integer theSecondEdgeNodeIdx, - const Handle(Poly_Triangulation)& theTr); + Standard_EXPORT static bool IsEdgeOnBorder(const int theTrgIdx, + const int theFirstEdgeNodeIdx, + const int theSecondEdgeNodeIdx, + const occ::handle& theTr); public: //! Returns points on triangles sets, which provide the proximity distance. @@ -156,18 +154,18 @@ public: } //! Returns the computed distance - Standard_Real ProximityDistance() const { return myProxDist; } + double ProximityDistance() const { return myProxDist; } protected: //! Computes the distance between object and BVH tree. - Standard_EXPORT Standard_Real ComputeDistance(); + Standard_EXPORT double ComputeDistance(); //! Defines the status of proximity points. Standard_EXPORT void DefineStatusProxPnt(); private: //! Goes through vertices from the 1st set. - void goThroughtSet1(const BVH_Array3d& aVertices1, const Standard_Boolean theIsAdditionalSet); + void goThroughtSet1(const BVH_Array3d& aVertices1, const bool theIsAdditionalSet); //! Defines the status of proximity point from 1st BVH. void defineStatusProxPnt1(); @@ -177,13 +175,13 @@ private: protected: // clang-format off - Standard_Real myMinDistance; //!< Minimal distance from point to BVH, could be not equal to myDistance + double myMinDistance; //!< Minimal distance from point to BVH, could be not equal to myDistance // clang-format on BVH_Vec3d myMinDistPoint; //!< Point on BVH providing the minimal distance BVH_Vec3d myExtremaPoint; //!< Point on BVH providing the extrema - Standard_Real myProxDist; //!< Proximity distance + double myProxDist; //!< Proximity distance //! Proximity points BVH_Vec3d myPnt1, myPnt2; @@ -193,26 +191,26 @@ protected: private: //! Set of all mesh elements (triangles) of the 1st shape. - Handle(BRepExtrema_TriangleSet) mySet1; + occ::handle mySet1; //! Set of all mesh elements (triangles) of the 2nd shape. - Handle(BRepExtrema_TriangleSet) mySet2; + occ::handle mySet2; //! List of subshapes of the 1st shape. - BRepExtrema_ShapeList myShapeList1; + NCollection_DynamicArray myShapeList1; //! List of subshapes of the 2nd shape. - BRepExtrema_ShapeList myShapeList2; + NCollection_DynamicArray myShapeList2; - Standard_Integer myNbSamples1; //!< Number of samples points on the first shape + int myNbSamples1; //!< Number of samples points on the first shape //! Is vertex corresponding to proximity point of 1st shape from additional set - Standard_Integer myIsProxVtx1FromAddSet; - BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape - // clang-format off - NCollection_Vector myAddStatus1; //!< Status of additional vertices on the 1st shape - // clang-format on + int myIsProxVtx1FromAddSet; + BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape + // clang-format off + NCollection_DynamicArray myAddStatus1; //!< Status of additional vertices on the 1st shape + // clang-format on //! Vertex index from 1st BVH corresponding to proximity point of 1st shape - Standard_Integer myProxVtxIdx1; + int myProxVtxIdx1; //! Information of projection point state from 2nd BVH providing proximity point of 2nd shape PrjState myProxPrjState; diff --git a/opencascade/BRepExtrema_ProximityValueTool.hxx b/opencascade/BRepExtrema_ProximityValueTool.hxx index af762fc02..ea7016e97 100644 --- a/opencascade/BRepExtrema_ProximityValueTool.hxx +++ b/opencascade/BRepExtrema_ProximityValueTool.hxx @@ -1,4 +1,4 @@ -// Created on: 2022-08-08 +// Created on: 2022-08-08 // Created by: Kseniya NOSULKO // Copyright (c) 2022 OPEN CASCADE SAS // @@ -21,22 +21,29 @@ #include #include -typedef NCollection_Vector VectorOfPoint; +typedef NCollection_DynamicArray VectorOfPoint; -//! Class BRepExtrema_VertexInspector -//! derived from NCollection_CellFilter_InspectorXYZ -//! This class define the Inspector interface for CellFilter algorithm, -//! working with gp_XYZ points in 3d space. -//! Used in search of coincidence points with a certain tolerance. -class BRepExtrema_VertexInspector : public NCollection_CellFilter_InspectorXYZ +//! Inspector for CellFilter algorithm working with gp_XYZ points in 3d space. +//! Used in search of coincidence points with a certain tolerance. +class BRepExtrema_VertexInspector { public: - typedef Standard_Integer Target; + static constexpr int Dimension = 3; + + typedef gp_XYZ Point; + typedef int Target; + + static double Coord(int i, const Point& thePnt) { return thePnt.Coord(i + 1); } + + static Point Shift(const Point& thePnt, double theTol) + { + return Point(thePnt.X() + theTol, thePnt.Y() + theTol, thePnt.Z() + theTol); + } //! Constructor; remembers the tolerance BRepExtrema_VertexInspector() : myTol(Precision::SquareConfusion()), - myIsNeedAdd(Standard_True) + myIsNeedAdd(true) { } @@ -44,28 +51,27 @@ public: void Add(const gp_XYZ& thePnt) { myPoints.Append(thePnt); } //! Set tolerance for comparison of point coordinates - void SetTol(const Standard_Real theTol) { myTol = theTol; } + void SetTol(const double theTol) { myTol = theTol; } //! Set current point to search for coincidence void SetCurrent(const gp_XYZ& theCurPnt) { myCurrent = theCurPnt; - myIsNeedAdd = Standard_True; + myIsNeedAdd = true; } - Standard_Boolean IsNeedAdd() { return myIsNeedAdd; } + bool IsNeedAdd() const { return myIsNeedAdd; } //! Implementation of inspection method - Standard_EXPORT NCollection_CellFilter_Action Inspect(const Standard_Integer theTarget); + Standard_EXPORT NCollection_CellFilter_Action Inspect(const int theTarget); private: - Standard_Real myTol; - Standard_Boolean myIsNeedAdd; - VectorOfPoint myPoints; - gp_XYZ myCurrent; + double myTol; + bool myIsNeedAdd; + VectorOfPoint myPoints; + gp_XYZ myCurrent; }; -typedef NCollection_CellFilter BRepExtrema_CellFilter; typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status; //! Tool class for computation of the proximity value from one BVH @@ -85,36 +91,36 @@ public: Standard_EXPORT BRepExtrema_ProximityValueTool(); //! Creates new proximity tool for the given element sets. - Standard_EXPORT BRepExtrema_ProximityValueTool(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Handle(BRepExtrema_TriangleSet)& theSet2, - const BRepExtrema_ShapeList& theShapeList1, - const BRepExtrema_ShapeList& theShapeList2); + Standard_EXPORT BRepExtrema_ProximityValueTool( + const occ::handle& theSet1, + const occ::handle& theSet2, + const NCollection_DynamicArray& theShapeList1, + const NCollection_DynamicArray& theShapeList2); public: //! Loads the given element sets into the proximity tool. - Standard_EXPORT void LoadTriangleSets(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Handle(BRepExtrema_TriangleSet)& theSet2); + Standard_EXPORT void LoadTriangleSets(const occ::handle& theSet1, + const occ::handle& theSet2); //! Loads the given list of subshapes into the proximity tool. - Standard_EXPORT void LoadShapeLists(const BRepExtrema_ShapeList& theShapeList1, - const BRepExtrema_ShapeList& theShapeList2); + Standard_EXPORT void LoadShapeLists(const NCollection_DynamicArray& theShapeList1, + const NCollection_DynamicArray& theShapeList2); //! Sets number of sample points used for proximity calculation for each shape. //! If number is less or equal zero, all triangulation nodes are used. - Standard_EXPORT void SetNbSamplePoints(const Standard_Integer theSamples1 = 0, - const Standard_Integer theSamples2 = 0); + Standard_EXPORT void SetNbSamplePoints(const int theSamples1 = 0, const int theSamples2 = 0); //! Performs the computation of the proximity value. - Standard_EXPORT void Perform(Standard_Real& theTolerance); + Standard_EXPORT void Perform(double& theTolerance); //! Is proximity test completed? - Standard_Boolean IsDone() const { return myIsDone; } + bool IsDone() const { return myIsDone; } //! Marks test results as outdated. - void MarkDirty() { myIsDone = Standard_False; } + void MarkDirty() { myIsDone = false; } //! Returns the computed distance. - Standard_Real Distance() const { return myDistance; } + double Distance() const { return myDistance; } //! Returns points on triangles sets, which provide the proximity distance. void ProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2) const @@ -132,58 +138,58 @@ public: private: //! Gets shape data for further refinement. - Standard_Boolean getInfoForRefinement(const TopoDS_Shape& theShapes, - TopAbs_ShapeEnum& theShapeType, - Standard_Integer& theNbNodes, - Standard_Real& theStep); + bool getInfoForRefinement(const TopoDS_Shape& theShapes, + TopAbs_ShapeEnum& theShapeType, + int& theNbNodes, + double& theStep); //! Returns the computed proximity value from first BVH to another one. - Standard_Real computeProximityDist(const Handle(BRepExtrema_TriangleSet)& theSet1, - const Standard_Integer theNbSamples1, - const BVH_Array3d& theAddVertices1, - const NCollection_Vector& theAddStatus1, - const Handle(BRepExtrema_TriangleSet)& theSet2, - const BRepExtrema_ShapeList& theShapeList1, - const BRepExtrema_ShapeList& theShapeList2, - BVH_Vec3d& thePoint1, - BVH_Vec3d& thePoint2, - ProxPnt_Status& thePointStatus1, - ProxPnt_Status& thePointStatus2) const; + double computeProximityDist(const occ::handle& theSet1, + const int theNbSamples1, + const BVH_Array3d& theAddVertices1, + const NCollection_DynamicArray& theAddStatus1, + const occ::handle& theSet2, + const NCollection_DynamicArray& theShapeList1, + const NCollection_DynamicArray& theShapeList2, + BVH_Vec3d& thePoint1, + BVH_Vec3d& thePoint2, + ProxPnt_Status& thePointStatus1, + ProxPnt_Status& thePointStatus2) const; //! Gets additional vertices on shapes with refining a coarser one if it's needed. - Standard_Boolean getShapesAdditionalVertices(); + bool getShapesAdditionalVertices(); //! Gets additional vertices and their statuses on the edge with the input step. - Standard_Boolean getEdgeAdditionalVertices(const TopoDS_Edge& theEdge, - const Standard_Real theStep, - BVH_Array3d& theAddVertices, - NCollection_Vector& theAddStatuses); + bool getEdgeAdditionalVertices(const TopoDS_Edge& theEdge, + const double theStep, + BVH_Array3d& theAddVertices, + NCollection_DynamicArray& theAddStatuses); //! Gets additional vertices and their statuses on the face with the input step (triangle square). - Standard_Boolean getFaceAdditionalVertices(const TopoDS_Face& theFace, - const Standard_Real theStep, - BVH_Array3d& theAddVertices, - NCollection_Vector& theAddStatuses); + bool getFaceAdditionalVertices(const TopoDS_Face& theFace, + const double theStep, + BVH_Array3d& theAddVertices, + NCollection_DynamicArray& theAddStatuses); //! Splits the triangle recursively, halving the longest side - //! to the area of ​​the current triangle > input step + //! to the area of the current triangle > input step void doRecurTrgSplit(const gp_Pnt (&theTrg)[3], const ProxPnt_Status (&theEdgesStatus)[3], - const Standard_Real theTol, - const Standard_Real theStep, - BVH_Array3d& theAddVertices, - NCollection_Vector& theAddStatuses); + const double theTol, + const double theStep, + BVH_Array3d& theAddVertices, + NCollection_DynamicArray& theAddStatuses); private: //! Set of all mesh primitives of the 1st shape. - Handle(BRepExtrema_TriangleSet) mySet1; + occ::handle mySet1; //! Set of all mesh primitives of the 2nd shape. - Handle(BRepExtrema_TriangleSet) mySet2; + occ::handle mySet2; //! List of subshapes of the 1st shape. - BRepExtrema_ShapeList myShapeList1; + NCollection_DynamicArray myShapeList1; //! List of subshapes of the 2nd shape. - BRepExtrema_ShapeList myShapeList2; + NCollection_DynamicArray myShapeList2; //! The 1st shape. TopoDS_Shape myShape1; @@ -194,33 +200,33 @@ private: BVH_Array3d myAddVertices2; //!< Additional vertices on the 2nd shape if its mesh is coarser. // clang-format off - NCollection_Vector myAddStatus1; //!< Status of additional vertices on the 1st shape. - NCollection_Vector myAddStatus2; //!< Status of additional vertices on the 2nd shape. + NCollection_DynamicArray myAddStatus1; //!< Status of additional vertices on the 1st shape. + NCollection_DynamicArray myAddStatus2; //!< Status of additional vertices on the 2nd shape. // clang-format on - Standard_Boolean myIsInitS1; //!< Is the 1st shape initialized? - Standard_Boolean myIsInitS2; //!< Is the 2nd shape initialized? + bool myIsInitS1; //!< Is the 1st shape initialized? + bool myIsInitS2; //!< Is the 2nd shape initialized? - Standard_Boolean myIsRefinementRequired1; //!< Flag about the need to refine the 1st shape. - Standard_Boolean myIsRefinementRequired2; //!< Flag about the need to refine the 2nd shape. + bool myIsRefinementRequired1; //!< Flag about the need to refine the 1st shape. + bool myIsRefinementRequired2; //!< Flag about the need to refine the 2nd shape. - Standard_Integer myNbNodes1; //!< Number of nodes in triangulation of the 1st shape. - Standard_Integer myNbNodes2; //!< Number of nodes in triangulation of the 2nd shape. + int myNbNodes1; //!< Number of nodes in triangulation of the 1st shape. + int myNbNodes2; //!< Number of nodes in triangulation of the 2nd shape. - Standard_Real myStep1; //!< Step for getting vertices on the 1st shape. - Standard_Real myStep2; //!< Step for getting vertices on the 2nd shape. + double myStep1; //!< Step for getting vertices on the 1st shape. + double myStep2; //!< Step for getting vertices on the 2nd shape. - BRepExtrema_CellFilter myCells; - BRepExtrema_VertexInspector myInspector; + NCollection_CellFilter myCells; + BRepExtrema_VertexInspector myInspector; TopAbs_ShapeEnum myShapeType1; //!< 1st shape type. TopAbs_ShapeEnum myShapeType2; //!< 2nd shape type. - Standard_Real myDistance; //!< Distance - Standard_Boolean myIsDone; //!< State of the algorithm + double myDistance; //!< Distance + bool myIsDone; //!< State of the algorithm - Standard_Integer myNbSamples1; //!< Number of samples points on the first shape - Standard_Integer myNbSamples2; //!< Number of samples points on the second shape + int myNbSamples1; //!< Number of samples points on the first shape + int myNbSamples2; //!< Number of samples points on the second shape //! Proximity points gp_Pnt myPnt1, myPnt2; diff --git a/opencascade/BRepExtrema_SelfIntersection.hxx b/opencascade/BRepExtrema_SelfIntersection.hxx index 915b7fac4..aee5e57e8 100644 --- a/opencascade/BRepExtrema_SelfIntersection.hxx +++ b/opencascade/BRepExtrema_SelfIntersection.hxx @@ -37,42 +37,42 @@ class BRepExtrema_SelfIntersection : public BRepExtrema_ElementFilter public: //! Creates uninitialized self-intersection tool. - Standard_EXPORT BRepExtrema_SelfIntersection(const Standard_Real theTolerance = 0.0); + Standard_EXPORT BRepExtrema_SelfIntersection(const double theTolerance = 0.0); //! Creates self-intersection tool for the given shape. Standard_EXPORT BRepExtrema_SelfIntersection(const TopoDS_Shape& theShape, - const Standard_Real theTolerance = 0.0); + const double theTolerance = 0.0); public: //! Returns tolerance value used for self-intersection test. - Standard_Real Tolerance() const { return myTolerance; } + double Tolerance() const { return myTolerance; } //! Sets tolerance value used for self-intersection test. - void SetTolerance(const Standard_Real theTolerance) { myTolerance = theTolerance; } + void SetTolerance(const double theTolerance) { myTolerance = theTolerance; } //! Loads shape for detection of self-intersections. - Standard_EXPORT Standard_Boolean LoadShape(const TopoDS_Shape& theShape); + Standard_EXPORT bool LoadShape(const TopoDS_Shape& theShape); //! Performs detection of self-intersections. Standard_EXPORT void Perform(); //! True if the detection is completed. - Standard_Boolean IsDone() const { return myOverlapTool.IsDone(); } + bool IsDone() const { return myOverlapTool.IsDone(); } //! Returns set of IDs of overlapped sub-shapes (started from 0). - const BRepExtrema_MapOfIntegerPackedMapOfInteger& OverlapElements() const + const NCollection_DataMap& OverlapElements() const { return myOverlapTool.OverlapSubShapes1(); } //! Returns sub-shape from the shape for the given index (started from 0). - const TopoDS_Face& GetSubShape(const Standard_Integer theID) const + const TopoDS_Face& GetSubShape(const int theID) const { return TopoDS::Face(myFaceList.Value(theID)); } //! Returns set of all the face triangles of the shape. - const Handle(BRepExtrema_TriangleSet)& ElementSet() const { return myElementSet; } + const occ::handle& ElementSet() const { return myElementSet; } #ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES //! Returns set of overlapped mesh elements (only triangles). @@ -84,9 +84,9 @@ public: protected: //! Filter out correct adjacent mesh elements. - Standard_EXPORT virtual BRepExtrema_ElementFilter::FilterResult PreCheckElements( - const Standard_Integer theIndex1, - const Standard_Integer theIndex2); + Standard_EXPORT BRepExtrema_ElementFilter::FilterResult PreCheckElements( + const int theIndex1, + const int theIndex2) override; //! Checks if the given triangles have only single common vertex. Standard_EXPORT BRepExtrema_ElementFilter::FilterResult isRegularSharedVertex( @@ -105,16 +105,16 @@ protected: private: //! Self-intersection tolerance. - Standard_Real myTolerance; + double myTolerance; //! Is the input shape inited? - Standard_Boolean myIsInit; + bool myIsInit; //! List of triangulated faces of the shape. - BRepExtrema_ShapeList myFaceList; + NCollection_DynamicArray myFaceList; //! Set of all the face triangles of the shape. - Handle(BRepExtrema_TriangleSet) myElementSet; + occ::handle myElementSet; //! Overlap tool used for self-intersection test. BRepExtrema_OverlapTool myOverlapTool; diff --git a/opencascade/BRepExtrema_SeqOfSolution.hxx b/opencascade/BRepExtrema_SeqOfSolution.hxx index 680477415..ce84e4648 100644 --- a/opencascade/BRepExtrema_SeqOfSolution.hxx +++ b/opencascade/BRepExtrema_SeqOfSolution.hxx @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -11,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef _BRepExtrema_SeqOfSolution_HeaderFile -#define _BRepExtrema_SeqOfSolution_HeaderFile +//! @file BRepExtrema_SeqOfSolution.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _BRepExtrema_SeqOfSolution_hxx +#define _BRepExtrema_SeqOfSolution_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepExtrema_SeqOfSolution.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence directly.") + + Standard_DEPRECATED("BRepExtrema_SeqOfSolution is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence BRepExtrema_SeqOfSolution; -#endif +#endif // _BRepExtrema_SeqOfSolution_hxx diff --git a/opencascade/BRepExtrema_ShapeProximity.hxx b/opencascade/BRepExtrema_ShapeProximity.hxx index da49d7e49..e006ef8e1 100644 --- a/opencascade/BRepExtrema_ShapeProximity.hxx +++ b/opencascade/BRepExtrema_ShapeProximity.hxx @@ -50,74 +50,66 @@ class BRepExtrema_ShapeProximity public: //! Creates empty proximity tool. - Standard_EXPORT BRepExtrema_ShapeProximity( - const Standard_Real theTolerance = Precision::Infinite()); + Standard_EXPORT BRepExtrema_ShapeProximity(const double theTolerance = Precision::Infinite()); //! Creates proximity tool for the given two shapes. - Standard_EXPORT BRepExtrema_ShapeProximity( - const TopoDS_Shape& theShape1, - const TopoDS_Shape& theShape2, - const Standard_Real theTolerance = Precision::Infinite()); + Standard_EXPORT BRepExtrema_ShapeProximity(const TopoDS_Shape& theShape1, + const TopoDS_Shape& theShape2, + const double theTolerance = Precision::Infinite()); public: //! Returns tolerance value for overlap test (distance between shapes). - Standard_Real Tolerance() const { return myTolerance; } + double Tolerance() const { return myTolerance; } //! Sets tolerance value for overlap test (distance between shapes). - void SetTolerance(const Standard_Real theTolerance) { myTolerance = theTolerance; } + void SetTolerance(const double theTolerance) { myTolerance = theTolerance; } //! Returns proximity value calculated for the whole input shapes. - Standard_Real Proximity() const { return Tolerance(); } + double Proximity() const { return Tolerance(); } //! Loads 1st shape into proximity tool. - Standard_EXPORT Standard_Boolean LoadShape1(const TopoDS_Shape& theShape1); + Standard_EXPORT bool LoadShape1(const TopoDS_Shape& theShape1); //! Loads 2nd shape into proximity tool. - Standard_EXPORT Standard_Boolean LoadShape2(const TopoDS_Shape& theShape2); + Standard_EXPORT bool LoadShape2(const TopoDS_Shape& theShape2); //! Set number of sample points on the 1st shape used to compute the proximity value. //! In case of 0, all triangulation nodes will be used. - void SetNbSamples1(const Standard_Integer theNbSamples) { myNbSamples1 = theNbSamples; } + void SetNbSamples1(const int theNbSamples) { myNbSamples1 = theNbSamples; } //! Set number of sample points on the 2nd shape used to compute the proximity value. //! In case of 0, all triangulation nodes will be used. - void SetNbSamples2(const Standard_Integer theNbSamples) { myNbSamples2 = theNbSamples; } + void SetNbSamples2(const int theNbSamples) { myNbSamples2 = theNbSamples; } //! Performs search of overlapped faces. Standard_EXPORT void Perform(); //! True if the search is completed. - Standard_Boolean IsDone() const { return myOverlapTool.IsDone() || myProxValTool.IsDone(); } + bool IsDone() const { return myOverlapTool.IsDone() || myProxValTool.IsDone(); } //! Returns set of IDs of overlapped faces of 1st shape (started from 0). - const BRepExtrema_MapOfIntegerPackedMapOfInteger& OverlapSubShapes1() const + const NCollection_DataMap& OverlapSubShapes1() const { return myOverlapTool.OverlapSubShapes1(); } //! Returns set of IDs of overlapped faces of 2nd shape (started from 0). - const BRepExtrema_MapOfIntegerPackedMapOfInteger& OverlapSubShapes2() const + const NCollection_DataMap& OverlapSubShapes2() const { return myOverlapTool.OverlapSubShapes2(); } //! Returns sub-shape from 1st shape with the given index (started from 0). - const TopoDS_Shape& GetSubShape1(const Standard_Integer theID) const - { - return myShapeList1.Value(theID); - } + const TopoDS_Shape& GetSubShape1(const int theID) const { return myShapeList1.Value(theID); } //! Returns sub-shape from 1st shape with the given index (started from 0). - const TopoDS_Shape& GetSubShape2(const Standard_Integer theID) const - { - return myShapeList2.Value(theID); - } + const TopoDS_Shape& GetSubShape2(const int theID) const { return myShapeList2.Value(theID); } //! Returns set of all the face triangles of the 1st shape. - const Handle(BRepExtrema_TriangleSet)& ElementSet1() const { return myElementSet1; } + const occ::handle& ElementSet1() const { return myElementSet1; } //! Returns set of all the face triangles of the 2nd shape. - const Handle(BRepExtrema_TriangleSet)& ElementSet2() const { return myElementSet2; } + const occ::handle& ElementSet2() const { return myElementSet2; } //! Returns the point on the 1st shape, which could be used as a reference point //! for the value of the proximity. @@ -137,29 +129,29 @@ public: private: //! Maximum overlapping distance. - Standard_Real myTolerance; + double myTolerance; //! Is the 1st shape initialized? - Standard_Boolean myIsInitS1; + bool myIsInitS1; //! Is the 2nd shape initialized? - Standard_Boolean myIsInitS2; + bool myIsInitS2; //! List of subshapes of the 1st shape. - BRepExtrema_ShapeList myShapeList1; + NCollection_DynamicArray myShapeList1; //! List of subshapes of the 2nd shape. - BRepExtrema_ShapeList myShapeList2; + NCollection_DynamicArray myShapeList2; //! Set of all the face triangles of the 1st shape. - Handle(BRepExtrema_TriangleSet) myElementSet1; + occ::handle myElementSet1; //! Set of all the face triangles of the 2nd shape. - Handle(BRepExtrema_TriangleSet) myElementSet2; + occ::handle myElementSet2; //! Number of sample points on the 1st shape used to compute the proximity value //! (if zero (default), all triangulation nodes will be used). - Standard_Integer myNbSamples1; + int myNbSamples1; //! Number of sample points on the 2nd shape used to compute the proximity value //! (if zero (default), all triangulation nodes will be used). - Standard_Integer myNbSamples2; + int myNbSamples2; //! Reference point of the proximity value on the 1st shape. gp_Pnt myProxPoint1; diff --git a/opencascade/BRepExtrema_SolutionElem.hxx b/opencascade/BRepExtrema_SolutionElem.hxx index c923b9dfb..e0d2d9e26 100644 --- a/opencascade/BRepExtrema_SolutionElem.hxx +++ b/opencascade/BRepExtrema_SolutionElem.hxx @@ -42,7 +42,7 @@ public: //! @param thePoint the solution point //! @param theSolType the type of solution //! @param theVertex and the Vertex - BRepExtrema_SolutionElem(const Standard_Real theDist, + BRepExtrema_SolutionElem(const double theDist, const gp_Pnt& thePoint, const BRepExtrema_SupportType theSolType, const TopoDS_Vertex& theVertex) @@ -55,18 +55,18 @@ public: { } - //! This constructor is used when the solution of distance is on an Edge. + //! This constructor is used when the solution of distance is on an Edge. //! The different initialized fields are: //! @param theDist the distance //! @param thePoint the solution point //! @param theSolType the type of solution //! @param theEdge the Edge //! @param theParam the parameter to locate the solution - BRepExtrema_SolutionElem(const Standard_Real theDist, + BRepExtrema_SolutionElem(const double theDist, const gp_Pnt& thePoint, const BRepExtrema_SupportType theSolType, const TopoDS_Edge& theEdge, - const Standard_Real theParam) + const double theParam) : myDist(theDist), myPoint(thePoint), mySupType(theSolType), @@ -76,7 +76,7 @@ public: { } - //! This constructor is used when the solution of distance is in a Face. + //! This constructor is used when the solution of distance is in a Face. //! The different initialized fields are: //! @param theDist the distance //! @param thePoint the solution point @@ -84,12 +84,12 @@ public: //! @param theFace the Face //! @param theU U parameter to locate the solution //! @param theV V parameter to locate the solution - BRepExtrema_SolutionElem(const Standard_Real theDist, + BRepExtrema_SolutionElem(const double theDist, const gp_Pnt& thePoint, const BRepExtrema_SupportType theSolType, const TopoDS_Face& theFace, - const Standard_Real theU, - const Standard_Real theV) + const double theU, + const double theV) : myDist(theDist), myPoint(thePoint), mySupType(theSolType), @@ -100,7 +100,7 @@ public: } //! Returns the value of the minimum distance. - Standard_Real Dist() const { return myDist; } + double Dist() const { return myDist; } //! Returns the solution point. const gp_Pnt& Point() const { return myPoint; } @@ -121,24 +121,24 @@ public: const TopoDS_Face& Face() const { return myFace; } //! Returns the parameter value if the solution is on Edge. - void EdgeParameter(Standard_Real& theParam) const { theParam = myPar1; } + void EdgeParameter(double& theParam) const { theParam = myPar1; } //! Returns the parameters U and V if the solution is in a Face. - void FaceParameter(Standard_Real& theU, Standard_Real& theV) const + void FaceParameter(double& theU, double& theV) const { theU = myPar1; theV = myPar2; } private: - Standard_Real myDist; + double myDist; gp_Pnt myPoint; BRepExtrema_SupportType mySupType; TopoDS_Vertex myVertex; TopoDS_Edge myEdge; TopoDS_Face myFace; - Standard_Real myPar1; - Standard_Real myPar2; + double myPar1; + double myPar2; }; #endif diff --git a/opencascade/BRepExtrema_TriangleSet.hxx b/opencascade/BRepExtrema_TriangleSet.hxx index 04f21a2be..09021ae03 100644 --- a/opencascade/BRepExtrema_TriangleSet.hxx +++ b/opencascade/BRepExtrema_TriangleSet.hxx @@ -17,13 +17,14 @@ #define _BRepExtrema_TriangleSet_HeaderFile #include -#include -#include +#include +#include +#include +#include #include #include //! List of shapes and their IDs for collision detection. -typedef NCollection_Vector BRepExtrema_ShapeList; //! Triangle set corresponding to specific face. class BRepExtrema_TriangleSet : public BVH_PrimitiveSet3d @@ -33,75 +34,72 @@ public: Standard_EXPORT BRepExtrema_TriangleSet(); //! Creates triangle set from the given face. - Standard_EXPORT BRepExtrema_TriangleSet(const BRepExtrema_ShapeList& theFaces); + Standard_EXPORT BRepExtrema_TriangleSet(const NCollection_DynamicArray& theFaces); //! Releases resources of triangle set. - Standard_EXPORT ~BRepExtrema_TriangleSet(); + Standard_EXPORT ~BRepExtrema_TriangleSet() override; public: //! @name methods implementing BVH set interface //! Returns total number of triangles. - Standard_EXPORT Standard_Integer Size() const Standard_OVERRIDE; + Standard_EXPORT int Size() const override; //! Returns AABB of the given triangle. - Standard_EXPORT BVH_Box Box(const Standard_Integer theIndex) const - Standard_OVERRIDE; + Standard_EXPORT BVH_Box Box(const int theIndex) const override; //! Make inherited method Box() visible to avoid CLang warning using BVH_PrimitiveSet3d::Box; //! Returns centroid position along specified axis. - Standard_EXPORT Standard_Real Center(const Standard_Integer theIndex, - const Standard_Integer theAxis) const Standard_OVERRIDE; + Standard_EXPORT double Center(const int theIndex, const int theAxis) const override; //! Swaps indices of two specified triangles. - Standard_EXPORT void Swap(const Standard_Integer theIndex1, - const Standard_Integer theIndex2) Standard_OVERRIDE; + Standard_EXPORT void Swap(const int theIndex1, const int theIndex2) override; public: //! Clears triangle set data. Standard_EXPORT void Clear(); //! Initializes triangle set. - Standard_EXPORT Standard_Boolean Init(const BRepExtrema_ShapeList& theShapes); + Standard_EXPORT bool Init(const NCollection_DynamicArray& theShapes); //! Returns all vertices. Standard_EXPORT const BVH_Array3d& GetVertices() const { return myVertexArray; } //! Returns vertices of the given triangle. - Standard_EXPORT void GetVertices(const Standard_Integer theIndex, - BVH_Vec3d& theVertex1, - BVH_Vec3d& theVertex2, - BVH_Vec3d& theVertex3) const; + Standard_EXPORT void GetVertices(const int theIndex, + BVH_Vec3d& theVertex1, + BVH_Vec3d& theVertex2, + BVH_Vec3d& theVertex3) const; //! Returns vertex indices of the given triangle. - Standard_EXPORT void GetVtxIndices(const Standard_Integer theIndex, - NCollection_Array1& theVtxIndices) const; + Standard_EXPORT void GetVtxIndices(const int theIndex, + NCollection_Array1& theVtxIndices) const; //! Returns face ID of the given triangle. - Standard_EXPORT Standard_Integer GetFaceID(const Standard_Integer theIndex) const; + Standard_EXPORT int GetFaceID(const int theIndex) const; //! Returns shape ID of the given vertex index. - Standard_EXPORT Standard_Integer GetShapeIDOfVtx(const Standard_Integer theIndex) const; + Standard_EXPORT int GetShapeIDOfVtx(const int theIndex) const; //! Returns vertex index in tringulation of the shape, which vertex belongs, //! with the given vtx ID in whole set. - Standard_EXPORT Standard_Integer GetVtxIdxInShape(const Standard_Integer theIndex) const; + Standard_EXPORT int GetVtxIdxInShape(const int theIndex) const; //! Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs, //! with the given trg ID in whole set (after swapping). - Standard_EXPORT Standard_Integer GetTrgIdxInShape(const Standard_Integer theIndex) const; + Standard_EXPORT int GetTrgIdxInShape(const int theIndex) const; private: //! Initializes triangle set from the face - Standard_Boolean initFace(const TopoDS_Face& theFace, const Standard_Integer theIndex); + bool initFace(const TopoDS_Face& theFace, const int theIndex); //! Initializes polygon from the edge - Standard_Boolean initEdge(const TopoDS_Edge& theEdge, const Standard_Integer theIndex); + bool initEdge(const TopoDS_Edge& theEdge, const int theIndex); //! Initializes nodes - void initNodes(const TColgp_Array1OfPnt& theNodes, - const gp_Trsf& theTrsf, - const Standard_Integer theIndex); + void initNodes(const NCollection_Array1& theNodes, + const gp_Trsf& theTrsf, + const int theIndex); protected: //! Array of vertex indices. @@ -112,21 +110,19 @@ protected: //! Vector of shapes' indices where index of item corresponds to index of vertex, //! belonging to this shape. - NCollection_Vector myShapeIdxOfVtxVec; + NCollection_DynamicArray myShapeIdxOfVtxVec; //! Vector of vertexes' number belonging to shape which index corresponds item's index. - NCollection_Vector myNumVtxInShapeVec; + NCollection_DynamicArray myNumVtxInShapeVec; //! Vector of triangles' number belonging to shape which index corresponds item's index. - NCollection_Vector myNumTrgInShapeVec; + NCollection_DynamicArray myNumTrgInShapeVec; //! Map of triangles' indices after (key) and before (value) swapping. - TColStd_DataMapOfIntegerInteger myTrgIdxMap; + NCollection_DataMap myTrgIdxMap; public: DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d) }; -DEFINE_STANDARD_HANDLE(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d) - #endif // _BRepExtrema_TriangleSet_HeaderFile diff --git a/opencascade/BRepExtrema_UnCompatibleShape.hxx b/opencascade/BRepExtrema_UnCompatibleShape.hxx index 112010c3a..9e375303a 100644 --- a/opencascade/BRepExtrema_UnCompatibleShape.hxx +++ b/opencascade/BRepExtrema_UnCompatibleShape.hxx @@ -17,14 +17,10 @@ #ifndef _BRepExtrema_UnCompatibleShape_HeaderFile #define _BRepExtrema_UnCompatibleShape_HeaderFile -#include #include #include #include -class BRepExtrema_UnCompatibleShape; -DEFINE_STANDARD_HANDLE(BRepExtrema_UnCompatibleShape, Standard_DomainError) - #if !defined No_Exception && !defined No_BRepExtrema_UnCompatibleShape #define BRepExtrema_UnCompatibleShape_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/opencascade/BRepFeat.hxx b/opencascade/BRepFeat.hxx index a948cfbe1..dcace0450 100644 --- a/opencascade/BRepFeat.hxx +++ b/opencascade/BRepFeat.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include #include #include @@ -83,27 +84,27 @@ class BRepFeat public: DEFINE_STANDARD_ALLOC - Standard_EXPORT static void SampleEdges(const TopoDS_Shape& S, TColgp_SequenceOfPnt& Pt); + Standard_EXPORT static void SampleEdges(const TopoDS_Shape& S, NCollection_Sequence& Pt); Standard_EXPORT static void Barycenter(const TopoDS_Shape& S, gp_Pnt& Pt); - Standard_EXPORT static Standard_Real ParametricBarycenter(const TopoDS_Shape& S, - const Handle(Geom_Curve)& C); + Standard_EXPORT static double ParametricBarycenter(const TopoDS_Shape& S, + const occ::handle& C); //! Ori = True taking account the orientation - Standard_EXPORT static void ParametricMinMax(const TopoDS_Shape& S, - const Handle(Geom_Curve)& C, - Standard_Real& prmin, - Standard_Real& prmax, - Standard_Real& prbmin, - Standard_Real& prbmax, - Standard_Boolean& flag, - const Standard_Boolean Ori = Standard_False); + Standard_EXPORT static void ParametricMinMax(const TopoDS_Shape& S, + const occ::handle& C, + double& prmin, + double& prmax, + double& prbmin, + double& prbmax, + bool& flag, + const bool Ori = false); - Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Face& F1, const TopoDS_Face& F2); + Standard_EXPORT static bool IsInside(const TopoDS_Face& F1, const TopoDS_Face& F2); - Standard_EXPORT static Standard_Boolean IsInOut(const BRepTopAdaptor_FClass2d& FC, - const Geom2dAdaptor_Curve& AC); + Standard_EXPORT static bool IsInOut(const BRepTopAdaptor_FClass2d& FC, + const Geom2dAdaptor_Curve& AC); Standard_EXPORT static void FaceUntil(const TopoDS_Shape& S, TopoDS_Face& F); diff --git a/opencascade/BRepFeat_Builder.hxx b/opencascade/BRepFeat_Builder.hxx index 06686afee..58bc2d95a 100644 --- a/opencascade/BRepFeat_Builder.hxx +++ b/opencascade/BRepFeat_Builder.hxx @@ -21,9 +21,11 @@ #include #include -#include -#include -#include +#include +#include +#include +#include +#include class TopoDS_Shape; class TopoDS_Face; @@ -48,10 +50,10 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT BRepFeat_Builder(); - Standard_EXPORT virtual ~BRepFeat_Builder(); + Standard_EXPORT ~BRepFeat_Builder() override; //! Clears internal fields and arguments. - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() override; //! Initializes the object of local boolean operation. Standard_EXPORT void Init(const TopoDS_Shape& theShape); @@ -61,21 +63,21 @@ public: //! Sets the operation of local boolean operation. //! If theFuse = 0 than the operation is CUT, otherwise FUSE. - Standard_EXPORT void SetOperation(const Standard_Integer theFuse); + Standard_EXPORT void SetOperation(const int theFuse); //! Sets the operation of local boolean operation. //! If theFlag = TRUE it means that no selection of parts //! of the tool is needed, t.e. no second part. In that case //! if theFuse = 0 than operation is COMMON, otherwise CUT21. - //! If theFlag = FALSE SetOperation(theFuse) function is called. - Standard_EXPORT void SetOperation(const Standard_Integer theFuse, const Standard_Boolean theFlag); + //! If theFlag = FALSE SetOperation(theFuse) function is called. + Standard_EXPORT void SetOperation(const int theFuse, const bool theFlag); //! Collects parts of the tool. - Standard_EXPORT void PartsOfTool(TopTools_ListOfShape& theLT); + Standard_EXPORT void PartsOfTool(NCollection_List& theLT); //! Initializes parts of the tool for second step of algorithm. //! Collects shapes and all sub-shapes into myShapes map. - Standard_EXPORT void KeepParts(const TopTools_ListOfShape& theIm); + Standard_EXPORT void KeepParts(const NCollection_List& theIm); //! Adds shape theS and all its sub-shapes into myShapes map. Standard_EXPORT void KeepPart(const TopoDS_Shape& theS); @@ -89,10 +91,11 @@ public: Standard_EXPORT void RebuildFaces(); //! Rebuilds edges in accordance with the kept parts of the tool. - Standard_EXPORT void RebuildEdge(const TopoDS_Shape& theE, - const TopoDS_Face& theF, - const TopTools_MapOfShape& theME, - TopTools_ListOfShape& aLEIm); + Standard_EXPORT void RebuildEdge( + const TopoDS_Shape& theE, + const TopoDS_Face& theF, + const NCollection_Map& theME, + NCollection_List& aLEIm); //! Collects the images of the object, that contains in //! the images of the tool. @@ -102,26 +105,25 @@ public: Standard_EXPORT void FillRemoved(); //! Adds the shape S and its sub-shapes into myRemoved map. - Standard_EXPORT void FillRemoved(const TopoDS_Shape& theS, TopTools_MapOfShape& theM); + Standard_EXPORT void FillRemoved(const TopoDS_Shape& theS, + NCollection_Map& theM); protected: //! Prepares builder of local operation. - Standard_EXPORT virtual void Prepare() Standard_OVERRIDE; + Standard_EXPORT void Prepare() override; //! Function is redefined to avoid the usage of removed faces. - Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids, - const Message_ProgressRange& theRange) - Standard_OVERRIDE; + Standard_EXPORT void FillIn3DParts( + NCollection_DataMap& theDraftSolids, + const Message_ProgressRange& theRange) override; //! Avoid the check for open solids and always use the splits //! of solids for building the result shape. - virtual Standard_Boolean CheckArgsForOpenSolid() Standard_OVERRIDE { return Standard_False; } + bool CheckArgsForOpenSolid() override { return false; } - TopTools_MapOfShape myShapes; - TopTools_MapOfShape myRemoved; - Standard_Integer myFuse; - -private: + NCollection_Map myShapes; + NCollection_Map myRemoved; + int myFuse; }; #endif // _BRepFeat_Builder_HeaderFile diff --git a/opencascade/BRepFeat_Form.hxx b/opencascade/BRepFeat_Form.hxx index 29a2d3881..e172c90a6 100644 --- a/opencascade/BRepFeat_Form.hxx +++ b/opencascade/BRepFeat_Form.hxx @@ -21,15 +21,16 @@ #include #include -#include #include -#include +#include +#include +#include #include #include -#include #include #include -#include +#include +#include #include class Geom_Curve; class LocOpe_Gluer; @@ -48,7 +49,7 @@ class BRepAlgoAPI_BooleanOperation; //! The semantics of form feature creation is based on the construction of shapes: //! - along a length //! - up to a limiting face -//! - from a limiting face to a height +//! - from a limiting face to a height //! - above and/or below a plane //! The shape defining construction of the feature can be either the //! supporting edge or the concerned area of a face. @@ -68,30 +69,28 @@ public: DEFINE_STANDARD_ALLOC //! returns the list of generated Faces. - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; //! returns a list of the created faces //! from the shape . - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Generated(const TopoDS_Shape& S) override; - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& S) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& S) override; - //! Returns the list of shapes created at the bottom of - //! the created form. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& FirstShape() const; + //! Returns the list of shapes created at the bottom of + //! the created form. It may be an empty list. + Standard_EXPORT const NCollection_List& FirstShape() const; - //! Returns the list of shapes created at the top of the - //! created form. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& LastShape() const; + //! Returns the list of shapes created at the top of the + //! created form. It may be an empty list. + Standard_EXPORT const NCollection_List& LastShape() const; //! Returns a list of the limiting and glueing edges //! generated by the feature. These edges did not originally //! exist in the basis shape. //! The list provides the information necessary for //! subsequent addition of fillets. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& NewEdges() const; + Standard_EXPORT const NCollection_List& NewEdges() const; //! Returns a list of the tangent edges among the limiting //! and glueing edges generated by the feature. These @@ -101,7 +100,7 @@ public: //! subsequent addition of fillets. It may be an empty list. //! If an edge is tangent, no fillet is possible, and the edge //! must subsequently be removed if you want to add a fillet. - Standard_EXPORT const TopTools_ListOfShape& TgtEdges() const; + Standard_EXPORT const NCollection_List& TgtEdges() const; //! Initializes the topological construction if the basis shape is present. void BasisShapeValid(); @@ -128,9 +127,9 @@ public: //! Initializes the topological construction if the selected face is present. void PerfSelectionValid(); - Standard_EXPORT virtual void Curves(TColGeom_SequenceOfCurve& S) = 0; + Standard_EXPORT virtual void Curves(NCollection_Sequence>& S) = 0; - Standard_EXPORT virtual Handle(Geom_Curve) BarycCurve() = 0; + Standard_EXPORT virtual occ::handle BarycCurve() = 0; Standard_EXPORT BRepFeat_StatusError CurrentStatusError() const; @@ -145,35 +144,35 @@ protected: Standard_EXPORT void UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBOP, const TopoDS_Shape& SResult, - const Standard_Boolean SkipFace = Standard_False); - - Standard_EXPORT Standard_Boolean TransformShapeFU(const Standard_Integer flag); - - Standard_Boolean myFuse; - Standard_Boolean myModify; - TopTools_DataMapOfShapeListOfShape myMap; - TopoDS_Shape myFShape; - TopoDS_Shape myLShape; - TopTools_ListOfShape myNewEdges; - TopTools_ListOfShape myTgtEdges; - BRepFeat_PerfSelection myPerfSelection; - Standard_Boolean myJustGluer; - Standard_Boolean myJustFeat; - TopoDS_Shape mySbase; - TopoDS_Face mySkface; - TopoDS_Shape myGShape; - TopoDS_Shape mySFrom; - TopoDS_Shape mySUntil; - TopTools_DataMapOfShapeShape myGluedF; + const bool SkipFace = false); + + Standard_EXPORT bool TransformShapeFU(const int flag); + + bool myFuse; + bool myModify; + NCollection_DataMap, TopTools_ShapeMapHasher> myMap; + TopoDS_Shape myFShape; + TopoDS_Shape myLShape; + NCollection_List myNewEdges; + NCollection_List myTgtEdges; + BRepFeat_PerfSelection myPerfSelection; + bool myJustGluer; + bool myJustFeat; + TopoDS_Shape mySbase; + TopoDS_Face mySkface; + TopoDS_Shape myGShape; + TopoDS_Shape mySFrom; + TopoDS_Shape mySUntil; + NCollection_DataMap myGluedF; private: - Standard_Boolean mySbOK; - Standard_Boolean mySkOK; - Standard_Boolean myGSOK; - Standard_Boolean mySFOK; - Standard_Boolean mySUOK; - Standard_Boolean myGFOK; - Standard_Boolean myPSOK; + bool mySbOK; + bool mySkOK; + bool myGSOK; + bool mySFOK; + bool mySUOK; + bool myGFOK; + bool myPSOK; BRepFeat_StatusError myStatusError; }; diff --git a/opencascade/BRepFeat_Form.lxx b/opencascade/BRepFeat_Form.lxx index c045d1340..13fdc0366 100644 --- a/opencascade/BRepFeat_Form.lxx +++ b/opencascade/BRepFeat_Form.lxx @@ -14,95 +14,71 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeatForm -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_Form::BRepFeat_Form() - : myFuse(Standard_False), - myModify(Standard_False), + : myFuse(false), + myModify(false), myPerfSelection(BRepFeat_NoSelection), - myJustGluer(Standard_False), - myJustFeat(Standard_False), - mySbOK(Standard_False), - mySkOK(Standard_False), - myGSOK(Standard_False), - mySFOK(Standard_False), - mySUOK(Standard_False), - myGFOK(Standard_False), - myPSOK(Standard_False), + myJustGluer(false), + myJustFeat(false), + mySbOK(false), + mySkOK(false), + myGSOK(false), + mySFOK(false), + mySUOK(false), + myGFOK(false), + myPSOK(false), myStatusError(BRepFeat_NotInitialized) { } -//======================================================================= -// function : BasisShapeValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::BasisShapeValid() { - mySbOK = Standard_True; + mySbOK = true; } -//======================================================================= -// function : PerfSelectionValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::PerfSelectionValid() { - myPSOK = Standard_True; + myPSOK = true; } -//======================================================================= -// function : GeneratedShapeValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::GeneratedShapeValid() { - myGSOK = Standard_True; + myGSOK = true; } -//======================================================================= -// function : ShapeFromValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::ShapeFromValid() { - mySFOK = Standard_True; + mySFOK = true; } -//======================================================================= -// function : ShapeUntilValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::ShapeUntilValid() { - mySUOK = Standard_True; + mySUOK = true; } -//======================================================================= -// function : GluedFacesValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::GluedFacesValid() { - myGFOK = Standard_True; + myGFOK = true; } -//======================================================================= -// function : SketchFaceValid -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Form::SketchFaceValid() { - mySkOK = Standard_True; + mySkOK = true; } diff --git a/opencascade/BRepFeat_Gluer.hxx b/opencascade/BRepFeat_Gluer.hxx index addb79303..9a8ff31e9 100644 --- a/opencascade/BRepFeat_Gluer.hxx +++ b/opencascade/BRepFeat_Gluer.hxx @@ -24,7 +24,8 @@ #include #include #include -#include +#include +#include class TopoDS_Shape; class TopoDS_Face; class TopoDS_Edge; @@ -85,20 +86,18 @@ public: //! Returns the resulting compound shape. const TopoDS_Shape& GluedShape() const; - //! This is called by Shape(). It does nothing but + //! This is called by Shape(). It does nothing but //! may be redefined. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; - //! returns the status of the Face after + //! Returns the status of the Face after //! the shape creation. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& F) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& F) override; - //! returns the list of generated Faces. - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) - Standard_OVERRIDE; + //! Returns the list of generated Faces. + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; -protected: private: LocOpe_Gluer myGluer; }; diff --git a/opencascade/BRepFeat_Gluer.lxx b/opencascade/BRepFeat_Gluer.lxx index f9ec24852..4e7f9fad4 100644 --- a/opencascade/BRepFeat_Gluer.lxx +++ b/opencascade/BRepFeat_Gluer.lxx @@ -14,77 +14,53 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_Gluer -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_Gluer::BRepFeat_Gluer() {} +inline BRepFeat_Gluer::BRepFeat_Gluer() = default; -//======================================================================= -// function : BRepFeat_Gluer -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_Gluer::BRepFeat_Gluer(const TopoDS_Shape& Snew, const TopoDS_Shape& Sbase) : myGluer(Sbase, Snew) // Attention a l`inversion { } -//======================================================================= -// function : Init -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Gluer::Init(const TopoDS_Shape& Snew, const TopoDS_Shape& Sbase) { myGluer.Init(Sbase, Snew); } -//======================================================================= -// function : Bind -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Gluer::Bind(const TopoDS_Face& Fnew, const TopoDS_Face& Fbase) { myGluer.Bind(Fnew, Fbase); } -//======================================================================= -// function : Bind -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_Gluer::Bind(const TopoDS_Edge& Enew, const TopoDS_Edge& Ebase) { myGluer.Bind(Enew, Ebase); } -//======================================================================= -// function : OpeType -// purpose : -//======================================================================= +//================================================================================================= inline LocOpe_Operation BRepFeat_Gluer::OpeType() const { return myGluer.OpeType(); } -//======================================================================= -// function : BasisShape -// purpose : -//======================================================================= +//================================================================================================= inline const TopoDS_Shape& BRepFeat_Gluer::BasisShape() const { return myGluer.BasisShape(); } -//======================================================================= -// function : GluedShape -// purpose : -//======================================================================= +//================================================================================================= inline const TopoDS_Shape& BRepFeat_Gluer::GluedShape() const { diff --git a/opencascade/BRepFeat_MakeCylindricalHole.hxx b/opencascade/BRepFeat_MakeCylindricalHole.hxx index 3093e6a51..54c5f3f7e 100644 --- a/opencascade/BRepFeat_MakeCylindricalHole.hxx +++ b/opencascade/BRepFeat_MakeCylindricalHole.hxx @@ -42,58 +42,56 @@ public: //! Sets the axis of the hole(s). void Init(const gp_Ax1& Axis); - //! Sets the shape and axis on which hole(s) will be + //! Sets the shape and axis on which hole(s) will be //! performed. void Init(const TopoDS_Shape& S, const gp_Ax1& Axis); - //! Performs every hole of radius . This - //! command has the same effect as a cut operation - //! with an infinite cylinder defined by the given + //! Performs every hole of radius . This + //! command has the same effect as a cut operation + //! with an infinite cylinder defined by the given //! axis and . - Standard_EXPORT void Perform(const Standard_Real Radius); + Standard_EXPORT void Perform(const double Radius); - //! Performs every hole of radius located - //! between PFrom and PTo on the given axis. If - //! is set to Standard_False no control - //! are done on the resulting shape after the + //! Performs every hole of radius located + //! between PFrom and PTo on the given axis. If + //! is set to false no control + //! are done on the resulting shape after the //! operation is performed. - Standard_EXPORT void Perform(const Standard_Real Radius, - const Standard_Real PFrom, - const Standard_Real PTo, - const Standard_Boolean WithControl = Standard_True); + Standard_EXPORT void Perform(const double Radius, + const double PFrom, + const double PTo, + const bool WithControl = true); //! Performs the first hole of radius , in the - //! direction of the defined axis. First hole signify + //! direction of the defined axis. First hole signify //! first encountered after the origin of the axis. If - //! is set to Standard_False no control - //! are done on the resulting shape after the + //! is set to false no control + //! are done on the resulting shape after the //! operation is performed. - Standard_EXPORT void PerformThruNext(const Standard_Real Radius, - const Standard_Boolean WithControl = Standard_True); + Standard_EXPORT void PerformThruNext(const double Radius, const bool WithControl = true); - //! Performs every hole of radius located - //! after the origin of the given axis. If - //! is set to Standard_False no control - //! are done on the resulting shape after the + //! Performs every hole of radius located + //! after the origin of the given axis. If + //! is set to false no control + //! are done on the resulting shape after the //! operation is performed. - Standard_EXPORT void PerformUntilEnd(const Standard_Real Radius, - const Standard_Boolean WithControl = Standard_True); + Standard_EXPORT void PerformUntilEnd(const double Radius, const bool WithControl = true); - //! Performs a blind hole of radius and - //! length . The length is measured from the - //! origin of the given axis. If is set - //! to Standard_False no control are done after the + //! Performs a blind hole of radius and + //! length . The length is measured from the + //! origin of the given axis. If is set + //! to false no control are done after the //! operation is performed. - Standard_EXPORT void PerformBlind(const Standard_Real Radius, - const Standard_Real Length, - const Standard_Boolean WithControl = Standard_True); + Standard_EXPORT void PerformBlind(const double Radius, + const double Length, + const bool WithControl = true); //! Returns the status after a hole is performed. BRepFeat_Status Status() const; - //! Builds the resulting shape (redefined from - //! MakeShape). Invalidates the given parts of tools - //! if any, and performs the result of the local + //! Builds the resulting shape (redefined from + //! MakeShape). Invalidates the given parts of tools + //! if any, and performs the result of the local //! operation. Standard_EXPORT void Build(); @@ -104,13 +102,13 @@ protected: private: Standard_EXPORT BRepFeat_Status Validate(); - gp_Ax1 myAxis; - Standard_Boolean myAxDef; - BRepFeat_Status myStatus; - Standard_Boolean myIsBlind; - Standard_Boolean myValidate; - TopoDS_Face myTopFace; - TopoDS_Face myBotFace; + gp_Ax1 myAxis; + bool myAxDef; + BRepFeat_Status myStatus; + bool myIsBlind; + bool myValidate; + TopoDS_Face myTopFace; + TopoDS_Face myBotFace; }; #include diff --git a/opencascade/BRepFeat_MakeCylindricalHole.lxx b/opencascade/BRepFeat_MakeCylindricalHole.lxx index a0d2c5522..84de45e3c 100644 --- a/opencascade/BRepFeat_MakeCylindricalHole.lxx +++ b/opencascade/BRepFeat_MakeCylindricalHole.lxx @@ -16,46 +16,34 @@ // Modified by jag, Tue May 30 09:47:02 1995 -//======================================================================= -// function : BRepFeat_MakeCylindricalHole -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_MakeCylindricalHole::BRepFeat_MakeCylindricalHole() - : myAxDef(Standard_False), + : myAxDef(false), myStatus(BRepFeat_NoError), - myIsBlind(Standard_False), - myValidate(Standard_False) + myIsBlind(false), + myValidate(false) { } -//======================================================================= -// function : Init -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_MakeCylindricalHole::Init(const gp_Ax1& Axis) { myAxis = Axis; - myAxDef = Standard_True; + myAxDef = true; } -//======================================================================= -// function : Init -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_MakeCylindricalHole::Init(const TopoDS_Shape& S, const gp_Ax1& Axis) { BRepFeat_Builder::Init(S); myAxis = Axis; - myAxDef = Standard_True; + myAxDef = true; } -//======================================================================= -// function : Status -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_Status BRepFeat_MakeCylindricalHole::Status() const { diff --git a/opencascade/BRepFeat_MakeDPrism.hxx b/opencascade/BRepFeat_MakeDPrism.hxx index 43ba0c7ef..d88a9382f 100644 --- a/opencascade/BRepFeat_MakeDPrism.hxx +++ b/opencascade/BRepFeat_MakeDPrism.hxx @@ -21,9 +21,11 @@ #include #include -#include +#include +#include +#include +#include #include -#include #include #include #include @@ -61,12 +63,12 @@ public: //! operation. If it is inside the basis shape, a local //! operation such as glueing can be performed. //! Initializes the draft prism class - BRepFeat_MakeDPrism(const TopoDS_Shape& Sbase, - const TopoDS_Face& Pbase, - const TopoDS_Face& Skface, - const Standard_Real Angle, - const Standard_Integer Fuse, - const Standard_Boolean Modify) + BRepFeat_MakeDPrism(const TopoDS_Shape& Sbase, + const TopoDS_Face& Pbase, + const TopoDS_Face& Skface, + const double Angle, + const int Fuse, + const bool Modify) { Init(Sbase, Pbase, Skface, Angle, Fuse, Modify); } @@ -82,24 +84,24 @@ public: //! serve as the basis from the draft prism. The draft will be //! defined by the angle Angle and Fuse offers a choice between: //! - removing matter with a Boolean cut using the setting 0 - //! - adding matter with Boolean fusion using the setting 1. + //! - adding matter with Boolean fusion using the setting 1. //! The sketch face Skface serves to determine the type of //! operation. If it is inside the basis shape, a local //! operation such as glueing can be performed. - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Face& Pbase, - const TopoDS_Face& Skface, - const Standard_Real Angle, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Face& Pbase, + const TopoDS_Face& Skface, + const double Angle, + const int Fuse, + const bool Modify); //! Indicates that the edge will slide on the face //! . - //! Raises ConstructionError if the face does not belong to the + //! Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); - Standard_EXPORT void Perform(const Standard_Real Height); + Standard_EXPORT void Perform(const double Height); Standard_EXPORT void Perform(const TopoDS_Shape& Until); @@ -122,33 +124,33 @@ public: //! Assigns both a limiting shape, Until from //! TopoDS_Shape, and a height, Height at which to stop //! generation of the prism feature. - Standard_EXPORT void PerformUntilHeight(const TopoDS_Shape& Until, const Standard_Real Height); + Standard_EXPORT void PerformUntilHeight(const TopoDS_Shape& Until, const double Height); - Standard_EXPORT void Curves(TColGeom_SequenceOfCurve& S); + Standard_EXPORT void Curves(NCollection_Sequence>& S) override; - Standard_EXPORT Handle(Geom_Curve) BarycCurve(); + Standard_EXPORT occ::handle BarycCurve() override; //! Determination of TopEdges and LatEdges. //! sig = 1 -> TopEdges = FirstShape of the DPrism //! sig = 2 -> TOpEdges = LastShape of the DPrism - Standard_EXPORT void BossEdges(const Standard_Integer sig); + Standard_EXPORT void BossEdges(const int sig); //! Returns the list of TopoDS Edges of the top of the boss. - Standard_EXPORT const TopTools_ListOfShape& TopEdges(); + Standard_EXPORT const NCollection_List& TopEdges(); //! Returns the list of TopoDS Edges of the bottom of the boss. - Standard_EXPORT const TopTools_ListOfShape& LatEdges(); + Standard_EXPORT const NCollection_List& LatEdges(); -protected: private: - TopoDS_Face myPbase; - TopTools_DataMapOfShapeListOfShape mySlface; - Standard_Real myAngle; - TColGeom_SequenceOfCurve myCurves; - Handle(Geom_Curve) myBCurve; - TopTools_ListOfShape myTopEdges; - TopTools_ListOfShape myLatEdges; - BRepFeat_StatusError myStatusError; + TopoDS_Face myPbase; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + double myAngle; + NCollection_Sequence> myCurves; + occ::handle myBCurve; + NCollection_List myTopEdges; + NCollection_List myLatEdges; + BRepFeat_StatusError myStatusError; }; #endif // _BRepFeat_MakeDPrism_HeaderFile diff --git a/opencascade/BRepFeat_MakeLinearForm.hxx b/opencascade/BRepFeat_MakeLinearForm.hxx index f979a861a..9d4a5058c 100644 --- a/opencascade/BRepFeat_MakeLinearForm.hxx +++ b/opencascade/BRepFeat_MakeLinearForm.hxx @@ -22,8 +22,10 @@ #include #include -#include -#include +#include +#include +#include +#include #include #include class Geom_Curve; @@ -64,13 +66,13 @@ public: //! setting 0 in case of the groove //! - adding matter with Boolean fusion using the //! setting 1 in case of the rib. - BRepFeat_MakeLinearForm(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& P, - const gp_Vec& Direction, - const gp_Vec& Direction1, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + BRepFeat_MakeLinearForm(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& P, + const gp_Vec& Direction, + const gp_Vec& Direction1, + const int Fuse, + const bool Modify); //! Initializes this construction algorithm. //! A contour W, a shape Sbase and a plane P are @@ -83,17 +85,17 @@ public: //! 0 in case of the groove //! - adding matter with Boolean fusion using the setting 1 //! in case of the rib. - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& P, - const gp_Vec& Direction, - const gp_Vec& Direction1, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& P, + const gp_Vec& Direction, + const gp_Vec& Direction1, + const int Fuse, + const bool Modify); //! Indicates that the edge will slide on the face //! . - //! Raises ConstructionError if the face does not belong to the + //! Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); @@ -109,24 +111,24 @@ public: //! The setting is provided by a flag, flag, which can be set //! to from and/or until. The third semantic possibility above //! is selected by showing both from and until at the same time. - Standard_EXPORT void TransformShapeFU(const Standard_Integer flag); + Standard_EXPORT void TransformShapeFU(const int flag); - Standard_EXPORT Standard_Boolean Propagate(TopTools_ListOfShape& L, - const TopoDS_Face& F, - const gp_Pnt& FPoint, - const gp_Pnt& LPoint, - Standard_Boolean& falseside); + Standard_EXPORT bool Propagate(NCollection_List& L, + const TopoDS_Face& F, + const gp_Pnt& FPoint, + const gp_Pnt& LPoint, + bool& falseside); -protected: private: - Handle(Geom_Curve) myCrv; - gp_Vec myDir; - gp_Vec myDir1; - Handle(Geom_Plane) myPln; - Standard_Real myBnd; - TopTools_DataMapOfShapeListOfShape mySlface; - TopTools_ListOfShape myListOfEdges; - Standard_Real myTol; + occ::handle myCrv; + gp_Vec myDir; + gp_Vec myDir1; + occ::handle myPln; + double myBnd; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + NCollection_List myListOfEdges; + double myTol; }; #include diff --git a/opencascade/BRepFeat_MakeLinearForm.lxx b/opencascade/BRepFeat_MakeLinearForm.lxx index 6b4400af7..d89cfa478 100644 --- a/opencascade/BRepFeat_MakeLinearForm.lxx +++ b/opencascade/BRepFeat_MakeLinearForm.lxx @@ -14,10 +14,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_MakeLinearForm -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_MakeLinearForm::BRepFeat_MakeLinearForm() : myBnd(0.0), @@ -25,18 +22,15 @@ inline BRepFeat_MakeLinearForm::BRepFeat_MakeLinearForm() { } -//======================================================================= -// function : BRepFeat_MakePrism -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakeLinearForm::BRepFeat_MakeLinearForm(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& P, - const gp_Vec& Direc, - const gp_Vec& Direc1, - const Standard_Integer Fuse, - const Standard_Boolean Modify) +inline BRepFeat_MakeLinearForm::BRepFeat_MakeLinearForm(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& P, + const gp_Vec& Direc, + const gp_Vec& Direc1, + const int Fuse, + const bool Modify) { Init(Sbase, W, P, Direc, Direc1, Fuse, Modify); diff --git a/opencascade/BRepFeat_MakePipe.hxx b/opencascade/BRepFeat_MakePipe.hxx index 9266afe16..f2fe18bd2 100644 --- a/opencascade/BRepFeat_MakePipe.hxx +++ b/opencascade/BRepFeat_MakePipe.hxx @@ -22,7 +22,9 @@ #include #include -#include +#include +#include +#include #include #include #include @@ -63,12 +65,12 @@ public: //! The sketch face Skface serves to determine //! the type of operation. If it is inside the basis //! shape, a local operation such as glueing can be performed. - BRepFeat_MakePipe(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const TopoDS_Wire& Spine, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + BRepFeat_MakePipe(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const TopoDS_Wire& Spine, + const int Fuse, + const bool Modify); //! Initializes this algorithm for adding pipes to shapes. //! A face Pbase is selected in the shape Sbase to @@ -79,15 +81,15 @@ public: //! The sketch face Skface serves to determine //! the type of operation. If it is inside the basis //! shape, a local operation such as glueing can be performed. - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const TopoDS_Wire& Spine, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const TopoDS_Wire& Spine, + const int Fuse, + const bool Modify); //! Indicates that the edge will slide on the face - //! . Raises ConstructionError if the face does not belong to the + //! . Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); @@ -101,18 +103,18 @@ public: //! Reconstructs the feature topologically according to the semantic option chosen. Standard_EXPORT void Perform(const TopoDS_Shape& From, const TopoDS_Shape& Until); - Standard_EXPORT void Curves(TColGeom_SequenceOfCurve& S); + Standard_EXPORT void Curves(NCollection_Sequence>& S) override; - Standard_EXPORT Handle(Geom_Curve) BarycCurve(); + Standard_EXPORT occ::handle BarycCurve() override; -protected: private: - TopoDS_Shape myPbase; - TopoDS_Face mySkface; - TopTools_DataMapOfShapeListOfShape mySlface; - TopoDS_Wire mySpine; - TColGeom_SequenceOfCurve myCurves; - Handle(Geom_Curve) myBCurve; + TopoDS_Shape myPbase; + TopoDS_Face mySkface; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + TopoDS_Wire mySpine; + NCollection_Sequence> myCurves; + occ::handle myBCurve; }; #include diff --git a/opencascade/BRepFeat_MakePipe.lxx b/opencascade/BRepFeat_MakePipe.lxx index e3c93f580..8c057d0e9 100644 --- a/opencascade/BRepFeat_MakePipe.lxx +++ b/opencascade/BRepFeat_MakePipe.lxx @@ -14,24 +14,18 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_MakePipe -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakePipe::BRepFeat_MakePipe() {} +inline BRepFeat_MakePipe::BRepFeat_MakePipe() = default; -//======================================================================= -// function : BRepFeat_MakePipe -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakePipe::BRepFeat_MakePipe(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const TopoDS_Wire& Spine, - const Standard_Integer Fuse, - const Standard_Boolean Modify) +inline BRepFeat_MakePipe::BRepFeat_MakePipe(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const TopoDS_Wire& Spine, + const int Fuse, + const bool Modify) { Init(Sbase, Pbase, Skface, Spine, Fuse, Modify); diff --git a/opencascade/BRepFeat_MakePrism.hxx b/opencascade/BRepFeat_MakePrism.hxx index 719fe5e78..44ea69f17 100644 --- a/opencascade/BRepFeat_MakePrism.hxx +++ b/opencascade/BRepFeat_MakePrism.hxx @@ -22,7 +22,9 @@ #include #include -#include +#include +#include +#include #include #include #include @@ -72,12 +74,12 @@ public: //! Exceptions //! Standard_ConstructionError if the face //! does not belong to the basis or the prism shape. - BRepFeat_MakePrism(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Dir& Direction, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + BRepFeat_MakePrism(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Dir& Direction, + const int Fuse, + const bool Modify); //! Initializes this algorithm for building prisms along surfaces. //! A face Pbase is selected in the shape Sbase @@ -89,19 +91,19 @@ public: //! The sketch face Skface serves to determine //! the type of operation. If it is inside the basis //! shape, a local operation such as glueing can be performed. - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Dir& Direction, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Dir& Direction, + const int Fuse, + const bool Modify); //! Indicates that the edge will slide on the face - //! . Raises ConstructionError if the face does not belong to the + //! . Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); - Standard_EXPORT void Perform(const Standard_Real Length); + Standard_EXPORT void Perform(const double Length); Standard_EXPORT void Perform(const TopoDS_Shape& Until); @@ -124,22 +126,22 @@ public: //! Assigns both a limiting shape, Until from //! TopoDS_Shape, and a height, Length at which to stop generation of the prism feature. - Standard_EXPORT void PerformUntilHeight(const TopoDS_Shape& Until, const Standard_Real Length); + Standard_EXPORT void PerformUntilHeight(const TopoDS_Shape& Until, const double Length); //! Returns the list of curves S parallel to the axis of the prism. - Standard_EXPORT void Curves(TColGeom_SequenceOfCurve& S); + Standard_EXPORT void Curves(NCollection_Sequence>& S) override; //! Generates a curve along the center of mass of the primitive. - Standard_EXPORT Handle(Geom_Curve) BarycCurve(); + Standard_EXPORT occ::handle BarycCurve() override; -protected: private: - TopoDS_Shape myPbase; - TopTools_DataMapOfShapeListOfShape mySlface; - gp_Dir myDir; - TColGeom_SequenceOfCurve myCurves; - Handle(Geom_Curve) myBCurve; - BRepFeat_StatusError myStatusError; + TopoDS_Shape myPbase; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + gp_Dir myDir; + NCollection_Sequence> myCurves; + occ::handle myBCurve; + BRepFeat_StatusError myStatusError; }; #include diff --git a/opencascade/BRepFeat_MakePrism.lxx b/opencascade/BRepFeat_MakePrism.lxx index baf4d8fde..1662d46a5 100644 --- a/opencascade/BRepFeat_MakePrism.lxx +++ b/opencascade/BRepFeat_MakePrism.lxx @@ -14,27 +14,21 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_MakePrism -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_MakePrism::BRepFeat_MakePrism() : myStatusError(BRepFeat_OK) { } -//======================================================================= -// function : BRepFeat_MakePrism -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakePrism::BRepFeat_MakePrism(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Dir& Direc, - const Standard_Integer Fuse, - const Standard_Boolean Modify) +inline BRepFeat_MakePrism::BRepFeat_MakePrism(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Dir& Direc, + const int Fuse, + const bool Modify) { Init(Sbase, Pbase, Skface, Direc, Fuse, Modify); diff --git a/opencascade/BRepFeat_MakeRevol.hxx b/opencascade/BRepFeat_MakeRevol.hxx index 02b19c867..ac152b4c7 100644 --- a/opencascade/BRepFeat_MakeRevol.hxx +++ b/opencascade/BRepFeat_MakeRevol.hxx @@ -22,7 +22,9 @@ #include #include -#include +#include +#include +#include #include #include #include @@ -49,26 +51,26 @@ public: //! The sketch face Skface serves to determine //! the type of operation. If it is inside the basis //! shape, a local operation such as glueing can be performed. - BRepFeat_MakeRevol(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Ax1& Axis, - const Standard_Integer Fuse, - const Standard_Boolean Modify); - - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Ax1& Axis, - const Standard_Integer Fuse, - const Standard_Boolean Modify); + BRepFeat_MakeRevol(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Ax1& Axis, + const int Fuse, + const bool Modify); + + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Ax1& Axis, + const int Fuse, + const bool Modify); //! Indicates that the edge will slide on the face - //! . Raises ConstructionError if the face does not belong to the + //! . Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); - Standard_EXPORT void Perform(const Standard_Real Angle); + Standard_EXPORT void Perform(const double Angle); Standard_EXPORT void Perform(const TopoDS_Shape& Until); @@ -82,20 +84,20 @@ public: //! Assigns both a limiting shape, Until from //! TopoDS_Shape, and an angle, Angle at //! which to stop generation of the revolved shell feature. - Standard_EXPORT void PerformUntilAngle(const TopoDS_Shape& Until, const Standard_Real Angle); + Standard_EXPORT void PerformUntilAngle(const TopoDS_Shape& Until, const double Angle); - Standard_EXPORT void Curves(TColGeom_SequenceOfCurve& S); + Standard_EXPORT void Curves(NCollection_Sequence>& S) override; - Standard_EXPORT Handle(Geom_Curve) BarycCurve(); + Standard_EXPORT occ::handle BarycCurve() override; -protected: private: - TopoDS_Shape myPbase; - TopTools_DataMapOfShapeListOfShape mySlface; - gp_Ax1 myAxis; - TColGeom_SequenceOfCurve myCurves; - Handle(Geom_Curve) myBCurve; - BRepFeat_StatusError myStatusError; + TopoDS_Shape myPbase; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + gp_Ax1 myAxis; + NCollection_Sequence> myCurves; + occ::handle myBCurve; + BRepFeat_StatusError myStatusError; }; #include diff --git a/opencascade/BRepFeat_MakeRevol.lxx b/opencascade/BRepFeat_MakeRevol.lxx index 0d766b797..10ecdb635 100644 --- a/opencascade/BRepFeat_MakeRevol.lxx +++ b/opencascade/BRepFeat_MakeRevol.lxx @@ -14,27 +14,21 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_MakeRevol -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_MakeRevol::BRepFeat_MakeRevol() : myStatusError(BRepFeat_OK) { } -//======================================================================= -// function : BRepFeat_MakeRevol -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakeRevol::BRepFeat_MakeRevol(const TopoDS_Shape& Sbase, - const TopoDS_Shape& Pbase, - const TopoDS_Face& Skface, - const gp_Ax1& Axis, - const Standard_Integer Fuse, - const Standard_Boolean Modify) +inline BRepFeat_MakeRevol::BRepFeat_MakeRevol(const TopoDS_Shape& Sbase, + const TopoDS_Shape& Pbase, + const TopoDS_Face& Skface, + const gp_Ax1& Axis, + const int Fuse, + const bool Modify) { Init(Sbase, Pbase, Skface, Axis, Fuse, Modify); diff --git a/opencascade/BRepFeat_MakeRevolutionForm.hxx b/opencascade/BRepFeat_MakeRevolutionForm.hxx index 2dec21ee2..3d459be4b 100644 --- a/opencascade/BRepFeat_MakeRevolutionForm.hxx +++ b/opencascade/BRepFeat_MakeRevolutionForm.hxx @@ -22,8 +22,10 @@ #include #include -#include -#include +#include +#include +#include +#include #include #include class Geom_Plane; @@ -62,14 +64,14 @@ public: //! Fuse offers a choice between: //! - removing matter with a Boolean cut using the setting 0 in case of the groove //! - adding matter with Boolean fusion using the setting 1 in case of the rib. - BRepFeat_MakeRevolutionForm(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& Plane, - const gp_Ax1& Axis, - const Standard_Real Height1, - const Standard_Real Height2, - const Standard_Integer Fuse, - Standard_Boolean& Sliding); + BRepFeat_MakeRevolutionForm(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& Plane, + const gp_Ax1& Axis, + const double Height1, + const double Height2, + const int Fuse, + bool& Sliding); //! Initializes this construction algorithm //! A contour W, a shape Sbase and a plane P are initialized to serve as the basic elements @@ -79,17 +81,17 @@ public: //! Fuse offers a choice between: //! - removing matter with a Boolean cut using the setting 0 in case of the groove //! - adding matter with Boolean fusion using the setting 1 in case of the rib. - Standard_EXPORT void Init(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& Plane, - const gp_Ax1& Axis, - const Standard_Real Height1, - const Standard_Real Height2, - const Standard_Integer Fuse, - Standard_Boolean& Sliding); + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& Plane, + const gp_Ax1& Axis, + const double Height1, + const double Height2, + const int Fuse, + bool& Sliding); //! Indicates that the edge will slide on the face - //! . Raises ConstructionError if the face does not belong to the + //! . Raises ConstructionError if the face does not belong to the //! basis shape, or the edge to the prismed shape. Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); @@ -97,25 +99,25 @@ public: //! along the basis shape S. Reconstructs the feature topologically. Standard_EXPORT void Perform(); - Standard_EXPORT Standard_Boolean Propagate(TopTools_ListOfShape& L, - const TopoDS_Face& F, - const gp_Pnt& FPoint, - const gp_Pnt& LPoint, - Standard_Boolean& falseside); + Standard_EXPORT bool Propagate(NCollection_List& L, + const TopoDS_Face& F, + const gp_Pnt& FPoint, + const gp_Pnt& LPoint, + bool& falseside); -protected: private: - gp_Ax1 myAxe; - Standard_Real myHeight1; - Standard_Real myHeight2; - Standard_Boolean mySliding; - Handle(Geom_Plane) myPln; - Standard_Real myBnd; - TopTools_DataMapOfShapeListOfShape mySlface; - TopTools_ListOfShape myListOfEdges; - Standard_Real myTol; - Standard_Real myAngle1; - Standard_Real myAngle2; + gp_Ax1 myAxe; + double myHeight1; + double myHeight2; + bool mySliding; + occ::handle myPln; + double myBnd; + NCollection_DataMap, TopTools_ShapeMapHasher> + mySlface; + NCollection_List myListOfEdges; + double myTol; + double myAngle1; + double myAngle2; }; #include diff --git a/opencascade/BRepFeat_MakeRevolutionForm.lxx b/opencascade/BRepFeat_MakeRevolutionForm.lxx index 89764946f..1599d1d09 100644 --- a/opencascade/BRepFeat_MakeRevolutionForm.lxx +++ b/opencascade/BRepFeat_MakeRevolutionForm.lxx @@ -14,15 +14,12 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeat_MakeLinearForm -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_MakeRevolutionForm::BRepFeat_MakeRevolutionForm() : myHeight1(0.0), myHeight2(0.0), - mySliding(Standard_False), + mySliding(false), myBnd(0.0), myTol(0.0), myAngle1(RealLast()), @@ -30,19 +27,16 @@ inline BRepFeat_MakeRevolutionForm::BRepFeat_MakeRevolutionForm() { } -//======================================================================= -// function : BRepFeat_MakePrism -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_MakeRevolutionForm::BRepFeat_MakeRevolutionForm(const TopoDS_Shape& Sbase, - const TopoDS_Wire& W, - const Handle(Geom_Plane)& P, - const gp_Ax1& Axis, - const Standard_Real H1, - const Standard_Real H2, - const Standard_Integer Fuse, - Standard_Boolean& Sliding) +inline BRepFeat_MakeRevolutionForm::BRepFeat_MakeRevolutionForm(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const occ::handle& P, + const gp_Ax1& Axis, + const double H1, + const double H2, + const int Fuse, + bool& Sliding) { Init(Sbase, W, P, Axis, H1, H2, Fuse, Sliding); diff --git a/opencascade/BRepFeat_RibSlot.hxx b/opencascade/BRepFeat_RibSlot.hxx index 5ca0d4043..f984fbb80 100644 --- a/opencascade/BRepFeat_RibSlot.hxx +++ b/opencascade/BRepFeat_RibSlot.hxx @@ -22,13 +22,13 @@ #include #include -#include #include +#include +#include +#include #include #include #include -#include -#include #include #include #include @@ -57,23 +57,21 @@ public: DEFINE_STANDARD_ALLOC //! Returns true if F a TopoDS_Shape of type edge or face has been deleted. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& F) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& F) override; //! Returns the list of generated Faces F. This list may be empty. - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; - //! Returns a list TopTools_ListOfShape of the faces S created in the shape. - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) - Standard_OVERRIDE; + //! Returns a list NCollection_List of the faces S created in the shape. + Standard_EXPORT const NCollection_List& Generated(const TopoDS_Shape& S) override; - //! Returns the list of shapes created at the bottom of - //! the created form. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& FirstShape() const; + //! Returns the list of shapes created at the bottom of + //! the created form. It may be an empty list. + Standard_EXPORT const NCollection_List& FirstShape() const; - //! Returns the list of shapes created at the top of the - //! created form. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& LastShape() const; + //! Returns the list of shapes created at the top of the + //! created form. It may be an empty list. + Standard_EXPORT const NCollection_List& LastShape() const; //! Returns a list of the limiting and glueing faces //! generated by the feature. These faces did not originally exist in the basis shape. @@ -81,13 +79,13 @@ public: //! subsequent addition of a draft to a face. It may be an empty list. //! If a face has tangent edges, no draft is possible, and the tangent edges must //! subsequently be removed if you want to add a draft to the face. - Standard_EXPORT const TopTools_ListOfShape& FacesForDraft() const; + Standard_EXPORT const NCollection_List& FacesForDraft() const; //! Returns a list of the limiting and glueing edges //! generated by the feature. These edges did not originally exist in the basis shape. //! The list provides the information necessary for //! subsequent addition of fillets. It may be an empty list. - Standard_EXPORT const TopTools_ListOfShape& NewEdges() const; + Standard_EXPORT const NCollection_List& NewEdges() const; //! Returns a list of the tangent edges among the //! limiting and glueing edges generated by the @@ -98,15 +96,15 @@ public: //! subsequent addition of fillets. It may be an empty list. //! If an edge is tangent, no fillet is possible, and //! the edge must subsequently be removed if you want to add a fillet. - Standard_EXPORT const TopTools_ListOfShape& TgtEdges() const; + Standard_EXPORT const NCollection_List& TgtEdges() const; - Standard_EXPORT static Standard_Real IntPar(const Handle(Geom_Curve)& C, const gp_Pnt& P); + Standard_EXPORT static double IntPar(const occ::handle& C, const gp_Pnt& P); - Standard_EXPORT static TopoDS_Face ChoiceOfFaces(TopTools_ListOfShape& faces, - const Handle(Geom_Curve)& cc, - const Standard_Real par, - const Standard_Real bnd, - const Handle(Geom_Plane)& Pln); + Standard_EXPORT static TopoDS_Face ChoiceOfFaces(NCollection_List& faces, + const occ::handle& cc, + const double par, + const double bnd, + const occ::handle& Pln); Standard_EXPORT BRepFeat_StatusError CurrentStatusError() const; @@ -117,77 +115,75 @@ protected: //! General perform method... Standard_EXPORT void LFPerform(); - Standard_EXPORT gp_Pnt CheckPoint(const TopoDS_Edge& e, - const Standard_Real bnd, - const Handle(Geom_Plane)& Pln); + Standard_EXPORT gp_Pnt CheckPoint(const TopoDS_Edge& e, + const double bnd, + const occ::handle& Pln); Standard_EXPORT gp_Dir Normal(const TopoDS_Face& F, const gp_Pnt& P); - Standard_EXPORT void EdgeExtention(TopoDS_Edge& e, - const Standard_Real bnd, - const Standard_Boolean FirstLast); - - Standard_EXPORT Standard_Real HeightMax(const TopoDS_Shape& theSbase, - const TopoDS_Shape& theSUntil, - gp_Pnt& p1, - gp_Pnt& p2); - - Standard_EXPORT Standard_Boolean ExtremeFaces(const Standard_Boolean RevolRib, - const Standard_Real bnd, - const Handle(Geom_Plane)& Pln, - TopoDS_Edge& FirstEdge, - TopoDS_Edge& LastEdge, - TopoDS_Face& FirstFace, - TopoDS_Face& LastFace, - TopoDS_Vertex& FirstVertex, - TopoDS_Vertex& LastVertex, - Standard_Boolean& OnFirstFace, - Standard_Boolean& OnLastFace, - Standard_Boolean& PtOnFirstEdge, - Standard_Boolean& PtOnLastEdge, - TopoDS_Edge& OnFirstEdge, - TopoDS_Edge& OnLastEdge); - - Standard_EXPORT void PtOnEdgeVertex(const Standard_Boolean RevolRib, - const TopoDS_Shape& shape, - const gp_Pnt& point, - const TopoDS_Vertex& FirstVertex, - const TopoDS_Vertex& LastVertex, - Standard_Boolean& PtOnEdge, - TopoDS_Edge& OnEdge, - Standard_Boolean& PtOnVertex, - TopoDS_Vertex& OnVertex); - - Standard_EXPORT Standard_Boolean SlidingProfile(TopoDS_Face& Prof, - const Standard_Boolean RevolRib, - const Standard_Real myTol, - Standard_Integer& Concavite, - const Handle(Geom_Plane)& myPln, - const TopoDS_Face& BndFace, - const gp_Pnt& CheckPnt, - const TopoDS_Face& FirstFace, - const TopoDS_Face& LastFace, - const TopoDS_Vertex& FirstVertex, - const TopoDS_Vertex& LastVertex, - const TopoDS_Edge& FirstEdge, - const TopoDS_Edge& LastEdge); - - Standard_EXPORT Standard_Boolean NoSlidingProfile(TopoDS_Face& Prof, - const Standard_Boolean RevolRib, - const Standard_Real myTol, - Standard_Integer& Concavite, - const Handle(Geom_Plane)& myPln, - const Standard_Real bnd, - const TopoDS_Face& BndFace, - const gp_Pnt& CheckPnt, - const TopoDS_Face& FirstFace, - const TopoDS_Face& LastFace, - const TopoDS_Vertex& FirstVertex, - const TopoDS_Vertex& LastVertex, - const TopoDS_Edge& FirstEdge, - const TopoDS_Edge& LastEdge, - const Standard_Boolean OnFirstFace, - const Standard_Boolean OnLastFace); + Standard_EXPORT void EdgeExtention(TopoDS_Edge& e, const double bnd, const bool FirstLast); + + Standard_EXPORT double HeightMax(const TopoDS_Shape& theSbase, + const TopoDS_Shape& theSUntil, + gp_Pnt& p1, + gp_Pnt& p2); + + Standard_EXPORT bool ExtremeFaces(const bool RevolRib, + const double bnd, + const occ::handle& Pln, + TopoDS_Edge& FirstEdge, + TopoDS_Edge& LastEdge, + TopoDS_Face& FirstFace, + TopoDS_Face& LastFace, + TopoDS_Vertex& FirstVertex, + TopoDS_Vertex& LastVertex, + bool& OnFirstFace, + bool& OnLastFace, + bool& PtOnFirstEdge, + bool& PtOnLastEdge, + TopoDS_Edge& OnFirstEdge, + TopoDS_Edge& OnLastEdge); + + Standard_EXPORT void PtOnEdgeVertex(const bool RevolRib, + const TopoDS_Shape& shape, + const gp_Pnt& point, + const TopoDS_Vertex& FirstVertex, + const TopoDS_Vertex& LastVertex, + bool& PtOnEdge, + TopoDS_Edge& OnEdge, + bool& PtOnVertex, + TopoDS_Vertex& OnVertex); + + Standard_EXPORT bool SlidingProfile(TopoDS_Face& Prof, + const bool RevolRib, + const double myTol, + int& Concavite, + const occ::handle& myPln, + const TopoDS_Face& BndFace, + const gp_Pnt& CheckPnt, + const TopoDS_Face& FirstFace, + const TopoDS_Face& LastFace, + const TopoDS_Vertex& FirstVertex, + const TopoDS_Vertex& LastVertex, + const TopoDS_Edge& FirstEdge, + const TopoDS_Edge& LastEdge); + + Standard_EXPORT bool NoSlidingProfile(TopoDS_Face& Prof, + const bool RevolRib, + const double myTol, + int& Concavite, + const occ::handle& myPln, + const double bnd, + const TopoDS_Face& BndFace, + const gp_Pnt& CheckPnt, + const TopoDS_Face& FirstFace, + const TopoDS_Face& LastFace, + const TopoDS_Vertex& FirstVertex, + const TopoDS_Vertex& LastVertex, + const TopoDS_Edge& FirstEdge, + const TopoDS_Edge& LastEdge, + const bool OnFirstFace, + const bool OnLastFace); //! Updates the data structures of descendant //! shapes during the glueing operation.Returns the modified, generated @@ -196,30 +192,29 @@ protected: Standard_EXPORT void UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBOP, const TopoDS_Shape& SResult, - const Standard_Boolean SkipFace = Standard_False); - - gp_Pnt myFirstPnt; - gp_Pnt myLastPnt; - Standard_Boolean myFuse; - Standard_Boolean mySliding; - TopTools_DataMapOfShapeListOfShape myMap; - TopTools_DataMapOfShapeListOfShape myLFMap; - TopoDS_Shape myFShape; - TopoDS_Shape myLShape; - BRepFeat_PerfSelection myPerfSelection; - TopoDS_Wire myWire; - TopoDS_Shape mySbase; - TopoDS_Face mySkface; - TopoDS_Face myPbase; - TopoDS_Shape myGShape; - TopoDS_Shape mySUntil; - TopTools_DataMapOfShapeShape myGluedF; - TopTools_ListOfShape myNewEdges; - TopTools_ListOfShape myTgtEdges; - TopTools_ListOfShape myFacesForDraft; - BRepFeat_StatusError myStatusError; - -private: + const bool SkipFace = false); + + gp_Pnt myFirstPnt; + gp_Pnt myLastPnt; + bool myFuse; + bool mySliding; + NCollection_DataMap, TopTools_ShapeMapHasher> myMap; + NCollection_DataMap, TopTools_ShapeMapHasher> + myLFMap; + TopoDS_Shape myFShape; + TopoDS_Shape myLShape; + BRepFeat_PerfSelection myPerfSelection; + TopoDS_Wire myWire; + TopoDS_Shape mySbase; + TopoDS_Face mySkface; + TopoDS_Face myPbase; + TopoDS_Shape myGShape; + TopoDS_Shape mySUntil; + NCollection_DataMap myGluedF; + NCollection_List myNewEdges; + NCollection_List myTgtEdges; + NCollection_List myFacesForDraft; + BRepFeat_StatusError myStatusError; }; #include diff --git a/opencascade/BRepFeat_RibSlot.lxx b/opencascade/BRepFeat_RibSlot.lxx index e01799d93..5220a0d22 100644 --- a/opencascade/BRepFeat_RibSlot.lxx +++ b/opencascade/BRepFeat_RibSlot.lxx @@ -14,14 +14,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : BRepFeatForm -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_RibSlot::BRepFeat_RibSlot() - : myFuse(Standard_False), - mySliding(Standard_False), + : myFuse(false), + mySliding(false), myStatusError(BRepFeat_OK) { } diff --git a/opencascade/BRepFeat_SplitShape.hxx b/opencascade/BRepFeat_SplitShape.hxx index 256bda196..d0f66f3d0 100644 --- a/opencascade/BRepFeat_SplitShape.hxx +++ b/opencascade/BRepFeat_SplitShape.hxx @@ -23,8 +23,9 @@ #include #include -#include -#include +#include +#include +#include class LocOpe_WiresOnShape; class TopoDS_Shape; @@ -54,23 +55,23 @@ public: //! Empty constructor BRepFeat_SplitShape(); - //! Creates the process with the shape . + //! Creates the process with the shape . BRepFeat_SplitShape(const TopoDS_Shape& S); //! Add splitting edges or wires for whole initial shape //! without additional specification edge->face, edge->edge //! This method puts edge on the corresponding faces from initial shape - Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges); + bool Add(const NCollection_Sequence& theEdges); //! Initializes the process on the shape . void Init(const TopoDS_Shape& S); //! Set the flag of check internal intersections //! default value is True (to check) - void SetCheckInterior(const Standard_Boolean ToCheckInterior); + void SetCheckInterior(const bool ToCheckInterior); //! Adds the wire on the face . - //! Raises NoSuchObject if does not belong to the original shape. + //! Raises NoSuchObject if does not belong to the original shape. void Add(const TopoDS_Wire& W, const TopoDS_Face& F); //! Adds the edge on the face . @@ -82,41 +83,40 @@ public: //! they must be connected topologically, i.e. they //! must share common vertices. //! - //! Raises NoSuchObject if does not belong to the original shape. + //! Raises NoSuchObject if does not belong to the original shape. void Add(const TopoDS_Compound& Comp, const TopoDS_Face& F); //! Adds the edge on the existing edge . void Add(const TopoDS_Edge& E, const TopoDS_Edge& EOn); - //! Returns the faces which are the left of the + //! Returns the faces which are the left of the //! projected wires. - Standard_EXPORT const TopTools_ListOfShape& DirectLeft() const; + Standard_EXPORT const NCollection_List& DirectLeft() const; //! Returns the faces of the "left" part on the shape. - //! (It is build from DirectLeft, with the faces + //! (It is build from DirectLeft, with the faces //! connected to this set, and so on...). - //! Raises NotDone if IsDone returns . - Standard_EXPORT const TopTools_ListOfShape& Left() const; + //! Raises NotDone if IsDone returns . + Standard_EXPORT const NCollection_List& Left() const; //! Returns the faces of the "right" part on the shape. - Standard_EXPORT const TopTools_ListOfShape& Right() const; + Standard_EXPORT const NCollection_List& Right() const; //! Builds the cut and the resulting faces and edges as well. - Standard_EXPORT void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) - Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Returns true if the shape has been deleted. - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& S) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& S) override; //! Returns the list of generated Faces. - Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; -protected: private: - LocOpe_Spliter mySShape; - Handle(LocOpe_WiresOnShape) myWOnShape; + LocOpe_Spliter mySShape; + occ::handle myWOnShape; - mutable TopTools_ListOfShape myRight; + mutable NCollection_List myRight; }; #include diff --git a/opencascade/BRepFeat_SplitShape.lxx b/opencascade/BRepFeat_SplitShape.lxx index 5411bc546..0580bb870 100644 --- a/opencascade/BRepFeat_SplitShape.lxx +++ b/opencascade/BRepFeat_SplitShape.lxx @@ -16,17 +16,11 @@ #include -//======================================================================= -// function : BRepFeat_SplitShape -// purpose : -//======================================================================= +//================================================================================================= -inline BRepFeat_SplitShape::BRepFeat_SplitShape() {} +inline BRepFeat_SplitShape::BRepFeat_SplitShape() = default; -//======================================================================= -// function : BRepFeat_SplitShape -// purpose : -//======================================================================= +//================================================================================================= inline BRepFeat_SplitShape::BRepFeat_SplitShape(const TopoDS_Shape& S) : mySShape(S) @@ -34,19 +28,14 @@ inline BRepFeat_SplitShape::BRepFeat_SplitShape(const TopoDS_Shape& S) myWOnShape = new LocOpe_WiresOnShape(S); } -//======================================================================= -// function : Add -// purpose : -//======================================================================= -inline Standard_Boolean BRepFeat_SplitShape::Add(const TopTools_SequenceOfShape& theEdges) +//================================================================================================= + +inline bool BRepFeat_SplitShape::Add(const NCollection_Sequence& theEdges) { return myWOnShape->Add(theEdges); } -//======================================================================= -// function : Init -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_SplitShape::Init(const TopoDS_Shape& S) { @@ -61,50 +50,35 @@ inline void BRepFeat_SplitShape::Init(const TopoDS_Shape& S) } } -//======================================================================= -// function : SetCheckInterior -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepFeat_SplitShape::SetCheckInterior(const Standard_Boolean ToCheckInterior) +inline void BRepFeat_SplitShape::SetCheckInterior(const bool ToCheckInterior) { myWOnShape->SetCheckInterior(ToCheckInterior); } -//======================================================================= -// function : Add -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_SplitShape::Add(const TopoDS_Wire& W, const TopoDS_Face& F) { myWOnShape->Bind(W, F); } -//======================================================================= -// function : Add -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_SplitShape::Add(const TopoDS_Edge& E, const TopoDS_Face& F) { myWOnShape->Bind(E, F); } -//======================================================================= -// function : Add -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_SplitShape::Add(const TopoDS_Compound& Comp, const TopoDS_Face& F) { myWOnShape->Bind(Comp, F); } -//======================================================================= -// function : Add -// purpose : -//======================================================================= +//================================================================================================= inline void BRepFeat_SplitShape::Add(const TopoDS_Edge& E, const TopoDS_Edge& EOn) { diff --git a/opencascade/BRepFill.hxx b/opencascade/BRepFill.hxx index e8016fc4a..d2af600f6 100644 --- a/opencascade/BRepFill.hxx +++ b/opencascade/BRepFill.hxx @@ -22,7 +22,7 @@ #include #include -#include +#include class TopoDS_Face; class TopoDS_Edge; class TopoDS_Shell; @@ -44,8 +44,8 @@ public: //! The wires must have the same number of edges. Standard_EXPORT static TopoDS_Shell Shell(const TopoDS_Wire& Wire1, const TopoDS_Wire& Wire2); - //! Computes as Follow. is - //! the Position of the nearest vertex V of + //! Computes as Follow. is + //! the Position of the nearest vertex V of //! to . is confused with the tangent //! to at the projected point of V on the Spine. //! is normal to . @@ -53,23 +53,23 @@ public: Standard_EXPORT static void Axe(const TopoDS_Shape& Spine, const TopoDS_Wire& Profile, gp_Ax3& AxeProf, - Standard_Boolean& ProfOnSpine, - const Standard_Real Tol); + bool& ProfOnSpine, + const double Tol); - //! Compute ACR on a wire - Standard_EXPORT static void ComputeACR(const TopoDS_Wire& wire, TColStd_Array1OfReal& ACR); + //! Compute ACR on a wire + Standard_EXPORT static void ComputeACR(const TopoDS_Wire& wire, NCollection_Array1& ACR); - //! Insert ACR on a wire - Standard_EXPORT static TopoDS_Wire InsertACR(const TopoDS_Wire& wire, - const TColStd_Array1OfReal& ACRcuts, - const Standard_Real prec); + //! Insert ACR on a wire + Standard_EXPORT static TopoDS_Wire InsertACR(const TopoDS_Wire& wire, + const NCollection_Array1& ACRcuts, + const double prec); private: //! Computes origins and orientation on a closed wire - Standard_EXPORT static void SearchOrigin(TopoDS_Wire& W, - const gp_Pnt& P, - const gp_Vec& V, - const Standard_Real Tol); + Standard_EXPORT static void SearchOrigin(TopoDS_Wire& W, + const gp_Pnt& P, + const gp_Vec& V, + const double Tol); private: friend class BRepFill_PipeShell; diff --git a/opencascade/BRepFill_ACRLaw.hxx b/opencascade/BRepFill_ACRLaw.hxx index d50137d88..0770b1a70 100644 --- a/opencascade/BRepFill_ACRLaw.hxx +++ b/opencascade/BRepFill_ACRLaw.hxx @@ -20,29 +20,26 @@ #include #include -#include +#include +#include #include class TopoDS_Wire; class GeomFill_LocationGuide; -class BRepFill_ACRLaw; -DEFINE_STANDARD_HANDLE(BRepFill_ACRLaw, BRepFill_LocationLaw) - -//! Build Location Law, with a Wire. In the case +//! Build Location Law, with a Wire. In the case //! of guided contour and trihedron by reduced //! curvilinear abscissa class BRepFill_ACRLaw : public BRepFill_LocationLaw { public: - Standard_EXPORT BRepFill_ACRLaw(const TopoDS_Wire& Path, - const Handle(GeomFill_LocationGuide)& Law); + Standard_EXPORT BRepFill_ACRLaw(const TopoDS_Wire& Path, + const occ::handle& Law); DEFINE_STANDARD_RTTIEXT(BRepFill_ACRLaw, BRepFill_LocationLaw) -protected: private: - Handle(TColStd_HArray1OfReal) OrigParam; + occ::handle> OrigParam; }; #endif // _BRepFill_ACRLaw_HeaderFile diff --git a/opencascade/BRepFill_AdvancedEvolved.hxx b/opencascade/BRepFill_AdvancedEvolved.hxx index 64e965d49..5e68a217a 100644 --- a/opencascade/BRepFill_AdvancedEvolved.hxx +++ b/opencascade/BRepFill_AdvancedEvolved.hxx @@ -22,14 +22,16 @@ #include #include -#include -#include +#include +#include +#include +#include class BOPAlgo_MakerVolume; class TopoDS_Face; //! Constructs an evolved volume from a spine (wire or face) -//! and a profile ( wire). +//! and a profile (wire). class BRepFill_AdvancedEvolved { public: @@ -39,17 +41,17 @@ public: Standard_EXPORT BRepFill_AdvancedEvolved() : myErrorStatus(BRepFill_AdvancedEvolved_Empty), myFuzzyValue(0.0), - myIsParallel(Standard_True), + myIsParallel(true), myDebugShapesPath("C:\\Temp") { } - Standard_EXPORT void Perform(const TopoDS_Wire& theSpine, - const TopoDS_Wire& theProfile, - const Standard_Real theTolerance, - const Standard_Boolean theSolidReq = Standard_True); + Standard_EXPORT void Perform(const TopoDS_Wire& theSpine, + const TopoDS_Wire& theProfile, + const double theTolerance, + const bool theSolidReq = true); - Standard_Boolean IsDone(unsigned int* theErrorCode = 0) const + bool IsDone(unsigned int* theErrorCode = nullptr) const { if (theErrorCode) *theErrorCode = myErrorStatus; @@ -61,10 +63,10 @@ public: const TopoDS_Shape& Shape() const { return myResult; } //! Sets directory where the debug shapes will be saved - void SetTemporaryDirectory(const Standard_CString& thePath) { myDebugShapesPath = thePath; } + void SetTemporaryDirectory(const char* const thePath) { myDebugShapesPath = thePath; } //! Sets/Unsets computation in parallel mode - void SetParallelMode(const Standard_Boolean theVal) { myIsParallel = theVal; } + void SetParallelMode(const bool theVal) { myIsParallel = theVal; } protected: Standard_EXPORT void PerformSweep(); @@ -73,29 +75,31 @@ protected: Standard_EXPORT void BuildSolid(); - Standard_EXPORT void RemoveExcessSolids(const TopTools_ListOfShape& theLSplits, - const TopoDS_Shape& theShape, - TopTools_ListOfShape& theArgsList, - BOPAlgo_MakerVolume& theMV); + Standard_EXPORT void RemoveExcessSolids(const NCollection_List& theLSplits, + const TopoDS_Shape& theShape, + NCollection_List& theArgsList, + BOPAlgo_MakerVolume& theMV); - Standard_EXPORT void ExtractOuterSolid(TopoDS_Shape& theShape, TopTools_ListOfShape& theArgsList); + Standard_EXPORT void ExtractOuterSolid(TopoDS_Shape& theShape, + NCollection_List& theArgsList); Standard_EXPORT void GetSpineAndProfile(const TopoDS_Wire& theSpine, const TopoDS_Wire& theProfile); Standard_EXPORT void UnifyShape(); - Standard_EXPORT Standard_Boolean PerformBoolean(const TopTools_ListOfShape& theArgsList, - TopoDS_Shape& theResult) const; + Standard_EXPORT bool PerformBoolean(const NCollection_List& theArgsList, + TopoDS_Shape& theResult) const; - Standard_EXPORT Standard_Boolean - CheckSingularityAndAdd(const TopoDS_Face& theF, - const Standard_Real theFuzzyToler, - TopTools_ListOfShape& theListOfFaces, - TopTools_ListOfShape& theListOfSplits) const; + Standard_EXPORT bool CheckSingularityAndAdd( + const TopoDS_Face& theF, + const double theFuzzyToler, + NCollection_List& theListOfFaces, + NCollection_List& theListOfSplits) const; - Standard_EXPORT Standard_Boolean IsLid(const TopoDS_Face& theF, - const TopTools_IndexedMapOfShape& theMapOfLids) const; + Standard_EXPORT bool IsLid( + const TopoDS_Face& theF, + const NCollection_IndexedMap& theMapOfLids) const; private: enum @@ -109,14 +113,14 @@ private: BRepFill_AdvancedEvolved_OK = UINT_MAX } myErrorStatus; - TopoDS_Wire mySpine; - TopoDS_Wire myProfile; - TopoDS_Shape myPipeShell; - TopoDS_Compound myTopBottom; // Lids can be split on several faces - TopoDS_Shape myResult; - Standard_Real myFuzzyValue; - Standard_Boolean myIsParallel; - Standard_CString myDebugShapesPath; + TopoDS_Wire mySpine; + TopoDS_Wire myProfile; + TopoDS_Shape myPipeShell; + TopoDS_Compound myTopBottom; // Lids can be split on several faces + TopoDS_Shape myResult; + double myFuzzyValue; + bool myIsParallel; + const char* myDebugShapesPath; }; #endif // _BRepFill_AdvancedEvolved_HeaderFile diff --git a/opencascade/BRepFill_ApproxSeewing.hxx b/opencascade/BRepFill_ApproxSeewing.hxx index f12cfa90c..4fd3298a9 100644 --- a/opencascade/BRepFill_ApproxSeewing.hxx +++ b/opencascade/BRepFill_ApproxSeewing.hxx @@ -39,25 +39,25 @@ public: Standard_EXPORT void Perform(const BRepFill_MultiLine& ML); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the approximation of the 3d Curve - Standard_EXPORT const Handle(Geom_Curve)& Curve() const; + Standard_EXPORT const occ::handle& Curve() const; - //! returns the approximation of the PCurve on the + //! returns the approximation of the PCurve on the //! first face of the MultiLine - Standard_EXPORT const Handle(Geom2d_Curve)& CurveOnF1() const; + Standard_EXPORT const occ::handle& CurveOnF1() const; - //! returns the approximation of the PCurve on the + //! returns the approximation of the PCurve on the //! first face of the MultiLine - Standard_EXPORT const Handle(Geom2d_Curve)& CurveOnF2() const; + Standard_EXPORT const occ::handle& CurveOnF2() const; private: - BRepFill_MultiLine myML; - Standard_Boolean myIsDone; - Handle(Geom_Curve) myCurve; - Handle(Geom2d_Curve) myPCurve1; - Handle(Geom2d_Curve) myPCurve2; + BRepFill_MultiLine myML; + bool myIsDone; + occ::handle myCurve; + occ::handle myPCurve1; + occ::handle myPCurve2; }; #endif // _BRepFill_ApproxSeewing_HeaderFile diff --git a/opencascade/BRepFill_CompatibleWires.hxx b/opencascade/BRepFill_CompatibleWires.hxx index 839115ce2..b18cd4001 100644 --- a/opencascade/BRepFill_CompatibleWires.hxx +++ b/opencascade/BRepFill_CompatibleWires.hxx @@ -21,9 +21,11 @@ #include #include -#include -#include -#include +#include +#include +#include +#include +#include class TopoDS_Edge; //! Constructs a sequence of Wires (with good orientation @@ -36,63 +38,66 @@ public: Standard_EXPORT BRepFill_CompatibleWires(); - Standard_EXPORT BRepFill_CompatibleWires(const TopTools_SequenceOfShape& Sections); + Standard_EXPORT BRepFill_CompatibleWires(const NCollection_Sequence& Sections); - Standard_EXPORT void Init(const TopTools_SequenceOfShape& Sections); + Standard_EXPORT void Init(const NCollection_Sequence& Sections); - Standard_EXPORT void SetPercent(const Standard_Real percent = 0.01); + Standard_EXPORT void SetPercent(const double percent = 0.01); - //! Performs CompatibleWires According to the orientation - //! and the origin of each other - Standard_EXPORT void Perform(const Standard_Boolean WithRotation = Standard_True); + //! Performs CompatibleWires According to the orientation + //! and the origin of each other + Standard_EXPORT void Perform(const bool WithRotation = true); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; BRepFill_ThruSectionErrorStatus GetStatus() const { return myStatus; } //! returns the generated sequence. - Standard_EXPORT const TopTools_SequenceOfShape& Shape() const; + Standard_EXPORT const NCollection_Sequence& Shape() const; - //! Returns the shapes created from a subshape + //! Returns the shapes created from a subshape //! of a section. - Standard_EXPORT const TopTools_ListOfShape& GeneratedShapes(const TopoDS_Edge& SubSection) const; + Standard_EXPORT const NCollection_List& GeneratedShapes( + const TopoDS_Edge& SubSection) const; - Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Generated() const; + Standard_EXPORT const NCollection_DataMap, + TopTools_ShapeMapHasher>& + Generated() const; - Standard_EXPORT Standard_Boolean IsDegeneratedFirstSection() const; + Standard_EXPORT bool IsDegeneratedFirstSection() const; - Standard_EXPORT Standard_Boolean IsDegeneratedLastSection() const; + Standard_EXPORT bool IsDegeneratedLastSection() const; -protected: private: - //! Insert cutting points on closed wires to have same + //! Insert cutting points on closed wires to have same //! number of edges. The sequence of shapes must //! be a sequence of wires. - Standard_EXPORT void SameNumberByPolarMethod(const Standard_Boolean WithRotation = Standard_True); + Standard_EXPORT void SameNumberByPolarMethod(const bool WithRotation = true); - //! Insert cutting points on open wires to have same + //! Insert cutting points on open wires to have same //! number of edges. The sequence of shapes must //! be a sequence of wires. - Standard_EXPORT void SameNumberByACR(const Standard_Boolean report); + Standard_EXPORT void SameNumberByACR(const bool report); - //! Computes origins and orientation on closed wires to + //! Computes origins and orientation on closed wires to //! avoid twisted results. The sequence of shapes must //! be a sequence of wires. must be true //! if SameNumberByPolarMethod was used before. - Standard_EXPORT void ComputeOrigin(const Standard_Boolean polar); + Standard_EXPORT void ComputeOrigin(const bool polar); - //! Computes origins and orientation on open wires to + //! Computes origins and orientation on open wires to //! avoid twisted results. The sequence of shapes must //! be a sequence of wires. Standard_EXPORT void SearchOrigin(); - TopTools_SequenceOfShape myInit; - TopTools_SequenceOfShape myWork; - Standard_Real myPercent; - Standard_Boolean myDegen1; - Standard_Boolean myDegen2; + NCollection_Sequence myInit; + NCollection_Sequence myWork; + double myPercent; + bool myDegen1; + bool myDegen2; BRepFill_ThruSectionErrorStatus myStatus; - TopTools_DataMapOfShapeListOfShape myMap; + NCollection_DataMap, TopTools_ShapeMapHasher> myMap; }; #endif // _BRepFill_CompatibleWires_HeaderFile diff --git a/opencascade/BRepFill_ComputeCLine.hxx b/opencascade/BRepFill_ComputeCLine.hxx index 01ddc2274..9394459b0 100644 --- a/opencascade/BRepFill_ComputeCLine.hxx +++ b/opencascade/BRepFill_ComputeCLine.hxx @@ -20,9 +20,8 @@ #include #include -#include -#include #include +#include #include #include #include @@ -39,21 +38,21 @@ public: //! with a cutting if the corresponding boolean is True. Standard_EXPORT BRepFill_ComputeCLine( const BRepFill_MultiLine& Line, - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-5, - const Standard_Real Tolerance2d = 1.0e-5, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-5, + const double Tolerance2d = 1.0e-5, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); //! Initializes the fields of the algorithm. Standard_EXPORT BRepFill_ComputeCLine( - const Standard_Integer degreemin = 3, - const Standard_Integer degreemax = 8, - const Standard_Real Tolerance3d = 1.0e-05, - const Standard_Real Tolerance2d = 1.0e-05, - const Standard_Boolean cutting = Standard_False, + const int degreemin = 3, + const int degreemax = 8, + const double Tolerance3d = 1.0e-05, + const double Tolerance2d = 1.0e-05, + const bool cutting = false, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint); @@ -61,85 +60,78 @@ public: Standard_EXPORT void Perform(const BRepFill_MultiLine& Line); //! changes the degrees of the approximation. - Standard_EXPORT void SetDegrees(const Standard_Integer degreemin, - const Standard_Integer degreemax); + Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax); //! Changes the tolerances of the approximation. - Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d, - const Standard_Real Tolerance2d); + Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d); //! Changes the constraints of the approximation. Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC); //! Changes the max number of segments, which is allowed for cutting. - Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments); + Standard_EXPORT void SetMaxSegments(const int theMaxSegments); //! Set inverse order of degree selection: //! if theInvOrdr = true, current degree is chosen by inverse order - //! from maxdegree to mindegree. //! By default inverse order is used. - Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder); + Standard_EXPORT void SetInvOrder(const bool theInvOrder); //! Set value of hang checking flag //! if this flag = true, possible hang of algorithm is checked //! and algorithm is forced to stop. //! By default hang checking is used. - Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking); + Standard_EXPORT void SetHangChecking(const bool theHangChecking); //! returns False if at a moment of the approximation, //! the status NoApproximation has been sent by the user //! when more points were needed. - Standard_EXPORT Standard_Boolean IsAllApproximated() const; + Standard_EXPORT bool IsAllApproximated() const; //! returns False if the status NoPointsAdded has been sent. - Standard_EXPORT Standard_Boolean IsToleranceReached() const; + Standard_EXPORT bool IsToleranceReached() const; //! returns the tolerances 2d and 3d of the MultiCurve. - Standard_EXPORT void Error(const Standard_Integer Index, - Standard_Real& tol3d, - Standard_Real& tol2d) const; + Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const; //! Returns the number of MultiCurve doing the approximation //! of the MultiLine. - Standard_EXPORT Standard_Integer NbMultiCurves() const; + Standard_EXPORT int NbMultiCurves() const; //! returns the approximation MultiCurve of range . - Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const; + Standard_EXPORT AppParCurves_MultiCurve Value(const int Index = 1) const; - Standard_EXPORT void Parameters(const Standard_Integer Index, - Standard_Real& firstp, - Standard_Real& lastp) const; + Standard_EXPORT void Parameters(const int Index, double& firstp, double& lastp) const; -protected: private: //! is internally used by the algorithms. - Standard_EXPORT Standard_Boolean Compute(const BRepFill_MultiLine& Line, - const Standard_Real Ufirst, - const Standard_Real Ulast, - Standard_Real& TheTol3d, - Standard_Real& TheTol2d); - - AppParCurves_SequenceOfMultiCurve myMultiCurves; - TColStd_SequenceOfReal myfirstparam; - TColStd_SequenceOfReal mylastparam; - AppParCurves_MultiCurve TheMultiCurve; - Standard_Boolean alldone; - Standard_Boolean tolreached; - TColStd_SequenceOfReal Tolers3d; - TColStd_SequenceOfReal Tolers2d; - Standard_Integer mydegremin; - Standard_Integer mydegremax; - Standard_Real mytol3d; - Standard_Real mytol2d; - Standard_Real currenttol3d; - Standard_Real currenttol2d; - Standard_Boolean mycut; - AppParCurves_Constraint myfirstC; - AppParCurves_Constraint mylastC; - Standard_Integer myMaxSegments; - Standard_Boolean myInvOrder; - Standard_Boolean myHangChecking; + Standard_EXPORT bool Compute(const BRepFill_MultiLine& Line, + const double Ufirst, + const double Ulast, + double& TheTol3d, + double& TheTol2d); + + NCollection_Sequence myMultiCurves; + NCollection_Sequence myfirstparam; + NCollection_Sequence mylastparam; + AppParCurves_MultiCurve TheMultiCurve; + bool alldone; + bool tolreached; + NCollection_Sequence Tolers3d; + NCollection_Sequence Tolers2d; + int mydegremin; + int mydegremax; + double mytol3d; + double mytol2d; + double currenttol3d; + double currenttol2d; + bool mycut; + AppParCurves_Constraint myfirstC; + AppParCurves_Constraint mylastC; + int myMaxSegments; + bool myInvOrder; + bool myHangChecking; }; #endif // _BRepFill_ComputeCLine_HeaderFile diff --git a/opencascade/BRepFill_CurveConstraint.hxx b/opencascade/BRepFill_CurveConstraint.hxx index 9aa4a8cad..1c46bf115 100644 --- a/opencascade/BRepFill_CurveConstraint.hxx +++ b/opencascade/BRepFill_CurveConstraint.hxx @@ -23,9 +23,6 @@ #include #include -class BRepFill_CurveConstraint; -DEFINE_STANDARD_HANDLE(BRepFill_CurveConstraint, GeomPlate_CurveConstraint) - //! same as CurveConstraint from GeomPlate //! with BRepAdaptor_Surface instead of //! GeomAdaptor_Surface @@ -41,22 +38,19 @@ public: //! TolAng is the maximum error to satisfy for G1 constraints //! TolCurv is the maximum error to satisfy for G2 constraints //! These errors can be replaced by laws of criterion. - Standard_EXPORT BRepFill_CurveConstraint(const Handle(Adaptor3d_CurveOnSurface)& Boundary, - const Standard_Integer Order, - const Standard_Integer NPt = 10, - const Standard_Real TolDist = 0.0001, - const Standard_Real TolAng = 0.01, - const Standard_Real TolCurv = 0.1); - - Standard_EXPORT BRepFill_CurveConstraint(const Handle(Adaptor3d_Curve)& Boundary, - const Standard_Integer Tang, - const Standard_Integer NPt = 10, - const Standard_Real TolDist = 0.0001); + Standard_EXPORT BRepFill_CurveConstraint(const occ::handle& Boundary, + const int Order, + const int NPt = 10, + const double TolDist = 0.0001, + const double TolAng = 0.01, + const double TolCurv = 0.1); + + Standard_EXPORT BRepFill_CurveConstraint(const occ::handle& Boundary, + const int Tang, + const int NPt = 10, + const double TolDist = 0.0001); DEFINE_STANDARD_RTTIEXT(BRepFill_CurveConstraint, GeomPlate_CurveConstraint) - -protected: -private: }; #endif // _BRepFill_CurveConstraint_HeaderFile diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape.hxx deleted file mode 100644 index 385873449..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeShape.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeShape.hxx deleted file mode 100644 index 0eb67f598..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfNodeShape.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfNodeShape_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfNodeShape_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape.hxx deleted file mode 100644 index 0201a4aef..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape.hxx deleted file mode 100644 index 9d3851042..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape.hxx deleted file mode 100644 index 05305e927..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt.hxx deleted file mode 100644 index e1d26bcca..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal.hxx b/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal.hxx deleted file mode 100644 index efe8cd8c5..000000000 --- a/opencascade/BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal_HeaderFile -#define BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx b/opencascade/BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx index 14b3ea85d..da09200d0 100644 --- a/opencascade/BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx +++ b/opencascade/BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,16 +11,31 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfNodeDataMapOfShapeShape_HeaderFile -#define BRepFill_DataMapOfNodeDataMapOfShapeShape_HeaderFile +//! @file BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfNodeDataMapOfShapeShape_hxx +#define _BRepFill_DataMapOfNodeDataMapOfShapeShape_hxx + +#include #include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfNodeDataMapOfShapeShape.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepFill_DataMapOfNodeDataMapOfShapeShape is deprecated, use " + "NCollection_DataMap, TopTools_DataMapOfShapeShape> directly") +typedef NCollection_DataMap, TopTools_DataMapOfShapeShape> BRepFill_DataMapOfNodeDataMapOfShapeShape; -typedef NCollection_DataMap::Iterator +Standard_DEPRECATED("BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape is deprecated, use " + "NCollection_DataMap, " + "TopTools_DataMapOfShapeShape>::Iterator directly") +typedef NCollection_DataMap, TopTools_DataMapOfShapeShape>::Iterator BRepFill_DataMapIteratorOfDataMapOfNodeDataMapOfShapeShape; -#endif +#endif // _BRepFill_DataMapOfNodeDataMapOfShapeShape_hxx diff --git a/opencascade/BRepFill_DataMapOfNodeShape.hxx b/opencascade/BRepFill_DataMapOfNodeShape.hxx index c3f460cef..83c0a43d8 100644 --- a/opencascade/BRepFill_DataMapOfNodeShape.hxx +++ b/opencascade/BRepFill_DataMapOfNodeShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,15 +11,30 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfNodeShape_HeaderFile -#define BRepFill_DataMapOfNodeShape_HeaderFile +//! @file BRepFill_DataMapOfNodeShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfNodeShape_hxx +#define _BRepFill_DataMapOfNodeShape_hxx + +#include #include #include #include -typedef NCollection_DataMap BRepFill_DataMapOfNodeShape; -typedef NCollection_DataMap::Iterator +Standard_HEADER_DEPRECATED( + "BRepFill_DataMapOfNodeShape.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BRepFill_DataMapOfNodeShape is deprecated, use " + "NCollection_DataMap, TopoDS_Shape> directly") +typedef NCollection_DataMap, TopoDS_Shape> + BRepFill_DataMapOfNodeShape; +Standard_DEPRECATED( + "BRepFill_DataMapIteratorOfDataMapOfNodeShape is deprecated, use " + "NCollection_DataMap, TopoDS_Shape>::Iterator directly") +typedef NCollection_DataMap, TopoDS_Shape>::Iterator BRepFill_DataMapIteratorOfDataMapOfNodeShape; -#endif +#endif // _BRepFill_DataMapOfNodeShape_hxx diff --git a/opencascade/BRepFill_DataMapOfOrientedShapeListOfShape.hxx b/opencascade/BRepFill_DataMapOfOrientedShapeListOfShape.hxx index edfc5cf9d..461b49843 100644 --- a/opencascade/BRepFill_DataMapOfOrientedShapeListOfShape.hxx +++ b/opencascade/BRepFill_DataMapOfOrientedShapeListOfShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,16 +11,30 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfOrientedShapeListOfShape_HeaderFile -#define BRepFill_DataMapOfOrientedShapeListOfShape_HeaderFile +//! @file BRepFill_DataMapOfOrientedShapeListOfShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfOrientedShapeListOfShape_hxx +#define _BRepFill_DataMapOfOrientedShapeListOfShape_hxx + +#include #include #include #include +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfOrientedShapeListOfShape.hxx is deprecated since " + "OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BRepFill_DataMapOfOrientedShapeListOfShape is deprecated, use " + "NCollection_DataMap directly") typedef NCollection_DataMap BRepFill_DataMapOfOrientedShapeListOfShape; +Standard_DEPRECATED( + "BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape is deprecated, use " + "NCollection_DataMap::Iterator directly") typedef NCollection_DataMap::Iterator BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape; -#endif +#endif // _BRepFill_DataMapOfOrientedShapeListOfShape_hxx diff --git a/opencascade/BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx b/opencascade/BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx index d0d3a2be2..74d2f9362 100644 --- a/opencascade/BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx +++ b/opencascade/BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,21 +11,37 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfShapeDataMapOfShapeListOfShape_HeaderFile -#define BRepFill_DataMapOfShapeDataMapOfShapeListOfShape_HeaderFile +//! @file BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfShapeDataMapOfShapeListOfShape_hxx +#define _BRepFill_DataMapOfShapeDataMapOfShapeListOfShape_hxx + +#include #include #include #include #include +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx is deprecated " + "since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED("BRepFill_DataMapOfShapeDataMapOfShapeListOfShape is deprecated, use " + "NCollection_DataMap directly") typedef NCollection_DataMap BRepFill_DataMapOfShapeDataMapOfShapeListOfShape; +Standard_DEPRECATED( + "BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape is deprecated, use " + "NCollection_DataMap::Iterator directly") typedef NCollection_DataMap::Iterator BRepFill_DataMapIteratorOfDataMapOfShapeDataMapOfShapeListOfShape; -#endif +#endif // _BRepFill_DataMapOfShapeDataMapOfShapeListOfShape_hxx diff --git a/opencascade/BRepFill_DataMapOfShapeHArray2OfShape.hxx b/opencascade/BRepFill_DataMapOfShapeHArray2OfShape.hxx index 204a970af..74919b2ab 100644 --- a/opencascade/BRepFill_DataMapOfShapeHArray2OfShape.hxx +++ b/opencascade/BRepFill_DataMapOfShapeHArray2OfShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,19 +11,37 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfShapeHArray2OfShape_HeaderFile -#define BRepFill_DataMapOfShapeHArray2OfShape_HeaderFile +//! @file BRepFill_DataMapOfShapeHArray2OfShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfShapeHArray2OfShape_hxx +#define _BRepFill_DataMapOfShapeHArray2OfShape_hxx + +#include #include #include #include #include -typedef NCollection_DataMap +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfShapeHArray2OfShape.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepFill_DataMapOfShapeHArray2OfShape is deprecated, use NCollection_DataMap, TopTools_ShapeMapHasher> directly") +typedef NCollection_DataMap, + TopTools_ShapeMapHasher> BRepFill_DataMapOfShapeHArray2OfShape; +Standard_DEPRECATED( + "BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape is deprecated, use " + "NCollection_DataMap, " + "TopTools_ShapeMapHasher>::Iterator directly") typedef NCollection_DataMap, TopTools_ShapeMapHasher>::Iterator BRepFill_DataMapIteratorOfDataMapOfShapeHArray2OfShape; -#endif +#endif // _BRepFill_DataMapOfShapeHArray2OfShape_hxx diff --git a/opencascade/BRepFill_DataMapOfShapeSequenceOfPnt.hxx b/opencascade/BRepFill_DataMapOfShapeSequenceOfPnt.hxx index 072d9bb53..3ee9a3f76 100644 --- a/opencascade/BRepFill_DataMapOfShapeSequenceOfPnt.hxx +++ b/opencascade/BRepFill_DataMapOfShapeSequenceOfPnt.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,17 +11,32 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfShapeSequenceOfPnt_HeaderFile -#define BRepFill_DataMapOfShapeSequenceOfPnt_HeaderFile +//! @file BRepFill_DataMapOfShapeSequenceOfPnt.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfShapeSequenceOfPnt_hxx +#define _BRepFill_DataMapOfShapeSequenceOfPnt_hxx + +#include #include #include #include #include +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfShapeSequenceOfPnt.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepFill_DataMapOfShapeSequenceOfPnt is deprecated, use NCollection_DataMap directly") typedef NCollection_DataMap BRepFill_DataMapOfShapeSequenceOfPnt; +Standard_DEPRECATED("BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt is deprecated, use " + "NCollection_DataMap::Iterator directly") typedef NCollection_DataMap::Iterator BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfPnt; -#endif +#endif // _BRepFill_DataMapOfShapeSequenceOfPnt_hxx diff --git a/opencascade/BRepFill_DataMapOfShapeSequenceOfReal.hxx b/opencascade/BRepFill_DataMapOfShapeSequenceOfReal.hxx index 90fb87475..cc4f9e207 100644 --- a/opencascade/BRepFill_DataMapOfShapeSequenceOfReal.hxx +++ b/opencascade/BRepFill_DataMapOfShapeSequenceOfReal.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,17 +11,32 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_DataMapOfShapeSequenceOfReal_HeaderFile -#define BRepFill_DataMapOfShapeSequenceOfReal_HeaderFile +//! @file BRepFill_DataMapOfShapeSequenceOfReal.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_DataMapOfShapeSequenceOfReal_hxx +#define _BRepFill_DataMapOfShapeSequenceOfReal_hxx + +#include #include #include #include #include +Standard_HEADER_DEPRECATED("BRepFill_DataMapOfShapeSequenceOfReal.hxx is deprecated since OCCT " + "8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepFill_DataMapOfShapeSequenceOfReal is deprecated, use NCollection_DataMap directly") typedef NCollection_DataMap BRepFill_DataMapOfShapeSequenceOfReal; +Standard_DEPRECATED("BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal is deprecated, use " + "NCollection_DataMap::Iterator directly") typedef NCollection_DataMap::Iterator BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal; -#endif +#endif // _BRepFill_DataMapOfShapeSequenceOfReal_hxx diff --git a/opencascade/BRepFill_Draft.hxx b/opencascade/BRepFill_Draft.hxx index 10f84eb38..a02e388ad 100644 --- a/opencascade/BRepFill_Draft.hxx +++ b/opencascade/BRepFill_Draft.hxx @@ -20,9 +20,10 @@ #include #include -#include -#include #include +#include +#include +#include #include #include #include @@ -38,68 +39,64 @@ class BRepFill_Draft public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepFill_Draft(const TopoDS_Shape& Shape, - const gp_Dir& Dir, - const Standard_Real Angle); + Standard_EXPORT BRepFill_Draft(const TopoDS_Shape& Shape, const gp_Dir& Dir, const double Angle); Standard_EXPORT void SetOptions(const BRepFill_TransitionStyle Style = BRepFill_Right, - const Standard_Real AngleMin = 0.01, - const Standard_Real AngleMax = 3.0); + const double AngleMin = 0.01, + const double AngleMax = 3.0); - Standard_EXPORT void SetDraft(const Standard_Boolean IsInternal = Standard_False); + Standard_EXPORT void SetDraft(const bool IsInternal = false); - Standard_EXPORT void Perform(const Standard_Real LengthMax); + Standard_EXPORT void Perform(const double LengthMax); - Standard_EXPORT void Perform(const Handle(Geom_Surface)& Surface, - const Standard_Boolean KeepInsideSurface = Standard_True); + Standard_EXPORT void Perform(const occ::handle& Surface, + const bool KeepInsideSurface = true); - Standard_EXPORT void Perform(const TopoDS_Shape& StopShape, - const Standard_Boolean KeepOutSide = Standard_True); + Standard_EXPORT void Perform(const TopoDS_Shape& StopShape, const bool KeepOutSide = true); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! Returns the draft surface //! To have the complete shape //! you have to use the Shape() methode. Standard_EXPORT TopoDS_Shell Shell() const; - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S); + Standard_EXPORT const NCollection_List& Generated(const TopoDS_Shape& S); Standard_EXPORT TopoDS_Shape Shape() const; -protected: private: - Standard_EXPORT void Init(const Handle(Geom_Surface)& Surf, - const Standard_Real Length, - const Bnd_Box& Box); - - Standard_EXPORT void BuildShell(const Handle(Geom_Surface)& Surf, - const Standard_Boolean KeepOutSide = Standard_False); - - Standard_EXPORT Standard_Boolean Fuse(const TopoDS_Shape& S, const Standard_Boolean KeepOutSide); - - Standard_EXPORT Standard_Boolean Sewing(); - - gp_Dir myDir; - Standard_Real myAngle; - Standard_Real angmin; - Standard_Real angmax; - Standard_Real myTol; - Handle(BRepFill_DraftLaw) myLoc; - Handle(BRepFill_SectionLaw) mySec; - Handle(TopTools_HArray2OfShape) mySections; - Handle(TopTools_HArray2OfShape) myFaces; - TopTools_ListOfShape myGenerated; - TopoDS_Shape myShape; - TopoDS_Shape myTop; - TopoDS_Shell myShell; - TopoDS_Wire myWire; - GeomAbs_Shape myCont; - BRepFill_TransitionStyle myStyle; - Standard_Boolean IsInternal; - Standard_Boolean myDone; + Standard_EXPORT void Init(const occ::handle& Surf, + const double Length, + const Bnd_Box& Box); + + Standard_EXPORT void BuildShell(const occ::handle& Surf, + const bool KeepOutSide = false); + + Standard_EXPORT bool Fuse(const TopoDS_Shape& S, const bool KeepOutSide); + + Standard_EXPORT bool Sewing(); + + gp_Dir myDir; + double myAngle; + double angmin; + double angmax; + double myTol; + occ::handle myLoc; + occ::handle mySec; + occ::handle> mySections; + occ::handle> myFaces; + NCollection_List myGenerated; + TopoDS_Shape myShape; + TopoDS_Shape myTop; + TopoDS_Shell myShell; + TopoDS_Wire myWire; + GeomAbs_Shape myCont; + BRepFill_TransitionStyle myStyle; + bool IsInternal; + bool myDone; }; #endif // _BRepFill_Draft_HeaderFile diff --git a/opencascade/BRepFill_DraftLaw.hxx b/opencascade/BRepFill_DraftLaw.hxx index 1cb928a81..ca349afdf 100644 --- a/opencascade/BRepFill_DraftLaw.hxx +++ b/opencascade/BRepFill_DraftLaw.hxx @@ -24,24 +24,18 @@ class TopoDS_Wire; class GeomFill_LocationDraft; -class BRepFill_DraftLaw; -DEFINE_STANDARD_HANDLE(BRepFill_DraftLaw, BRepFill_Edge3DLaw) - -//! Build Location Law, with a Wire. +//! Build Location Law, with a Wire. class BRepFill_DraftLaw : public BRepFill_Edge3DLaw { public: - Standard_EXPORT BRepFill_DraftLaw(const TopoDS_Wire& Path, - const Handle(GeomFill_LocationDraft)& Law); + Standard_EXPORT BRepFill_DraftLaw(const TopoDS_Wire& Path, + const occ::handle& Law); //! To clean the little discontinuities. - Standard_EXPORT void CleanLaw(const Standard_Real TolAngular); + Standard_EXPORT void CleanLaw(const double TolAngular); DEFINE_STANDARD_RTTIEXT(BRepFill_DraftLaw, BRepFill_Edge3DLaw) - -protected: -private: }; #endif // _BRepFill_DraftLaw_HeaderFile diff --git a/opencascade/BRepFill_Edge3DLaw.hxx b/opencascade/BRepFill_Edge3DLaw.hxx index 59d7b3f8d..c319ce17b 100644 --- a/opencascade/BRepFill_Edge3DLaw.hxx +++ b/opencascade/BRepFill_Edge3DLaw.hxx @@ -24,21 +24,15 @@ class TopoDS_Wire; class GeomFill_LocationLaw; -class BRepFill_Edge3DLaw; -DEFINE_STANDARD_HANDLE(BRepFill_Edge3DLaw, BRepFill_LocationLaw) - -//! Build Location Law, with a Wire. +//! Build Location Law, with a Wire. class BRepFill_Edge3DLaw : public BRepFill_LocationLaw { public: - Standard_EXPORT BRepFill_Edge3DLaw(const TopoDS_Wire& Path, - const Handle(GeomFill_LocationLaw)& Law); + Standard_EXPORT BRepFill_Edge3DLaw(const TopoDS_Wire& Path, + const occ::handle& Law); DEFINE_STANDARD_RTTIEXT(BRepFill_Edge3DLaw, BRepFill_LocationLaw) - -protected: -private: }; #endif // _BRepFill_Edge3DLaw_HeaderFile diff --git a/opencascade/BRepFill_EdgeFaceAndOrder.hxx b/opencascade/BRepFill_EdgeFaceAndOrder.hxx index a5f8b14ee..31e864394 100644 --- a/opencascade/BRepFill_EdgeFaceAndOrder.hxx +++ b/opencascade/BRepFill_EdgeFaceAndOrder.hxx @@ -38,7 +38,6 @@ public: friend class BRepFill_Filling; -protected: private: TopoDS_Edge myEdge; TopoDS_Face myFace; diff --git a/opencascade/BRepFill_EdgeOnSurfLaw.hxx b/opencascade/BRepFill_EdgeOnSurfLaw.hxx index 41b5b1adb..1b4349eff 100644 --- a/opencascade/BRepFill_EdgeOnSurfLaw.hxx +++ b/opencascade/BRepFill_EdgeOnSurfLaw.hxx @@ -23,26 +23,22 @@ class TopoDS_Wire; class TopoDS_Shape; -class BRepFill_EdgeOnSurfLaw; -DEFINE_STANDARD_HANDLE(BRepFill_EdgeOnSurfLaw, BRepFill_LocationLaw) - -//! Build Location Law, with a Wire and a Surface. +//! Build Location Law, with a Wire and a Surface. class BRepFill_EdgeOnSurfLaw : public BRepFill_LocationLaw { public: Standard_EXPORT BRepFill_EdgeOnSurfLaw(const TopoDS_Wire& Path, const TopoDS_Shape& Surf); - //! returns if one Edge of do not have - //! representation on . In this case it is + //! returns if one Edge of do not have + //! representation on . In this case it is //! impossible to use this object. - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; DEFINE_STANDARD_RTTIEXT(BRepFill_EdgeOnSurfLaw, BRepFill_LocationLaw) -protected: private: - Standard_Boolean hasresult; + bool hasresult; }; #endif // _BRepFill_EdgeOnSurfLaw_HeaderFile diff --git a/opencascade/BRepFill_Evolved.hxx b/opencascade/BRepFill_Evolved.hxx index ca2e79a19..69f6ff595 100644 --- a/opencascade/BRepFill_Evolved.hxx +++ b/opencascade/BRepFill_Evolved.hxx @@ -24,9 +24,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include class gp_Ax3; class BRepMAT2d_BisectingLocus; class BRepMAT2d_LinkTopoBilo; @@ -36,7 +36,7 @@ class TopoDS_Edge; class TopoDS_Vertex; //! Constructs an evolved volume from a spine (wire or face) -//! and a profile ( wire). +//! and a profile ( wire). class BRepFill_Evolved { public: @@ -45,8 +45,8 @@ public: Standard_EXPORT BRepFill_Evolved(); //! Creates an evolved shape by sweeping the - //! along the . is used to set the - //! position of along as follows: + //! along the . is used to set the + //! position of along as follows: //! slides on the profile with direction //! colinear to the normal to , and its //! mixed with the tangent to . @@ -54,58 +54,58 @@ public: const TopoDS_Wire& Profile, const gp_Ax3& AxeProf, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean Solid = Standard_False); + const bool Solid = false); - //! Creates an evolved shape by sweeping the + //! Creates an evolved shape by sweeping the //! along the Standard_EXPORT BRepFill_Evolved(const TopoDS_Face& Spine, const TopoDS_Wire& Profile, const gp_Ax3& AxeProf, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean Solid = Standard_False); + const bool Solid = false); - //! Performs an evolved shape by sweeping the + //! Performs an evolved shape by sweeping the //! along the Standard_EXPORT void Perform(const TopoDS_Wire& Spine, const TopoDS_Wire& Profile, const gp_Ax3& AxeProf, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean Solid = Standard_False); + const bool Solid = false); - //! Performs an evolved shape by sweeping the + //! Performs an evolved shape by sweeping the //! along the Standard_EXPORT void Perform(const TopoDS_Face& Spine, const TopoDS_Wire& Profile, const gp_Ax3& AxeProf, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean Solid = Standard_False); + const bool Solid = false); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! returns the generated shape. Standard_EXPORT const TopoDS_Shape& Shape() const; - //! Returns the shapes created from a subshape - //! of the spine and a subshape + //! Returns the shapes created from a subshape + //! of the spine and a subshape //! on the profile. - Standard_EXPORT const TopTools_ListOfShape& GeneratedShapes(const TopoDS_Shape& SpineShape, - const TopoDS_Shape& ProfShape) const; + Standard_EXPORT const NCollection_List& GeneratedShapes( + const TopoDS_Shape& SpineShape, + const TopoDS_Shape& ProfShape) const; Standard_EXPORT GeomAbs_JoinType JoinType() const; //! Return the face Top if is True in the constructor. Standard_EXPORT const TopoDS_Shape& Top() const; - //! Return the face Bottom if is True in the constructor. + //! Return the face Bottom if is True in the constructor. Standard_EXPORT const TopoDS_Shape& Bottom() const; -protected: private: Standard_EXPORT void PrivatePerform(const TopoDS_Face& Spine, const TopoDS_Wire& Profile, const gp_Ax3& AxeProf, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean Solid = Standard_False); + const bool Solid = false); Standard_EXPORT void SetWork(const TopoDS_Face& Spine, const TopoDS_Wire& Profile); @@ -127,32 +127,39 @@ private: BRepMAT2d_LinkTopoBilo& Link, const GeomAbs_JoinType Join = GeomAbs_Arc); - Standard_EXPORT BRepFill_DataMapOfShapeDataMapOfShapeListOfShape& Generated(); + Standard_EXPORT NCollection_DataMap< + TopoDS_Shape, + NCollection_DataMap, TopTools_ShapeMapHasher>, + TopTools_ShapeMapHasher>& + Generated(); Standard_EXPORT void Add(BRepFill_Evolved& Vevo, const TopoDS_Wire& Prof, BRepTools_Quilt& Glue); Standard_EXPORT TopoDS_Shape& ChangeShape(); - Standard_EXPORT void Transfert(BRepFill_Evolved& Vevo, - const TopTools_DataMapOfShapeShape& MapProf, - const TopTools_DataMapOfShapeShape& MapSpine, - const TopLoc_Location& LS, - const TopLoc_Location& InitLS, - const TopLoc_Location& InitLP); + Standard_EXPORT void Transfert( + BRepFill_Evolved& Vevo, + const NCollection_DataMap& MapProf, + const NCollection_DataMap& MapSpine, + const TopLoc_Location& LS, + const TopLoc_Location& InitLS, + const TopLoc_Location& InitLP); //! Prepare the profil as follow //! - Project the profile in the yOz Plane //! - Cut the profile at the extrema of distance from the //! Profile to the Oz Axis. //! - building the new wires with the cutting edges. - Standard_EXPORT void PrepareProfile(TopTools_ListOfShape& WorkProf, - TopTools_DataMapOfShapeShape& MapProf) const; + Standard_EXPORT void PrepareProfile( + NCollection_List& WorkProf, + NCollection_DataMap& MapProf) const; //! Prepare the spine as follow //! - Cut the spine-Edges at the extrema of curvature and //! at the inflexion points. - Standard_EXPORT void PrepareSpine(TopoDS_Face& WorkSpine, - TopTools_DataMapOfShapeShape& SpineProf) const; + Standard_EXPORT void PrepareSpine( + TopoDS_Face& WorkSpine, + NCollection_DataMap& SpineProf) const; Standard_EXPORT void MakePipe(const TopoDS_Edge& SpineEdge, const gp_Ax3& ProfRef); @@ -165,26 +172,30 @@ private: //! if the Shape is not planar. Standard_EXPORT TopLoc_Location FindLocation(const TopoDS_Face& Face) const; - //! Apply the Location to and to + //! Apply the Location to and to //! //! in order to set the Shapes in the work space. Standard_EXPORT void TransformInitWork(const TopLoc_Location& LS, const TopLoc_Location& LP); - Standard_EXPORT void ContinuityOnOffsetEdge(const TopTools_ListOfShape& WorkProf); + Standard_EXPORT void ContinuityOnOffsetEdge(const NCollection_List& WorkProf); Standard_EXPORT void AddTopAndBottom(BRepTools_Quilt& Glue); Standard_EXPORT void MakeSolid(); - TopoDS_Face mySpine; - TopoDS_Wire myProfile; - TopoDS_Shape myShape; - Standard_Boolean myIsDone; - Standard_Boolean mySpineType; - GeomAbs_JoinType myJoinType; - BRepFill_DataMapOfShapeDataMapOfShapeListOfShape myMap; - TopoDS_Shape myTop; - TopoDS_Shape myBottom; + TopoDS_Face mySpine; + TopoDS_Wire myProfile; + TopoDS_Shape myShape; + bool myIsDone; + bool mySpineType; + GeomAbs_JoinType myJoinType; + NCollection_DataMap< + TopoDS_Shape, + NCollection_DataMap, TopTools_ShapeMapHasher>, + TopTools_ShapeMapHasher> + myMap; + TopoDS_Shape myTop; + TopoDS_Shape myBottom; }; #endif // _BRepFill_Evolved_HeaderFile diff --git a/opencascade/BRepFill_FaceAndOrder.hxx b/opencascade/BRepFill_FaceAndOrder.hxx index 088ef73bb..262c016df 100644 --- a/opencascade/BRepFill_FaceAndOrder.hxx +++ b/opencascade/BRepFill_FaceAndOrder.hxx @@ -36,7 +36,6 @@ public: friend class BRepFill_Filling; -protected: private: TopoDS_Face myFace; GeomAbs_Shape myOrder; diff --git a/opencascade/BRepFill_Filling.hxx b/opencascade/BRepFill_Filling.hxx index 963821f6f..d0302ec54 100644 --- a/opencascade/BRepFill_Filling.hxx +++ b/opencascade/BRepFill_Filling.hxx @@ -17,15 +17,17 @@ #ifndef _BRepFill_Filling_HeaderFile #define _BRepFill_Filling_HeaderFile -#include -#include +#include +#include +#include #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include +#include #include @@ -68,16 +70,16 @@ public: DEFINE_STANDARD_ALLOC //! Constructor - Standard_EXPORT BRepFill_Filling(const Standard_Integer Degree = 3, - const Standard_Integer NbPtsOnCur = 15, - const Standard_Integer NbIter = 2, - const Standard_Boolean Anisotropie = Standard_False, - const Standard_Real Tol2d = 0.00001, - const Standard_Real Tol3d = 0.0001, - const Standard_Real TolAng = 0.01, - const Standard_Real TolCurv = 0.1, - const Standard_Integer MaxDeg = 8, - const Standard_Integer MaxSegments = 9); + Standard_EXPORT BRepFill_Filling(const int Degree = 3, + const int NbPtsOnCur = 15, + const int NbIter = 2, + const bool Anisotropie = false, + const double Tol2d = 0.00001, + const double Tol3d = 0.0001, + const double TolAng = 0.01, + const double TolCurv = 0.1, + const int MaxDeg = 8, + const int MaxSegments = 9); //! Sets the values of Tolerances used to control the constraint. //! Tol2d: @@ -87,10 +89,10 @@ public: //! and the constraints //! TolCurv: it is the maximum difference of curvature allowed between //! the surface and the constraint - Standard_EXPORT void SetConstrParam(const Standard_Real Tol2d = 0.00001, - const Standard_Real Tol3d = 0.0001, - const Standard_Real TolAng = 0.01, - const Standard_Real TolCurv = 0.1); + Standard_EXPORT void SetConstrParam(const double Tol2d = 0.00001, + const double Tol3d = 0.0001, + const double TolAng = 0.01, + const double TolCurv = 0.1); //! Sets the parameters used for resolution. //! The default values of these parameters have been chosen for a good @@ -106,14 +108,13 @@ public: //! For each iteration the number of discretisation points is //! increased. //! Anisotropie: - Standard_EXPORT void SetResolParam(const Standard_Integer Degree = 3, - const Standard_Integer NbPtsOnCur = 15, - const Standard_Integer NbIter = 2, - const Standard_Boolean Anisotropie = Standard_False); + Standard_EXPORT void SetResolParam(const int Degree = 3, + const int NbPtsOnCur = 15, + const int NbIter = 2, + const bool Anisotropie = false); //! Sets the parameters used for approximation of the surface - Standard_EXPORT void SetApproxParam(const Standard_Integer MaxDeg = 8, - const Standard_Integer MaxSegments = 9); + Standard_EXPORT void SetApproxParam(const int MaxDeg = 8, const int MaxSegments = 9); //! Loads the initial Surface //! The initial surface must have orthogonal local coordinates, @@ -134,9 +135,9 @@ public: //! GeomAbs_G2 : the surface has to pass by 3D representation //! of the edge and to respect tangency and curvature //! with the first face of the edge. - Standard_EXPORT Standard_Integer Add(const TopoDS_Edge& anEdge, - const GeomAbs_Shape Order, - const Standard_Boolean IsBound = Standard_True); + Standard_EXPORT int Add(const TopoDS_Edge& anEdge, + const GeomAbs_Shape Order, + const bool IsBound = true); //! Adds a new constraint which also defines an edge of the wire //! of the face @@ -149,82 +150,84 @@ public: //! GeomAbs_G2 : the surface has to pass by 3D representation //! of the edge and to respect tangency and curvature //! with the given face. - Standard_EXPORT Standard_Integer Add(const TopoDS_Edge& anEdge, - const TopoDS_Face& Support, - const GeomAbs_Shape Order, - const Standard_Boolean IsBound = Standard_True); + Standard_EXPORT int Add(const TopoDS_Edge& anEdge, + const TopoDS_Face& Support, + const GeomAbs_Shape Order, + const bool IsBound = true); //! Adds a free constraint on a face. The corresponding edge has to //! be automatically recomputed. //! It is always a bound. - Standard_EXPORT Standard_Integer Add(const TopoDS_Face& Support, const GeomAbs_Shape Order); + Standard_EXPORT int Add(const TopoDS_Face& Support, const GeomAbs_Shape Order); //! Adds a punctual constraint - Standard_EXPORT Standard_Integer Add(const gp_Pnt& Point); + Standard_EXPORT int Add(const gp_Pnt& Point); //! Adds a punctual constraint. - Standard_EXPORT Standard_Integer Add(const Standard_Real U, - const Standard_Real V, - const TopoDS_Face& Support, - const GeomAbs_Shape Order); + Standard_EXPORT int Add(const double U, + const double V, + const TopoDS_Face& Support, + const GeomAbs_Shape Order); //! Builds the resulting faces Standard_EXPORT void Build(); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; Standard_EXPORT TopoDS_Face Face() const; //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S); + Standard_EXPORT const NCollection_List& Generated(const TopoDS_Shape& S); - Standard_EXPORT Standard_Real G0Error() const; + Standard_EXPORT double G0Error() const; - Standard_EXPORT Standard_Real G1Error() const; + Standard_EXPORT double G1Error() const; - Standard_EXPORT Standard_Real G2Error() const; + Standard_EXPORT double G2Error() const; - Standard_EXPORT Standard_Real G0Error(const Standard_Integer Index); + Standard_EXPORT double G0Error(const int Index); - Standard_EXPORT Standard_Real G1Error(const Standard_Integer Index); + Standard_EXPORT double G1Error(const int Index); - Standard_EXPORT Standard_Real G2Error(const Standard_Integer Index); + Standard_EXPORT double G2Error(const int Index); private: //! Adds constraints to builder - Standard_EXPORT void AddConstraints(const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints); + Standard_EXPORT void AddConstraints( + const NCollection_Sequence& SeqOfConstraints); //! Builds wires of maximum length - Standard_EXPORT void BuildWires(TopTools_ListOfShape& EdgeList, TopTools_ListOfShape& WireList); + Standard_EXPORT void BuildWires(NCollection_List& EdgeList, + NCollection_List& WireList); //! Finds extremities of future edges to fix the holes between wires. //! Can properly operate only with convex contour - Standard_EXPORT void FindExtremitiesOfHoles(const TopTools_ListOfShape& WireList, - TopTools_SequenceOfShape& VerSeq) const; + Standard_EXPORT void FindExtremitiesOfHoles(const NCollection_List& WireList, + NCollection_Sequence& VerSeq) const; private: - std::shared_ptr myBuilder; - BRepFill_SequenceOfEdgeFaceAndOrder myBoundary; - BRepFill_SequenceOfEdgeFaceAndOrder myConstraints; - BRepFill_SequenceOfFaceAndOrder myFreeConstraints; - GeomPlate_SequenceOfPointConstraint myPoints; - TopTools_DataMapOfShapeShape myOldNewMap; - TopTools_ListOfShape myGenerated; - TopoDS_Face myFace; - TopoDS_Face myInitFace; - Standard_Real myTol2d; - Standard_Real myTol3d; - Standard_Real myTolAng; - Standard_Real myTolCurv; - Standard_Integer myMaxDeg; - Standard_Integer myMaxSegments; - Standard_Integer myDegree; - Standard_Integer myNbPtsOnCur; - Standard_Integer myNbIter; - Standard_Boolean myAnisotropie; - Standard_Boolean myIsInitFaceGiven; - Standard_Boolean myIsDone; + std::shared_ptr myBuilder; + NCollection_Sequence myBoundary; + NCollection_Sequence myConstraints; + NCollection_Sequence myFreeConstraints; + NCollection_Sequence> myPoints; + NCollection_DataMap myOldNewMap; + NCollection_List myGenerated; + TopoDS_Face myFace; + TopoDS_Face myInitFace; + double myTol2d; + double myTol3d; + double myTolAng; + double myTolCurv; + int myMaxDeg; + int myMaxSegments; + int myDegree; + int myNbPtsOnCur; + int myNbIter; + bool myAnisotropie; + bool myIsInitFaceGiven; + bool myIsDone; }; #endif // _BRepFill_Filling_HeaderFile diff --git a/opencascade/BRepFill_Generator.hxx b/opencascade/BRepFill_Generator.hxx index 8fc014acd..3ec89c331 100644 --- a/opencascade/BRepFill_Generator.hxx +++ b/opencascade/BRepFill_Generator.hxx @@ -21,16 +21,17 @@ #include #include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include class TopoDS_Wire; class TopoDS_Shape; -//! Compute a topological surface ( a shell) using +//! Compute a topological surface (a shell) using //! generating wires. The face of the shell will be //! ruled surfaces passing by the wires. //! The wires must have the same number of edges. @@ -43,17 +44,21 @@ public: Standard_EXPORT void AddWire(const TopoDS_Wire& Wire); - //! Compute the shell. + //! Compute the shell. Standard_EXPORT void Perform(); const TopoDS_Shell& Shell() const; - //! Returns all the shapes created - Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Generated() const; + //! Returns all the shapes created + Standard_EXPORT const NCollection_DataMap, + TopTools_ShapeMapHasher>& + Generated() const; - //! Returns the shapes created from a subshape - //! of a section. - Standard_EXPORT const TopTools_ListOfShape& GeneratedShapes(const TopoDS_Shape& SSection) const; + //! Returns the shapes created from a subshape + //! of a section. + Standard_EXPORT const NCollection_List& GeneratedShapes( + const TopoDS_Shape& SSection) const; //! Returns a modified shape in the constructed shell, //! If shape is not changed (replaced) during operation => returns the same shape @@ -62,23 +67,22 @@ public: //! Sets the mutable input state //! If true then the input profile can be modified //! inside the operation. Default value is true. - Standard_EXPORT void SetMutableInput(const Standard_Boolean theIsMutableInput); + Standard_EXPORT void SetMutableInput(const bool theIsMutableInput); //! Returns the current mutable input state - Standard_EXPORT Standard_Boolean IsMutableInput() const; + Standard_EXPORT bool IsMutableInput() const; //! Returns status of the operation BRepFill_ThruSectionErrorStatus GetStatus() const { return myStatus; } -protected: private: - TopTools_SequenceOfShape myWires; + NCollection_Sequence myWires; TopoDS_Shell myShell; - TopTools_DataMapOfShapeListOfShape myMap; - TopTools_DataMapOfShapeShape myOldNewShapes; - BRepTools_ReShape myReshaper; - Standard_Boolean myMutableInput; - BRepFill_ThruSectionErrorStatus myStatus; + NCollection_DataMap, TopTools_ShapeMapHasher> myMap; + NCollection_DataMap myOldNewShapes; + BRepTools_ReShape myReshaper; + bool myMutableInput; + BRepFill_ThruSectionErrorStatus myStatus; }; #include diff --git a/opencascade/BRepFill_Generator.lxx b/opencascade/BRepFill_Generator.lxx index 5b6e74871..05198855e 100644 --- a/opencascade/BRepFill_Generator.lxx +++ b/opencascade/BRepFill_Generator.lxx @@ -14,10 +14,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : Shell -// purpose : -//======================================================================= +//================================================================================================= inline const TopoDS_Shell& BRepFill_Generator::Shell() const { diff --git a/opencascade/BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx b/opencascade/BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx index 73f75ff83..89665c855 100644 --- a/opencascade/BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx +++ b/opencascade/BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,14 +11,26 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_IndexedDataMapOfOrientedShapeListOfShape_HeaderFile -#define BRepFill_IndexedDataMapOfOrientedShapeListOfShape_HeaderFile +//! @file BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_IndexedDataMap directly instead. +#ifndef _BRepFill_IndexedDataMapOfOrientedShapeListOfShape_hxx +#define _BRepFill_IndexedDataMapOfOrientedShapeListOfShape_hxx + +#include #include #include #include +Standard_HEADER_DEPRECATED( + "BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_IndexedDataMap directly.") + + Standard_DEPRECATED("BRepFill_IndexedDataMapOfOrientedShapeListOfShape is deprecated, use " + "NCollection_IndexedDataMap directly") typedef NCollection_IndexedDataMap BRepFill_IndexedDataMapOfOrientedShapeListOfShape; -#endif +#endif // _BRepFill_IndexedDataMapOfOrientedShapeListOfShape_hxx diff --git a/opencascade/BRepFill_ListIteratorOfListOfOffsetWire.hxx b/opencascade/BRepFill_ListIteratorOfListOfOffsetWire.hxx deleted file mode 100644 index ca1b1be11..000000000 --- a/opencascade/BRepFill_ListIteratorOfListOfOffsetWire.hxx +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef BRepFill_ListIteratorOfListOfOffsetWire_HeaderFile -#define BRepFill_ListIteratorOfListOfOffsetWire_HeaderFile - -#include - -#endif diff --git a/opencascade/BRepFill_ListOfOffsetWire.hxx b/opencascade/BRepFill_ListOfOffsetWire.hxx index 6a2aeee85..af9cc9ca5 100644 --- a/opencascade/BRepFill_ListOfOffsetWire.hxx +++ b/opencascade/BRepFill_ListOfOffsetWire.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,13 +11,26 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_ListOfOffsetWire_HeaderFile -#define BRepFill_ListOfOffsetWire_HeaderFile +//! @file BRepFill_ListOfOffsetWire.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection types directly instead. +#ifndef _BRepFill_ListOfOffsetWire_hxx +#define _BRepFill_ListOfOffsetWire_hxx + +#include #include #include -typedef NCollection_List BRepFill_ListOfOffsetWire; +Standard_HEADER_DEPRECATED( + "BRepFill_ListOfOffsetWire.hxx is deprecated since OCCT 8.0.0. Use NCollection types directly.") + + Standard_DEPRECATED( + "BRepFill_ListOfOffsetWire is deprecated, use NCollection_List directly") +typedef NCollection_List BRepFill_ListOfOffsetWire; +Standard_DEPRECATED("BRepFill_ListIteratorOfListOfOffsetWire is deprecated, use " + "NCollection_List::Iterator directly") typedef NCollection_List::Iterator BRepFill_ListIteratorOfListOfOffsetWire; -#endif +#endif // _BRepFill_ListOfOffsetWire_hxx diff --git a/opencascade/BRepFill_LocationLaw.hxx b/opencascade/BRepFill_LocationLaw.hxx index afebbd1cc..574eae0d7 100644 --- a/opencascade/BRepFill_LocationLaw.hxx +++ b/opencascade/BRepFill_LocationLaw.hxx @@ -21,105 +21,97 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include -#include class GeomFill_LocationLaw; class TopoDS_Edge; class TopoDS_Vertex; class TopoDS_Shape; -class BRepFill_LocationLaw; -DEFINE_STANDARD_HANDLE(BRepFill_LocationLaw, Standard_Transient) - -//! Location Law on a Wire. +//! Location Law on a Wire. class BRepFill_LocationLaw : public Standard_Transient { public: - //! Return a error status, if the status is not PipeOk then + //! Return a error status, if the status is not PipeOk then //! it exist a parameter tlike the law is not valuable for t. Standard_EXPORT GeomFill_PipeError GetStatus() const; - //! Apply a linear transformation on each law, to have + //! Apply a linear transformation on each law, to have //! continuity of the global law between the edges. Standard_EXPORT virtual void TransformInG0Law(); //! Apply a linear transformation on each law, to reduce - //! the dicontinuities of law at one rotation. - Standard_EXPORT virtual void TransformInCompatibleLaw(const Standard_Real AngularTolerance); + //! the dicontinuities of law at one rotation. + Standard_EXPORT virtual void TransformInCompatibleLaw(const double AngularTolerance); Standard_EXPORT void DeleteTransform(); - Standard_EXPORT Standard_Integer NbHoles(const Standard_Real Tol = 1.0e-7); + Standard_EXPORT int NbHoles(const double Tol = 1.0e-7); - Standard_EXPORT void Holes(TColStd_Array1OfInteger& Interval) const; + Standard_EXPORT void Holes(NCollection_Array1& Interval) const; //! Return the number of elementary Law - Standard_EXPORT Standard_Integer NbLaw() const; + Standard_EXPORT int NbLaw() const; //! Return the elementary Law of rank //! have to be in [1, NbLaw()] - Standard_EXPORT const Handle(GeomFill_LocationLaw)& Law(const Standard_Integer Index) const; + Standard_EXPORT const occ::handle& Law(const int Index) const; //! return the path Standard_EXPORT const TopoDS_Wire& Wire() const; //! Return the Edge of rank in the path //! have to be in [1, NbLaw()] - Standard_EXPORT const TopoDS_Edge& Edge(const Standard_Integer Index) const; + Standard_EXPORT const TopoDS_Edge& Edge(const int Index) const; //! Return the vertex of rank in the path //! have to be in [0, NbLaw()] - Standard_EXPORT TopoDS_Vertex Vertex(const Standard_Integer Index) const; + Standard_EXPORT TopoDS_Vertex Vertex(const int Index) const; //! Compute like a transformation of - //! the transformation is given by - //! evaluation of the location law in the vertex of - //! rank . - //! is used to manage discontinuities : + //! the transformation is given by + //! evaluation of the location law in the vertex of + //! rank . + //! is used to manage discontinuities: //! - -1 : The law before the vertex is used. //! - 1 : The law after the vertex is used. //! - 0 : Average of the both laws is used. - Standard_EXPORT void PerformVertex(const Standard_Integer Index, - const TopoDS_Vertex& InputVertex, - const Standard_Real TolMin, - TopoDS_Vertex& OutputVertex, - const Standard_Integer Location = 0) const; + Standard_EXPORT void PerformVertex(const int Index, + const TopoDS_Vertex& InputVertex, + const double TolMin, + TopoDS_Vertex& OutputVertex, + const int Location = 0) const; //! Return the Curvilinear Bounds of the Law - Standard_EXPORT void CurvilinearBounds(const Standard_Integer Index, - Standard_Real& First, - Standard_Real& Last) const; + Standard_EXPORT void CurvilinearBounds(const int Index, double& First, double& Last) const; - Standard_EXPORT Standard_Boolean IsClosed() const; + Standard_EXPORT bool IsClosed() const; //! Compute the Law's continuity between 2 edges of the path //! The result can be : //! -1 : Case Not connex //! 0 : It is connex (G0) //! 1 : It is tangent (G1) - Standard_EXPORT Standard_Integer IsG1(const Standard_Integer Index, - const Standard_Real SpatialTolerance = 1.0e-7, - const Standard_Real AngularTolerance = 1.0e-4) const; + Standard_EXPORT int IsG1(const int Index, + const double SpatialTolerance = 1.0e-7, + const double AngularTolerance = 1.0e-4) const; //! Apply the Law to a shape, for a given Curvilinear abscissa - Standard_EXPORT void D0(const Standard_Real Abscissa, TopoDS_Shape& Section); + Standard_EXPORT void D0(const double Abscissa, TopoDS_Shape& Section); //! Find the index Law and the parameter, for a given Curvilinear abscissa - Standard_EXPORT void Parameter(const Standard_Real Abscissa, - Standard_Integer& Index, - Standard_Real& Param); + Standard_EXPORT void Parameter(const double Abscissa, int& Index, double& Param); - //! Return the curvilinear abscissa corresponding to a point - //! of the path, defined by of Edge and a - //! parameter on the edge. - Standard_EXPORT Standard_Real Abscissa(const Standard_Integer Index, const Standard_Real Param); + //! Return the curvilinear abscissa corresponding to a point + //! of the path, defined by of Edge and a parameter + //! on the edge. + Standard_EXPORT double Abscissa(const int Index, const double Param); DEFINE_STANDARD_RTTIEXT(BRepFill_LocationLaw, Standard_Transient) @@ -138,15 +130,15 @@ protected: //! To preserve if possible the BiNormal in transformations Standard_EXPORT void BiNormalIsMain(); - TopoDS_Wire myPath; - Standard_Real myTol; - Handle(GeomFill_HArray1OfLocationLaw) myLaws; - Handle(TColStd_HArray1OfReal) myLength; - Handle(TopTools_HArray1OfShape) myEdges; - Handle(TColStd_HArray1OfInteger) myDisc; + TopoDS_Wire myPath; + double myTol; + occ::handle>> myLaws; + occ::handle> myLength; + occ::handle> myEdges; + occ::handle> myDisc; private: - Standard_Integer myType; + int myType; }; #endif // _BRepFill_LocationLaw_HeaderFile diff --git a/opencascade/BRepFill_MultiLine.hxx b/opencascade/BRepFill_MultiLine.hxx index 02459f043..e22c93e78 100644 --- a/opencascade/BRepFill_MultiLine.hxx +++ b/opencascade/BRepFill_MultiLine.hxx @@ -40,9 +40,9 @@ class gp_Pnt2d; //! two 2d curves resulting from the intersection of a //! surface of linear extrusion( Bissec, Dz) and the 2 //! faces. -//! This 3 curves will have the same parametrization +//! These 3 curves will have the same parametrization //! as the Bissectrice. -//! This class is to be send to an approximation +//! This class is to be sent to an approximation //! routine. class BRepFill_MultiLine : public AppCont_Function { @@ -51,59 +51,59 @@ public: Standard_EXPORT BRepFill_MultiLine(); - Standard_EXPORT BRepFill_MultiLine(const TopoDS_Face& Face1, - const TopoDS_Face& Face2, - const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - const Standard_Boolean Inv1, - const Standard_Boolean Inv2, - const Handle(Geom2d_Curve)& Bissec); + Standard_EXPORT BRepFill_MultiLine(const TopoDS_Face& Face1, + const TopoDS_Face& Face2, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const bool Inv1, + const bool Inv2, + const occ::handle& Bissec); //! Search if the Projection of the Bissectrice on the //! faces needs an approximation or not. //! Returns true if the approximation is not needed. - Standard_EXPORT Standard_Boolean IsParticularCase() const; + Standard_EXPORT bool IsParticularCase() const; - //! Returns the continuity between the two faces - //! seShape from GeomAbsparated by myBis. + //! Returns the continuity between the two faces + //! seShape from GeomAbsparated by myBis. Standard_EXPORT GeomAbs_Shape Continuity() const; //! raises if IsParticularCase is . - Standard_EXPORT void Curves(Handle(Geom_Curve)& Curve, - Handle(Geom2d_Curve)& PCurve1, - Handle(Geom2d_Curve)& PCurve2) const; + Standard_EXPORT void Curves(occ::handle& Curve, + occ::handle& PCurve1, + occ::handle& PCurve2) const; //! returns the first parameter of the Bissectrice. - Standard_EXPORT virtual Standard_Real FirstParameter() const; + Standard_EXPORT double FirstParameter() const override; //! returns the last parameter of the Bissectrice. - Standard_EXPORT virtual Standard_Real LastParameter() const; + Standard_EXPORT double LastParameter() const override; //! Returns the current point on the 3d curve - Standard_EXPORT gp_Pnt Value(const Standard_Real U) const; + Standard_EXPORT gp_Pnt Value(const double U) const; //! returns the current point on the PCurve of the //! first face - Standard_EXPORT gp_Pnt2d ValueOnF1(const Standard_Real U) const; + Standard_EXPORT gp_Pnt2d ValueOnF1(const double U) const; //! returns the current point on the PCurve of the //! first face - Standard_EXPORT gp_Pnt2d ValueOnF2(const Standard_Real U) const; + Standard_EXPORT gp_Pnt2d ValueOnF2(const double U) const; - Standard_EXPORT void Value3dOnF1OnF2(const Standard_Real U, - gp_Pnt& P3d, - gp_Pnt2d& PF1, - gp_Pnt2d& PF2) const; + Standard_EXPORT void Value3dOnF1OnF2(const double U, + gp_Pnt& P3d, + gp_Pnt2d& PF1, + gp_Pnt2d& PF2) const; //! Returns the point at parameter . - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real theU, - NCollection_Array1& thePnt2d, - NCollection_Array1& thePnt) const; + Standard_EXPORT bool Value(const double theU, + NCollection_Array1& thePnt2d, + NCollection_Array1& thePnt) const override; //! Returns the derivative at parameter . - Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real theU, - NCollection_Array1& theVec2d, - NCollection_Array1& theVec) const; + Standard_EXPORT bool D1(const double theU, + NCollection_Array1& theVec2d, + NCollection_Array1& theVec) const override; private: TopoDS_Face myFace1; @@ -112,10 +112,10 @@ private: Geom2dAdaptor_Curve myV1; Geom2dAdaptor_Curve myU2; Geom2dAdaptor_Curve myV2; - Standard_Boolean myIsoU1; - Standard_Boolean myIsoU2; + bool myIsoU1; + bool myIsoU2; Geom2dAdaptor_Curve myBis; - Standard_Integer myKPart; + int myKPart; GeomAbs_Shape myCont; }; diff --git a/opencascade/BRepFill_NSections.hxx b/opencascade/BRepFill_NSections.hxx index 73875410b..3c9add63c 100644 --- a/opencascade/BRepFill_NSections.hxx +++ b/opencascade/BRepFill_NSections.hxx @@ -20,10 +20,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -32,61 +33,52 @@ class GeomFill_SectionLaw; class TopoDS_Vertex; class TopoDS_Shape; -class BRepFill_NSections; -DEFINE_STANDARD_HANDLE(BRepFill_NSections, BRepFill_SectionLaw) - //! Build Section Law, with N Sections class BRepFill_NSections : public BRepFill_SectionLaw { public: //! Construct - Standard_EXPORT BRepFill_NSections(const TopTools_SequenceOfShape& S, - const Standard_Boolean Build = Standard_True); + Standard_EXPORT BRepFill_NSections(const NCollection_Sequence& S, + const bool Build = true); //! Construct - Standard_EXPORT BRepFill_NSections(const TopTools_SequenceOfShape& S, - const GeomFill_SequenceOfTrsf& Trsfs, - const TColStd_SequenceOfReal& P, - const Standard_Real VF, - const Standard_Real VL, - const Standard_Boolean Build = Standard_True); + Standard_EXPORT BRepFill_NSections(const NCollection_Sequence& S, + const NCollection_Sequence& Trsfs, + const NCollection_Sequence& P, + const double VF, + const double VL, + const bool Build = true); - //! Say if the input shape is a vertex. - Standard_EXPORT virtual Standard_Boolean IsVertex() const Standard_OVERRIDE; + //! Say if the input shape is a vertex. + Standard_EXPORT bool IsVertex() const override; - //! Say if the Law is Constant. - Standard_EXPORT virtual Standard_Boolean IsConstant() const Standard_OVERRIDE; + //! Say if the Law is Constant. + Standard_EXPORT bool IsConstant() const override; //! Give the law build on a concatenated section - Standard_EXPORT virtual Handle(GeomFill_SectionLaw) ConcatenedLaw() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ConcatenedLaw() const override; - Standard_EXPORT virtual GeomAbs_Shape Continuity(const Standard_Integer Index, - const Standard_Real TolAngular) const - Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity(const int Index, const double TolAngular) const override; - Standard_EXPORT virtual Standard_Real VertexTol(const Standard_Integer Index, - const Standard_Real Param) const - Standard_OVERRIDE; + Standard_EXPORT double VertexTol(const int Index, const double Param) const override; - Standard_EXPORT virtual TopoDS_Vertex Vertex(const Standard_Integer Index, - const Standard_Real Param) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex Vertex(const int Index, const double Param) const override; - Standard_EXPORT virtual void D0(const Standard_Real Param, TopoDS_Shape& S) Standard_OVERRIDE; + Standard_EXPORT void D0(const double Param, TopoDS_Shape& S) override; DEFINE_STANDARD_RTTIEXT(BRepFill_NSections, BRepFill_SectionLaw) -protected: private: - Standard_EXPORT void Init(const TColStd_SequenceOfReal& P, const Standard_Boolean B); - - Standard_Real VFirst; - Standard_Real VLast; - TopTools_SequenceOfShape myShapes; - GeomFill_SequenceOfTrsf myTrsfs; - TColStd_SequenceOfReal myParams; - Handle(TopTools_HArray2OfShape) myEdges; - Handle(Geom_BSplineSurface) mySurface; + Standard_EXPORT void Init(const NCollection_Sequence& P, const bool B); + + double VFirst; + double VLast; + NCollection_Sequence myShapes; + NCollection_Sequence myTrsfs; + NCollection_Sequence myParams; + occ::handle> myEdges; + occ::handle mySurface; }; #endif // _BRepFill_NSections_HeaderFile diff --git a/opencascade/BRepFill_OffsetAncestors.hxx b/opencascade/BRepFill_OffsetAncestors.hxx index e8a35d36b..0d315b186 100644 --- a/opencascade/BRepFill_OffsetAncestors.hxx +++ b/opencascade/BRepFill_OffsetAncestors.hxx @@ -22,7 +22,9 @@ #include #include -#include +#include +#include +#include class BRepFill_OffsetWire; class TopoDS_Edge; class TopoDS_Shape; @@ -40,19 +42,18 @@ public: Standard_EXPORT void Perform(BRepFill_OffsetWire& Paral); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean HasAncestor(const TopoDS_Edge& S1) const; + Standard_EXPORT bool HasAncestor(const TopoDS_Edge& S1) const; //! may return a Null Shape if S1 is not a subShape //! of ; //! if Perform is not done. Standard_EXPORT const TopoDS_Shape& Ancestor(const TopoDS_Edge& S1) const; -protected: private: - Standard_Boolean myIsPerform; - TopTools_DataMapOfShapeShape myMap; + bool myIsPerform; + NCollection_DataMap myMap; }; #endif // _BRepFill_OffsetAncestors_HeaderFile diff --git a/opencascade/BRepFill_OffsetWire.hxx b/opencascade/BRepFill_OffsetWire.hxx index 1186e55e0..eac41406d 100644 --- a/opencascade/BRepFill_OffsetWire.hxx +++ b/opencascade/BRepFill_OffsetWire.hxx @@ -22,14 +22,14 @@ #include #include -#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include class Bisector_Bisec; class BRepFill_TrimEdgeTool; @@ -54,43 +54,44 @@ public: Standard_EXPORT BRepFill_OffsetWire(const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean IsOpenResult = Standard_False); + const bool IsOpenResult = false); //! Initialize the evaluation of Offsetting. Standard_EXPORT void Init(const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Boolean IsOpenResult = Standard_False); + const bool IsOpenResult = false); - //! Performs an OffsetWire at an altitude from - //! the face ( According to the orientation of the + //! Performs an OffsetWire at an altitude from + //! the face (According to the orientation of the //! face) - Standard_EXPORT void Perform(const Standard_Real Offset, const Standard_Real Alt = 0.0); + Standard_EXPORT void Perform(const double Offset, const double Alt = 0.0); - //! Performs an OffsetWire + //! Performs an OffsetWire Standard_EXPORT void PerformWithBiLo(const TopoDS_Face& WSP, - const Standard_Real Offset, + const double Offset, const BRepMAT2d_BisectingLocus& Locus, BRepMAT2d_LinkTopoBilo& Link, const GeomAbs_JoinType Join = GeomAbs_Arc, - const Standard_Real Alt = 0.0); + const double Alt = 0.0); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; Standard_EXPORT const TopoDS_Face& Spine() const; //! returns the generated shape. Standard_EXPORT const TopoDS_Shape& Shape() const; - //! Returns the shapes created from a subshape + //! Returns the shapes created from a subshape //! of the spine. //! Returns the last computed Offset. - Standard_EXPORT const TopTools_ListOfShape& GeneratedShapes(const TopoDS_Shape& SpineShape); + Standard_EXPORT const NCollection_List& GeneratedShapes( + const TopoDS_Shape& SpineShape); Standard_EXPORT GeomAbs_JoinType JoinType() const; -protected: private: - Standard_EXPORT BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Generated(); + Standard_EXPORT NCollection_IndexedDataMap>& + Generated(); //! Prepare the spine as follow //! - Cut the spine-Edges at the extrema of curvature and @@ -100,15 +101,16 @@ private: //! Add the OffsetWire to and update Standard_EXPORT void Add(const BRepFill_OffsetWire& Other); - Standard_EXPORT void UpdateDetromp(BRepFill_DataMapOfOrientedShapeListOfShape& Detromp, - const TopoDS_Shape& Shape1, - const TopoDS_Shape& Shape2, - const TopTools_SequenceOfShape& Vertices, - const TColgp_SequenceOfPnt& Params, - const Bisector_Bisec& Bisec, - const Standard_Boolean SOnE, - const Standard_Boolean EOnE, - const BRepFill_TrimEdgeTool& Trim) const; + Standard_EXPORT void UpdateDetromp( + NCollection_DataMap>& Detromp, + const TopoDS_Shape& Shape1, + const TopoDS_Shape& Shape2, + const NCollection_Sequence& Vertices, + const NCollection_Sequence& Params, + const Bisector_Bisec& Bisec, + const bool SOnE, + const bool EOnE, + const BRepFill_TrimEdgeTool& Trim) const; //! Constructs the wires with the trimmed offset edges. Standard_EXPORT void MakeWires(); @@ -116,18 +118,18 @@ private: //! Fix holes between open wires where it is possible Standard_EXPORT void FixHoles(); - TopoDS_Face mySpine; - TopoDS_Face myWorkSpine; - Standard_Real myOffset; - Standard_Boolean myIsOpenResult; - TopoDS_Shape myShape; - Standard_Boolean myIsDone; - GeomAbs_JoinType myJoinType; - BRepFill_IndexedDataMapOfOrientedShapeListOfShape myMap; - BRepMAT2d_BisectingLocus myBilo; - BRepMAT2d_LinkTopoBilo myLink; - TopTools_DataMapOfShapeShape myMapSpine; - Standard_Boolean myCallGen; + TopoDS_Face mySpine; + TopoDS_Face myWorkSpine; + double myOffset; + bool myIsOpenResult; + TopoDS_Shape myShape; + bool myIsDone; + GeomAbs_JoinType myJoinType; + NCollection_IndexedDataMap> myMap; + BRepMAT2d_BisectingLocus myBilo; + BRepMAT2d_LinkTopoBilo myLink; + NCollection_DataMap myMapSpine; + bool myCallGen; }; #endif // _BRepFill_OffsetWire_HeaderFile diff --git a/opencascade/BRepFill_Pipe.hxx b/opencascade/BRepFill_Pipe.hxx index 6e54d9616..a46bc84bf 100644 --- a/opencascade/BRepFill_Pipe.hxx +++ b/opencascade/BRepFill_Pipe.hxx @@ -24,9 +24,12 @@ #include #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -37,10 +40,10 @@ class TopoDS_Vertex; class gp_Pnt; class BRepFill_Sweep; -//! Create a shape by sweeping a shape (the profile) +//! Create a shape by sweeping a shape (the profile) //! along a wire (the spine). //! -//! For each edge or vertex from the spine the user +//! For each edge or vertex from the spine the user //! may ask for the shape generated from each subshape //! of the profile. class BRepFill_Pipe @@ -53,12 +56,12 @@ public: Standard_EXPORT BRepFill_Pipe(const TopoDS_Wire& Spine, const TopoDS_Shape& Profile, const GeomFill_Trihedron aMode = GeomFill_IsCorrectedFrenet, - const Standard_Boolean ForceApproxC1 = Standard_False, - const Standard_Boolean GeneratePartCase = Standard_False); + const bool ForceApproxC1 = false, + const bool GeneratePartCase = false); - Standard_EXPORT void Perform(const TopoDS_Wire& Spine, - const TopoDS_Shape& Profile, - const Standard_Boolean GeneratePartCase = Standard_False); + Standard_EXPORT void Perform(const TopoDS_Wire& Spine, + const TopoDS_Shape& Profile, + const bool GeneratePartCase = false); Standard_EXPORT const TopoDS_Shape& Spine() const; @@ -66,15 +69,15 @@ public: Standard_EXPORT const TopoDS_Shape& Shape() const; - Standard_EXPORT Standard_Real ErrorOnSurface() const; + Standard_EXPORT double ErrorOnSurface() const; Standard_EXPORT const TopoDS_Shape& FirstShape() const; Standard_EXPORT const TopoDS_Shape& LastShape() const; - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT void Generated(const TopoDS_Shape& S, TopTools_ListOfShape& L); + Standard_EXPORT void Generated(const TopoDS_Shape& S, NCollection_List& L); //! Returns the face created from an edge of the spine //! and an edge of the profile. @@ -83,11 +86,11 @@ public: //! Returns the edge created from an edge of the spine //! and a vertex of the profile. - //! if the edge or the vertex are not in the spine or + //! if the edge or the vertex are not in the spine or //! the profile. Standard_EXPORT TopoDS_Edge Edge(const TopoDS_Edge& ESpine, const TopoDS_Vertex& VProfile); - //! Returns the shape created from the profile at the + //! Returns the shape created from the profile at the //! position of the vertex VSpine. //! if the vertex is not in the Spine Standard_EXPORT TopoDS_Shape Section(const TopoDS_Vertex& VSpine) const; @@ -96,52 +99,52 @@ public: //! if the is undefined Standard_EXPORT TopoDS_Wire PipeLine(const gp_Pnt& Point); -protected: private: - //! Auxiliary recursive method used to build the - //! result. + //! Auxiliary recursive method used to build the result. Standard_EXPORT TopoDS_Shape MakeShape(const TopoDS_Shape& S, const TopoDS_Shape& theOriginalS, const TopoDS_Shape& FirstShape, const TopoDS_Shape& LastShape); //! Auxiliary recursive method used to find the edge's index - Standard_EXPORT Standard_Integer FindEdge(const TopoDS_Shape& S, - const TopoDS_Edge& E, - Standard_Integer& Init) const; + Standard_EXPORT int FindEdge(const TopoDS_Shape& S, const TopoDS_Edge& E, int& Init) const; - Standard_EXPORT Standard_Integer FindVertex(const TopoDS_Shape& S, - const TopoDS_Vertex& V, - Standard_Integer& Init) const; + Standard_EXPORT int FindVertex(const TopoDS_Shape& S, const TopoDS_Vertex& V, int& Init) const; Standard_EXPORT void DefineRealSegmax(); - Standard_EXPORT void RebuildTopOrBottomFace(const TopoDS_Shape& aFace, - const Standard_Boolean IsTop) const; + Standard_EXPORT void RebuildTopOrBottomFace(const TopoDS_Shape& aFace, const bool IsTop) const; Standard_EXPORT void BuildHistory(const BRepFill_Sweep& theSweep, const TopoDS_Shape& theSection); - TopoDS_Wire mySpine; - TopoDS_Shape myProfile; - TopoDS_Shape myShape; - gp_Trsf myTrsf; - Handle(BRepFill_LocationLaw) myLoc; - Handle(TopTools_HArray2OfShape) mySections; - Handle(TopTools_HArray2OfShape) myFaces; - Handle(TopTools_HArray2OfShape) myEdges; - TopTools_MapOfShape myReversedEdges; - BRepFill_DataMapOfShapeHArray2OfShape myTapes; - BRepFill_DataMapOfShapeHArray2OfShape myRails; - Standard_Integer myCurIndexOfSectionEdge; - TopoDS_Shape myFirst; - TopoDS_Shape myLast; - TopTools_DataMapOfShapeListOfShape myGenMap; - Standard_Integer myDegmax; - Standard_Integer mySegmax; - GeomAbs_Shape myContinuity; - GeomFill_Trihedron myMode; - Standard_Boolean myForceApproxC1; - Standard_Real myErrorOnSurf; + TopoDS_Wire mySpine; + TopoDS_Shape myProfile; + TopoDS_Shape myShape; + gp_Trsf myTrsf; + occ::handle myLoc; + occ::handle> mySections; + occ::handle> myFaces; + occ::handle> myEdges; + NCollection_Map myReversedEdges; + NCollection_DataMap>, + TopTools_ShapeMapHasher> + myTapes; + NCollection_DataMap>, + TopTools_ShapeMapHasher> + myRails; + int myCurIndexOfSectionEdge; + TopoDS_Shape myFirst; + TopoDS_Shape myLast; + NCollection_DataMap, TopTools_ShapeMapHasher> + myGenMap; + int myDegmax; + int mySegmax; + GeomAbs_Shape myContinuity; + GeomFill_Trihedron myMode; + bool myForceApproxC1; + double myErrorOnSurf; }; #endif // _BRepFill_Pipe_HeaderFile diff --git a/opencascade/BRepFill_PipeShell.hxx b/opencascade/BRepFill_PipeShell.hxx index f4eb55fc5..b76bc9a28 100644 --- a/opencascade/BRepFill_PipeShell.hxx +++ b/opencascade/BRepFill_PipeShell.hxx @@ -22,18 +22,19 @@ #include #include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include +#include #include #include #include #include #include -#include -#include -#include class Law_Function; class BRepFill_LocationLaw; class BRepFill_SectionLaw; @@ -43,9 +44,6 @@ class TopoDS_Vertex; class gp_Trsf; class BRepFill_Sweep; -class BRepFill_PipeShell; -DEFINE_STANDARD_HANDLE(BRepFill_PipeShell, Standard_Transient) - //! Computes a topological shell using some wires //! (spines and profiles) and displacement option //! Perform general sweeping construction @@ -58,34 +56,33 @@ public: Standard_EXPORT BRepFill_PipeShell(const TopoDS_Wire& Spine); //! Set an Frenet or an CorrectedFrenet trihedron - //! to perform the sweeping - Standard_EXPORT void Set(const Standard_Boolean Frenet = Standard_False); + //! to perform the sweeping + Standard_EXPORT void Set(const bool Frenet = false); - //! Set a Discrete trihedron - //! to perform the sweeping + //! Set a Discrete trihedron to perform the sweeping Standard_EXPORT void SetDiscrete(); - //! Set an fixed trihedron to perform the sweeping + //! Set an fixed trihedron to perform the sweeping //! all sections will be parallel. Standard_EXPORT void Set(const gp_Ax2& Axe); - //! Set an fixed BiNormal direction to perform + //! Set an fixed BiNormal direction to perform //! the sweeping Standard_EXPORT void Set(const gp_Dir& BiNormal); //! Set support to the spine to define the BiNormal - //! at the spine, like the normal the surfaces. - //! Warning: To be effective, Each edge of the must - //! have an representation on one face of - Standard_EXPORT Standard_Boolean Set(const TopoDS_Shape& SpineSupport); - - //! Set an auxiliary spine to define the Normal - //! For each Point of the Spine P, an Point Q is evalued - //! on + //! at the spine, like the normal the surfaces. + //! Warning: To be effective, Each edge of the must + //! have an representation on one face of + Standard_EXPORT bool Set(const TopoDS_Shape& SpineSupport); + + //! Set an auxiliary spine to define the Normal + //! For each Point of the Spine P, an Point Q is evaluated + //! on //! If - //! Q split with the same length ratio - //! than P split . - //! Else the plan define by P and the tangent to the + //! Q split with the same length ratio + //! than P split . + //! Else the plan define by P and the tangent to the //! intersect in Q. //! If equals BRepFill_NoContact: The Normal is defined //! by the vector PQ. @@ -100,152 +97,166 @@ public: //! becomes a boundary of the swept surface and the width of section varies //! along the path. Standard_EXPORT void Set(const TopoDS_Wire& AuxiliarySpine, - const Standard_Boolean CurvilinearEquivalence = Standard_True, + const bool CurvilinearEquivalence = true, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact); //! Define the maximum V degree of resulting surface - Standard_EXPORT void SetMaxDegree(const Standard_Integer NewMaxDegree); + Standard_EXPORT void SetMaxDegree(const int NewMaxDegree); //! Define the maximum number of spans in V-direction //! on resulting surface - Standard_EXPORT void SetMaxSegments(const Standard_Integer NewMaxSegments); + Standard_EXPORT void SetMaxSegments(const int NewMaxSegments); //! Set the flag that indicates attempt to approximate //! a C1-continuous surface if a swept surface proved //! to be C0. //! Give section to sweep. - //! Possibilities are : + //! Possibilities are: //! - Give one or several profile //! - Give one profile and an homotetic law. //! - Automatic compute of correspondence between profile, and section on the sweeped shape //! - correspondence between profile, and section on the sweeped shape defined by a vertex of the //! spine - Standard_EXPORT void SetForceApproxC1(const Standard_Boolean ForceApproxC1); + Standard_EXPORT void SetForceApproxC1(const bool ForceApproxC1); + + //! Sets the build history flag. + //! If set to True, the pipe shell will store the history of the sections + //! and the spine, which can be used for further modifications or analysis. + inline void SetIsBuildHistory(const bool theIsBuildHistory) + { + myIsBuildHistory = theIsBuildHistory; + } + + //! Returns the build history flag. + //! If True, the pipe shell stores the history of the sections and the spine. + inline bool IsBuildHistory() const { return myIsBuildHistory; } //! Set an section. The correspondence with the spine, will be automatically performed. - Standard_EXPORT void Add(const TopoDS_Shape& Profile, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); + Standard_EXPORT void Add(const TopoDS_Shape& Profile, + const bool WithContact = false, + const bool WithCorrection = false); //! Set an section. The correspondence with the spine, is given by Location. - Standard_EXPORT void Add(const TopoDS_Shape& Profile, - const TopoDS_Vertex& Location, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); - - //! Set an section and an homotetic law. - //! The homotetie's centers is given by point on the . - Standard_EXPORT void SetLaw(const TopoDS_Shape& Profile, - const Handle(Law_Function)& L, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); - - //! Set an section and an homotetic law. - //! The homotetie center is given by point on the - Standard_EXPORT void SetLaw(const TopoDS_Shape& Profile, - const Handle(Law_Function)& L, - const TopoDS_Vertex& Location, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); + Standard_EXPORT void Add(const TopoDS_Shape& Profile, + const TopoDS_Vertex& Location, + const bool WithContact = false, + const bool WithCorrection = false); + + //! Set an section and an homotetic law. + //! The homotetie's centers is given by point on the . + Standard_EXPORT void SetLaw(const TopoDS_Shape& Profile, + const occ::handle& L, + const bool WithContact = false, + const bool WithCorrection = false); + + //! Set an section and an homotetic law. + //! The homotetie center is given by point on the + Standard_EXPORT void SetLaw(const TopoDS_Shape& Profile, + const occ::handle& L, + const TopoDS_Vertex& Location, + const bool WithContact = false, + const bool WithCorrection = false); //! Delete an section. Standard_EXPORT void DeleteProfile(const TopoDS_Shape& Profile); //! Say if is ready to build the shape //! return False if do not have section definition - Standard_EXPORT Standard_Boolean IsReady() const; + Standard_EXPORT bool IsReady() const; //! Get a status, when Simulate or Build failed. Standard_EXPORT GeomFill_PipeError GetStatus() const; - Standard_EXPORT void SetTolerance(const Standard_Real Tol3d = 1.0e-4, - const Standard_Real BoundTol = 1.0e-4, - const Standard_Real TolAngular = 1.0e-2); + Standard_EXPORT void SetTolerance(const double Tol3d = 1.0e-4, + const double BoundTol = 1.0e-4, + const double TolAngular = 1.0e-2); - //! Set the Transition Mode to manage discontinuities + //! Set the Transition Mode to manage discontinuities //! on the sweep. Standard_EXPORT void SetTransition(const BRepFill_TransitionStyle Mode = BRepFill_Modified, - const Standard_Real Angmin = 1.0e-2, - const Standard_Real Angmax = 6.0); + const double Angmin = 1.0e-2, + const double Angmax = 6.0); - //! Perform simulation of the sweep : + //! Perform simulation of the sweep: //! Some Section are returned. - Standard_EXPORT void Simulate(const Standard_Integer NumberOfSection, - TopTools_ListOfShape& Sections); + Standard_EXPORT void Simulate(const int NumberOfSection, + NCollection_List& Sections); //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT Standard_Boolean Build(); + Standard_EXPORT bool Build(); //! Transform the sweeping Shell in Solid. //! If the section are not closed returns False - Standard_EXPORT Standard_Boolean MakeSolid(); + Standard_EXPORT bool MakeSolid(); //! Returns the result Shape. Standard_EXPORT const TopoDS_Shape& Shape() const; - Standard_EXPORT Standard_Real ErrorOnSurface() const; + Standard_EXPORT double ErrorOnSurface() const; - //! Returns the TopoDS Shape of the bottom of the sweep. + //! Returns the TopoDS Shape of the bottom of the sweep. Standard_EXPORT const TopoDS_Shape& FirstShape() const; //! Returns the TopoDS Shape of the top of the sweep. Standard_EXPORT const TopoDS_Shape& LastShape() const; //! Returns the list of original profiles - void Profiles(TopTools_ListOfShape& theProfiles) + void Profiles(NCollection_List& theProfiles) { - for (Standard_Integer i = 1; i <= mySeq.Length(); ++i) + for (int i = 1; i <= mySeq.Length(); ++i) theProfiles.Append(mySeq(i).OriginalShape()); } //! Returns the spine const TopoDS_Wire& Spine() { return mySpine; } - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT void Generated(const TopoDS_Shape& S, TopTools_ListOfShape& L); + Standard_EXPORT void Generated(const TopoDS_Shape& S, NCollection_List& L); DEFINE_STANDARD_RTTIEXT(BRepFill_PipeShell, Standard_Transient) -protected: private: Standard_EXPORT void Prepare(); Standard_EXPORT void Place(const BRepFill_Section& Sec, TopoDS_Wire& W, gp_Trsf& Trsf, - Standard_Real& param); + double& param); Standard_EXPORT void ResetLoc(); Standard_EXPORT void BuildHistory(const BRepFill_Sweep& theSweep); - TopoDS_Wire mySpine; - TopoDS_Shape myFirst; - TopoDS_Shape myLast; - TopoDS_Shape myShape; - BRepFill_SequenceOfSection mySeq; - TopTools_SequenceOfShape WSeq; - TColStd_SequenceOfInteger myIndOfSec; - TopTools_DataMapOfShapeListOfShape myEdgeNewEdges; - TopTools_DataMapOfShapeListOfShape myGenMap; - Standard_Real myTol3d; - Standard_Real myBoundTol; - Standard_Real myTolAngular; - Standard_Real angmin; - Standard_Real angmax; - Standard_Integer myMaxDegree; - Standard_Integer myMaxSegments; - Standard_Boolean myForceApproxC1; - Handle(Law_Function) myLaw; - Standard_Boolean myIsAutomaticLaw; - Handle(BRepFill_LocationLaw) myLocation; - Handle(BRepFill_SectionLaw) mySection; - Handle(TopTools_HArray2OfShape) myFaces; - GeomFill_Trihedron myTrihedron; - BRepFill_TransitionStyle myTransition; - GeomFill_PipeError myStatus; - Standard_Real myErrorOnSurf; + TopoDS_Wire mySpine; + TopoDS_Shape myFirst; + TopoDS_Shape myLast; + TopoDS_Shape myShape; + NCollection_Sequence mySeq; + NCollection_Sequence WSeq; + NCollection_Sequence myIndOfSec; + NCollection_DataMap, TopTools_ShapeMapHasher> + myEdgeNewEdges; + NCollection_DataMap, TopTools_ShapeMapHasher> + myGenMap; + double myTol3d; + double myBoundTol; + double myTolAngular; + double angmin; + double angmax; + int myMaxDegree; + int myMaxSegments; + bool myForceApproxC1; + occ::handle myLaw; + bool myIsAutomaticLaw; + occ::handle myLocation; + occ::handle mySection; + occ::handle> myFaces; + GeomFill_Trihedron myTrihedron; + BRepFill_TransitionStyle myTransition; + GeomFill_PipeError myStatus; + double myErrorOnSurf; + bool myIsBuildHistory; }; #endif // _BRepFill_PipeShell_HeaderFile diff --git a/opencascade/BRepFill_Section.hxx b/opencascade/BRepFill_Section.hxx index a41574777..910759ca4 100644 --- a/opencascade/BRepFill_Section.hxx +++ b/opencascade/BRepFill_Section.hxx @@ -31,12 +31,12 @@ public: Standard_EXPORT BRepFill_Section(); - Standard_EXPORT BRepFill_Section(const TopoDS_Shape& Profile, - const TopoDS_Vertex& V, - const Standard_Boolean WithContact, - const Standard_Boolean WithCorrection); + Standard_EXPORT BRepFill_Section(const TopoDS_Shape& Profile, + const TopoDS_Vertex& V, + const bool WithContact, + const bool WithCorrection); - Standard_EXPORT void Set(const Standard_Boolean IsLaw); + Standard_EXPORT void Set(const bool IsLaw); const TopoDS_Shape& OriginalShape() const; @@ -46,23 +46,22 @@ public: Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& theShape) const; - Standard_Boolean IsLaw() const; + bool IsLaw() const; - Standard_Boolean IsPunctual() const; + bool IsPunctual() const; - Standard_Boolean WithContact() const; + bool WithContact() const; - Standard_Boolean WithCorrection() const; + bool WithCorrection() const; -protected: private: - TopoDS_Shape myOriginalShape; - TopoDS_Wire wire; - TopoDS_Vertex vertex; - Standard_Boolean islaw; - Standard_Boolean ispunctual; - Standard_Boolean contact; - Standard_Boolean correction; + TopoDS_Shape myOriginalShape; + TopoDS_Wire wire; + TopoDS_Vertex vertex; + bool islaw; + bool ispunctual; + bool contact; + bool correction; }; #include diff --git a/opencascade/BRepFill_Section.lxx b/opencascade/BRepFill_Section.lxx index 99d547109..e3728c56e 100644 --- a/opencascade/BRepFill_Section.lxx +++ b/opencascade/BRepFill_Section.lxx @@ -29,22 +29,22 @@ inline const TopoDS_Vertex& BRepFill_Section::Vertex() const return vertex; } -inline Standard_Boolean BRepFill_Section::IsLaw() const +inline bool BRepFill_Section::IsLaw() const { return islaw; } -inline Standard_Boolean BRepFill_Section::IsPunctual() const +inline bool BRepFill_Section::IsPunctual() const { return ispunctual; } -inline Standard_Boolean BRepFill_Section::WithContact() const +inline bool BRepFill_Section::WithContact() const { return contact; } -inline Standard_Boolean BRepFill_Section::WithCorrection() const +inline bool BRepFill_Section::WithCorrection() const { return correction; } diff --git a/opencascade/BRepFill_SectionLaw.hxx b/opencascade/BRepFill_SectionLaw.hxx index 91ef7531a..30bc9a9ea 100644 --- a/opencascade/BRepFill_SectionLaw.hxx +++ b/opencascade/BRepFill_SectionLaw.hxx @@ -20,11 +20,15 @@ #include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include class GeomFill_SectionLaw; class TopoDS_Vertex; @@ -32,43 +36,38 @@ class TopoDS_Shape; class TopoDS_Wire; class TopoDS_Edge; -class BRepFill_SectionLaw; -DEFINE_STANDARD_HANDLE(BRepFill_SectionLaw, Standard_Transient) - //! Build Section Law, with an Vertex, or an Wire class BRepFill_SectionLaw : public Standard_Transient { public: - Standard_EXPORT Standard_Integer NbLaw() const; + Standard_EXPORT int NbLaw() const; - Standard_EXPORT const Handle(GeomFill_SectionLaw)& Law(const Standard_Integer Index) const; + Standard_EXPORT const occ::handle& Law(const int Index) const; - Standard_EXPORT Standard_Integer IndexOfEdge(const TopoDS_Shape& anEdge) const; + Standard_EXPORT int IndexOfEdge(const TopoDS_Shape& anEdge) const; - Standard_EXPORT virtual Standard_Boolean IsConstant() const = 0; + Standard_EXPORT virtual bool IsConstant() const = 0; - Standard_EXPORT Standard_Boolean IsUClosed() const; + Standard_EXPORT bool IsUClosed() const; - Standard_EXPORT Standard_Boolean IsVClosed() const; + Standard_EXPORT bool IsVClosed() const; - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - //! Say if the input shape is a vertex. - Standard_EXPORT virtual Standard_Boolean IsVertex() const = 0; + //! Say if the input shape is a vertex. + Standard_EXPORT virtual bool IsVertex() const = 0; - Standard_EXPORT virtual Handle(GeomFill_SectionLaw) ConcatenedLaw() const = 0; + Standard_EXPORT virtual occ::handle ConcatenedLaw() const = 0; - Standard_EXPORT virtual GeomAbs_Shape Continuity(const Standard_Integer Index, - const Standard_Real TolAngular) const = 0; + Standard_EXPORT virtual GeomAbs_Shape Continuity(const int Index, + const double TolAngular) const = 0; - Standard_EXPORT virtual Standard_Real VertexTol(const Standard_Integer Index, - const Standard_Real Param) const = 0; + Standard_EXPORT virtual double VertexTol(const int Index, const double Param) const = 0; - Standard_EXPORT virtual TopoDS_Vertex Vertex(const Standard_Integer Index, - const Standard_Real Param) const = 0; + Standard_EXPORT virtual TopoDS_Vertex Vertex(const int Index, const double Param) const = 0; - Standard_EXPORT virtual void D0(const Standard_Real U, TopoDS_Shape& S) = 0; + Standard_EXPORT virtual void D0(const double U, TopoDS_Shape& S) = 0; Standard_EXPORT void Init(const TopoDS_Wire& W); @@ -77,11 +76,11 @@ public: DEFINE_STANDARD_RTTIEXT(BRepFill_SectionLaw, Standard_Transient) protected: - Handle(GeomFill_HArray1OfSectionLaw) myLaws; - Standard_Boolean uclosed; - Standard_Boolean vclosed; - Standard_Boolean myDone; - TopTools_DataMapOfShapeInteger myIndices; + occ::handle>> myLaws; + bool uclosed; + bool vclosed; + bool myDone; + NCollection_DataMap myIndices; private: BRepTools_WireExplorer myIterator; diff --git a/opencascade/BRepFill_SectionPlacement.hxx b/opencascade/BRepFill_SectionPlacement.hxx index 3ec2b8821..408097dc5 100644 --- a/opencascade/BRepFill_SectionPlacement.hxx +++ b/opencascade/BRepFill_SectionPlacement.hxx @@ -33,33 +33,32 @@ public: DEFINE_STANDARD_ALLOC //! Automatic placement - Standard_EXPORT BRepFill_SectionPlacement(const Handle(BRepFill_LocationLaw)& Law, - const TopoDS_Shape& Section, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); + Standard_EXPORT BRepFill_SectionPlacement(const occ::handle& Law, + const TopoDS_Shape& Section, + const bool WithContact = false, + const bool WithCorrection = false); //! Placement on vertex - Standard_EXPORT BRepFill_SectionPlacement(const Handle(BRepFill_LocationLaw)& Law, - const TopoDS_Shape& Section, - const TopoDS_Shape& Vertex, - const Standard_Boolean WithContact = Standard_False, - const Standard_Boolean WithCorrection = Standard_False); + Standard_EXPORT BRepFill_SectionPlacement(const occ::handle& Law, + const TopoDS_Shape& Section, + const TopoDS_Shape& Vertex, + const bool WithContact = false, + const bool WithCorrection = false); Standard_EXPORT const gp_Trsf& Transformation() const; - Standard_EXPORT Standard_Real AbscissaOnPath(); + Standard_EXPORT double AbscissaOnPath(); -protected: private: - Standard_EXPORT void Perform(const Standard_Boolean WithContact, - const Standard_Boolean WithCorrection, - const TopoDS_Shape& Vertex); + Standard_EXPORT void Perform(const bool WithContact, + const bool WithCorrection, + const TopoDS_Shape& Vertex); - Handle(BRepFill_LocationLaw) myLaw; - TopoDS_Shape mySection; - gp_Trsf myTrsf; - Standard_Real myParam; - Standard_Integer myIndex; + occ::handle myLaw; + TopoDS_Shape mySection; + gp_Trsf myTrsf; + double myParam; + int myIndex; }; #endif // _BRepFill_SectionPlacement_HeaderFile diff --git a/opencascade/BRepFill_SequenceOfEdgeFaceAndOrder.hxx b/opencascade/BRepFill_SequenceOfEdgeFaceAndOrder.hxx index a65069aa3..c52f35ad8 100644 --- a/opencascade/BRepFill_SequenceOfEdgeFaceAndOrder.hxx +++ b/opencascade/BRepFill_SequenceOfEdgeFaceAndOrder.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_SequenceOfEdgeFaceAndOrder_HeaderFile -#define BRepFill_SequenceOfEdgeFaceAndOrder_HeaderFile +//! @file BRepFill_SequenceOfEdgeFaceAndOrder.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _BRepFill_SequenceOfEdgeFaceAndOrder_hxx +#define _BRepFill_SequenceOfEdgeFaceAndOrder_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepFill_SequenceOfEdgeFaceAndOrder.hxx is deprecated since OCCT " + "8.0.0. Use NCollection_Sequence directly.") + + Standard_DEPRECATED("BRepFill_SequenceOfEdgeFaceAndOrder is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence BRepFill_SequenceOfEdgeFaceAndOrder; -#endif +#endif // _BRepFill_SequenceOfEdgeFaceAndOrder_hxx diff --git a/opencascade/BRepFill_SequenceOfFaceAndOrder.hxx b/opencascade/BRepFill_SequenceOfFaceAndOrder.hxx index e8214f706..2e889bffd 100644 --- a/opencascade/BRepFill_SequenceOfFaceAndOrder.hxx +++ b/opencascade/BRepFill_SequenceOfFaceAndOrder.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_SequenceOfFaceAndOrder_HeaderFile -#define BRepFill_SequenceOfFaceAndOrder_HeaderFile +//! @file BRepFill_SequenceOfFaceAndOrder.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _BRepFill_SequenceOfFaceAndOrder_hxx +#define _BRepFill_SequenceOfFaceAndOrder_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepFill_SequenceOfFaceAndOrder.hxx is deprecated since OCCT 8.0.0. " + "Use NCollection_Sequence directly.") + + Standard_DEPRECATED("BRepFill_SequenceOfFaceAndOrder is deprecated, use " + "NCollection_Sequence directly") typedef NCollection_Sequence BRepFill_SequenceOfFaceAndOrder; -#endif +#endif // _BRepFill_SequenceOfFaceAndOrder_hxx diff --git a/opencascade/BRepFill_SequenceOfSection.hxx b/opencascade/BRepFill_SequenceOfSection.hxx index 160c0e149..df6b64962 100644 --- a/opencascade/BRepFill_SequenceOfSection.hxx +++ b/opencascade/BRepFill_SequenceOfSection.hxx @@ -1,7 +1,4 @@ -// Created on: 1994-03-03 -// Created by: Joelle CHAUVET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -14,12 +11,23 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef BRepFill_SequenceOfSection_HeaderFile -#define BRepFill_SequenceOfSection_HeaderFile +//! @file BRepFill_SequenceOfSection.hxx +//! @brief Deprecated typedef for backward compatibility. +//! @deprecated This header is deprecated since OCCT 8.0.0. +//! Use NCollection_Sequence directly instead. +#ifndef _BRepFill_SequenceOfSection_hxx +#define _BRepFill_SequenceOfSection_hxx + +#include #include #include +Standard_HEADER_DEPRECATED("BRepFill_SequenceOfSection.hxx is deprecated since OCCT 8.0.0. Use " + "NCollection_Sequence directly.") + + Standard_DEPRECATED( + "BRepFill_SequenceOfSection is deprecated, use NCollection_Sequence directly") typedef NCollection_Sequence BRepFill_SequenceOfSection; -#endif +#endif // _BRepFill_SequenceOfSection_hxx diff --git a/opencascade/BRepFill_ShapeLaw.hxx b/opencascade/BRepFill_ShapeLaw.hxx index 1721b97af..2bc648de9 100644 --- a/opencascade/BRepFill_ShapeLaw.hxx +++ b/opencascade/BRepFill_ShapeLaw.hxx @@ -21,7 +21,8 @@ #include #include -#include +#include +#include #include #include #include @@ -31,62 +32,52 @@ class TopoDS_Wire; class GeomFill_SectionLaw; class TopoDS_Edge; -class BRepFill_ShapeLaw; -DEFINE_STANDARD_HANDLE(BRepFill_ShapeLaw, BRepFill_SectionLaw) - //! Build Section Law, with an Vertex, or an Wire class BRepFill_ShapeLaw : public BRepFill_SectionLaw { public: //! Construct an constant Law - Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Vertex& V, - const Standard_Boolean Build = Standard_True); + Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Vertex& V, const bool Build = true); //! Construct an constant Law - Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Wire& W, - const Standard_Boolean Build = Standard_True); + Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Wire& W, const bool Build = true); //! Construct an evolutive Law - Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Wire& W, - const Handle(Law_Function)& L, - const Standard_Boolean Build = Standard_True); + Standard_EXPORT BRepFill_ShapeLaw(const TopoDS_Wire& W, + const occ::handle& L, + const bool Build = true); - //! Say if the input shape is a vertex. - Standard_EXPORT virtual Standard_Boolean IsVertex() const Standard_OVERRIDE; + //! Say if the input shape is a vertex. + Standard_EXPORT bool IsVertex() const override; - //! Say if the Law is Constant. - Standard_EXPORT virtual Standard_Boolean IsConstant() const Standard_OVERRIDE; + //! Say if the Law is Constant. + Standard_EXPORT bool IsConstant() const override; //! Give the law build on a concatenated section - Standard_EXPORT virtual Handle(GeomFill_SectionLaw) ConcatenedLaw() const Standard_OVERRIDE; + Standard_EXPORT occ::handle ConcatenedLaw() const override; - Standard_EXPORT virtual GeomAbs_Shape Continuity(const Standard_Integer Index, - const Standard_Real TolAngular) const - Standard_OVERRIDE; + Standard_EXPORT GeomAbs_Shape Continuity(const int Index, const double TolAngular) const override; - Standard_EXPORT virtual Standard_Real VertexTol(const Standard_Integer Index, - const Standard_Real Param) const - Standard_OVERRIDE; + Standard_EXPORT double VertexTol(const int Index, const double Param) const override; - Standard_EXPORT virtual TopoDS_Vertex Vertex(const Standard_Integer Index, - const Standard_Real Param) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex Vertex(const int Index, const double Param) const override; - Standard_EXPORT virtual void D0(const Standard_Real Param, TopoDS_Shape& S) Standard_OVERRIDE; + Standard_EXPORT void D0(const double Param, TopoDS_Shape& S) override; - const TopoDS_Edge& Edge(const Standard_Integer Index) const; + const TopoDS_Edge& Edge(const int Index) const; DEFINE_STANDARD_RTTIEXT(BRepFill_ShapeLaw, BRepFill_SectionLaw) protected: - Standard_Boolean vertex; + bool vertex; private: - Standard_EXPORT void Init(const Standard_Boolean B); + Standard_EXPORT void Init(const bool B); - TopoDS_Shape myShape; - Handle(TopTools_HArray1OfShape) myEdges; - Handle(Law_Function) TheLaw; + TopoDS_Shape myShape; + occ::handle> myEdges; + occ::handle TheLaw; }; #include diff --git a/opencascade/BRepFill_ShapeLaw.lxx b/opencascade/BRepFill_ShapeLaw.lxx index df30771c2..b124c845f 100644 --- a/opencascade/BRepFill_ShapeLaw.lxx +++ b/opencascade/BRepFill_ShapeLaw.lxx @@ -15,13 +15,13 @@ // commercial license or contractual agreement. #include -#include +#include +#include +#include -//======================================================================= -// function : Edge -// purpose : -//======================================================================= -inline const TopoDS_Edge& BRepFill_ShapeLaw::Edge(const Standard_Integer Index) const +//================================================================================================= + +inline const TopoDS_Edge& BRepFill_ShapeLaw::Edge(const int Index) const { return TopoDS::Edge(myEdges->Value(Index)); } diff --git a/opencascade/BRepFill_Sweep.hxx b/opencascade/BRepFill_Sweep.hxx index ad9417b12..71bd81961 100644 --- a/opencascade/BRepFill_Sweep.hxx +++ b/opencascade/BRepFill_Sweep.hxx @@ -25,27 +25,29 @@ #include #include #include -#include -#include +#include +#include +#include #include -#include -#include +#include +#include +#include #include class BRepFill_LocationLaw; class BRepFill_SectionLaw; class TopoDS_Edge; //! Topological Sweep Algorithm -//! Computes an Sweep shell using a generating +//! Computes an Sweep shell using a generating //! wire, an SectionLaw and an LocationLaw. class BRepFill_Sweep { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, - const Handle(BRepFill_LocationLaw)& Location, - const Standard_Boolean WithKPart); + Standard_EXPORT BRepFill_Sweep(const occ::handle& Section, + const occ::handle& Location, + const bool WithKPart); Standard_EXPORT void SetBounds(const TopoDS_Wire& FirstShape, const TopoDS_Wire& LastShape); @@ -58,22 +60,21 @@ public: //! TolAngular : Tolerance (in radian) to control the angle //! between tangents on the section law and //! tangent of iso-v on approximated surface - Standard_EXPORT void SetTolerance(const Standard_Real Tol3d, - const Standard_Real BoundTol = 1.0, - const Standard_Real Tol2d = 1.0e-5, - const Standard_Real TolAngular = 1.0e-2); + Standard_EXPORT void SetTolerance(const double Tol3d, + const double BoundTol = 1.0, + const double Tol2d = 1.0e-5, + const double TolAngular = 1.0e-2); //! Tolerance To controle Corner management. //! //! If the discontinuity is lesser than in radian The //! Transition Performed will be always "Modified" - Standard_EXPORT void SetAngularControl(const Standard_Real AngleMin = 0.01, - const Standard_Real AngleMax = 6.0); + Standard_EXPORT void SetAngularControl(const double AngleMin = 0.01, const double AngleMax = 6.0); //! Set the flag that indicates attempt to approximate //! a C1-continuous surface if a swept surface proved //! to be C0. - Standard_EXPORT void SetForceApproxC1(const Standard_Boolean ForceApproxC1); + Standard_EXPORT void SetForceApproxC1(const bool ForceApproxC1); //! Build the Sweep Surface //! Transition define Transition strategy @@ -89,92 +90,102 @@ public: //! Degmax : The maximum degree in v required on the surface //! Segmax : The maximum number of span in v required on //! the surface. - Standard_EXPORT void Build(TopTools_MapOfShape& ReversedEdges, - BRepFill_DataMapOfShapeHArray2OfShape& Tapes, - BRepFill_DataMapOfShapeHArray2OfShape& Rails, - const BRepFill_TransitionStyle Transition = BRepFill_Modified, - const GeomAbs_Shape Continuity = GeomAbs_C2, - const GeomFill_ApproxStyle Approx = GeomFill_Location, - const Standard_Integer Degmax = 11, - const Standard_Integer Segmax = 30); + Standard_EXPORT void Build(NCollection_Map& ReversedEdges, + NCollection_DataMap>, + TopTools_ShapeMapHasher>& Tapes, + NCollection_DataMap>, + TopTools_ShapeMapHasher>& Rails, + const BRepFill_TransitionStyle Transition = BRepFill_Modified, + const GeomAbs_Shape Continuity = GeomAbs_C2, + const GeomFill_ApproxStyle Approx = GeomFill_Location, + const int Degmax = 11, + const int Segmax = 30); //! Say if the Shape is Build. - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - //! returns the Sweeping Shape + //! Returns the Sweeping Shape Standard_EXPORT TopoDS_Shape Shape() const; - //! Get the Approximation error. - Standard_EXPORT Standard_Real ErrorOnSurface() const; + //! Get the Approximation error. + Standard_EXPORT double ErrorOnSurface() const; - Standard_EXPORT Handle(TopTools_HArray2OfShape) SubShape() const; + Standard_EXPORT occ::handle> SubShape() const; - Standard_EXPORT Handle(TopTools_HArray2OfShape) InterFaces() const; + Standard_EXPORT occ::handle> InterFaces() const; - Standard_EXPORT Handle(TopTools_HArray2OfShape) Sections() const; + Standard_EXPORT occ::handle> Sections() const; - //! returns the Tape corresponding to Index-th edge of section - Standard_EXPORT TopoDS_Shape Tape(const Standard_Integer Index) const; + //! Returns the Tape corresponding to Index-th edge of section + Standard_EXPORT TopoDS_Shape Tape(const int Index) const; protected: - Standard_EXPORT Standard_Boolean CorrectApproxParameters(); - - Standard_EXPORT Standard_Boolean BuildWire(const BRepFill_TransitionStyle Transition); - - Standard_EXPORT Standard_Boolean BuildShell(const BRepFill_TransitionStyle Transition, - const Standard_Integer Vf, - const Standard_Integer Vl, - TopTools_MapOfShape& ReversedEdges, - BRepFill_DataMapOfShapeHArray2OfShape& Tapes, - BRepFill_DataMapOfShapeHArray2OfShape& Rails, - const Standard_Real ExtendFirst = 0.0, - const Standard_Real ExtendLast = 0.0); - - Standard_EXPORT Standard_Boolean PerformCorner(const Standard_Integer Index, - const BRepFill_TransitionStyle Transition, - const Handle(TopTools_HArray2OfShape)& Bounds); - - Standard_EXPORT Standard_Real EvalExtrapol(const Standard_Integer Index, - const BRepFill_TransitionStyle Transition) const; - - Standard_EXPORT Standard_Boolean MergeVertex(const TopoDS_Shape& V1, TopoDS_Shape& V2) const; - - Standard_EXPORT void UpdateVertex(const Standard_Integer Ipath, - const Standard_Integer Isec, - const Standard_Real Error, - const Standard_Real Param, - TopoDS_Shape& V) const; - - Standard_EXPORT void RebuildTopOrBottomEdge(const TopoDS_Edge& aNewEdge, - TopoDS_Edge& anEdge, - TopTools_MapOfShape& ReversedEdges) const; + Standard_EXPORT bool CorrectApproxParameters(); + + Standard_EXPORT bool BuildWire(const BRepFill_TransitionStyle Transition); + + Standard_EXPORT bool BuildShell( + const BRepFill_TransitionStyle Transition, + const int Vf, + const int Vl, + NCollection_Map& ReversedEdges, + NCollection_DataMap>, + TopTools_ShapeMapHasher>& Tapes, + NCollection_DataMap>, + TopTools_ShapeMapHasher>& Rails, + const double ExtendFirst = 0.0, + const double ExtendLast = 0.0); + + Standard_EXPORT bool PerformCorner(const int Index, + const BRepFill_TransitionStyle Transition, + const occ::handle>& Bounds); + + Standard_EXPORT double EvalExtrapol(const int Index, + const BRepFill_TransitionStyle Transition) const; + + Standard_EXPORT bool MergeVertex(const TopoDS_Shape& V1, TopoDS_Shape& V2) const; + + Standard_EXPORT void UpdateVertex(const int Ipath, + const int Isec, + const double Error, + const double Param, + TopoDS_Shape& V) const; + + Standard_EXPORT void RebuildTopOrBottomEdge( + const TopoDS_Edge& aNewEdge, + TopoDS_Edge& anEdge, + NCollection_Map& ReversedEdges) const; private: - Standard_Boolean isDone; - Standard_Boolean KPart; - Standard_Real myTol3d; - Standard_Real myBoundTol; - Standard_Real myTol2d; - Standard_Real myTolAngular; - Standard_Real myAngMin; - Standard_Real myAngMax; - GeomFill_ApproxStyle myApproxStyle; - GeomAbs_Shape myContinuity; - Standard_Integer myDegmax; - Standard_Integer mySegmax; - Standard_Boolean myForceApproxC1; - TopoDS_Shape myShape; - Handle(BRepFill_LocationLaw) myLoc; - Handle(BRepFill_SectionLaw) mySec; - Handle(TopTools_HArray2OfShape) myUEdges; - Handle(TopTools_HArray2OfShape) myVEdges; - TopTools_DataMapOfShapeShape myVEdgesModified; - Handle(TopTools_HArray2OfShape) myFaces; - TopTools_ListOfShape myAuxShape; - Handle(TopTools_HArray1OfShape) myTapes; - Standard_Real Error; - TopoDS_Wire FirstShape; - TopoDS_Wire LastShape; + bool isDone; + bool KPart; + double myTol3d; + double myBoundTol; + double myTol2d; + double myTolAngular; + double myAngMin; + double myAngMax; + GeomFill_ApproxStyle myApproxStyle; + GeomAbs_Shape myContinuity; + int myDegmax; + int mySegmax; + bool myForceApproxC1; + TopoDS_Shape myShape; + occ::handle myLoc; + occ::handle mySec; + occ::handle> myUEdges; + occ::handle> myVEdges; + NCollection_DataMap myVEdgesModified; + occ::handle> myFaces; + NCollection_List myAuxShape; + occ::handle> myTapes; + double Error; + TopoDS_Wire FirstShape; + TopoDS_Wire LastShape; }; #endif // _BRepFill_Sweep_HeaderFile diff --git a/opencascade/BRepFill_TrimEdgeTool.hxx b/opencascade/BRepFill_TrimEdgeTool.hxx index 97f41b52c..ee9969683 100644 --- a/opencascade/BRepFill_TrimEdgeTool.hxx +++ b/opencascade/BRepFill_TrimEdgeTool.hxx @@ -25,7 +25,8 @@ #include #include #include -#include +#include +#include class Geom2d_Curve; class Geom2d_Geometry; class TopoDS_Edge; @@ -40,39 +41,38 @@ public: Standard_EXPORT BRepFill_TrimEdgeTool(); - Standard_EXPORT BRepFill_TrimEdgeTool(const Bisector_Bisec& Bisec, - const Handle(Geom2d_Geometry)& S1, - const Handle(Geom2d_Geometry)& S2, - const Standard_Real Offset); + Standard_EXPORT BRepFill_TrimEdgeTool(const Bisector_Bisec& Bisec, + const occ::handle& S1, + const occ::handle& S2, + const double Offset); - Standard_EXPORT void IntersectWith(const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - const TopoDS_Shape& InitShape1, - const TopoDS_Shape& InitShape2, - const TopoDS_Vertex& End1, - const TopoDS_Vertex& End2, - const GeomAbs_JoinType theJoinType, - const Standard_Boolean IsOpenResult, - TColgp_SequenceOfPnt& Params); + Standard_EXPORT void IntersectWith(const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const TopoDS_Shape& InitShape1, + const TopoDS_Shape& InitShape2, + const TopoDS_Vertex& End1, + const TopoDS_Vertex& End2, + const GeomAbs_JoinType theJoinType, + const bool IsOpenResult, + NCollection_Sequence& Params); - Standard_EXPORT void AddOrConfuse(const Standard_Boolean Start, - const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - TColgp_SequenceOfPnt& Params) const; + Standard_EXPORT void AddOrConfuse(const bool Start, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + NCollection_Sequence& Params) const; - Standard_EXPORT Standard_Boolean IsInside(const gp_Pnt2d& P) const; + Standard_EXPORT bool IsInside(const gp_Pnt2d& P) const; -protected: private: - Standard_Boolean isPoint1; - Standard_Boolean isPoint2; - gp_Pnt2d myP1; - gp_Pnt2d myP2; - Handle(Geom2d_Curve) myC1; - Handle(Geom2d_Curve) myC2; - Standard_Real myOffset; - Bisector_Bisec myBisec; - Geom2dAdaptor_Curve myBis; + bool isPoint1; + bool isPoint2; + gp_Pnt2d myP1; + gp_Pnt2d myP2; + occ::handle myC1; + occ::handle myC2; + double myOffset; + Bisector_Bisec myBisec; + Geom2dAdaptor_Curve myBis; }; #endif // _BRepFill_TrimEdgeTool_HeaderFile diff --git a/opencascade/BRepFill_TrimShellCorner.hxx b/opencascade/BRepFill_TrimShellCorner.hxx index 489ce2197..7342f9e6c 100644 --- a/opencascade/BRepFill_TrimShellCorner.hxx +++ b/opencascade/BRepFill_TrimShellCorner.hxx @@ -23,10 +23,13 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include //! Trims sets of faces in the corner to make proper parts of pipe @@ -41,58 +44,59 @@ public: //! theIntersectPointCrossDirection : prev path direction at the origin point of theAxeOfBisPlane //! cross next path direction at the origin point of theAxeOfBisPlane. used when EE has more than //! one vertices - Standard_EXPORT BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces, - const BRepFill_TransitionStyle theTransition, - const gp_Ax2& theAxeOfBisPlane, - const gp_Vec& theIntPointCrossDir); + Standard_EXPORT BRepFill_TrimShellCorner( + const occ::handle>& theFaces, + const BRepFill_TransitionStyle theTransition, + const gp_Ax2& theAxeOfBisPlane, + const gp_Vec& theIntPointCrossDir); - Standard_EXPORT void AddBounds(const Handle(TopTools_HArray2OfShape)& Bounds); + Standard_EXPORT void AddBounds(const occ::handle>& Bounds); - Standard_EXPORT void AddUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges); + Standard_EXPORT void AddUEdges(const occ::handle>& theUEdges); - Standard_EXPORT void AddVEdges(const Handle(TopTools_HArray2OfShape)& theVEdges, - const Standard_Integer theIndex); + Standard_EXPORT void AddVEdges(const occ::handle>& theVEdges, + const int theIndex); Standard_EXPORT void Perform(); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; - Standard_EXPORT Standard_Boolean HasSection() const; + Standard_EXPORT bool HasSection() const; - Standard_EXPORT void Modified(const TopoDS_Shape& S, TopTools_ListOfShape& theModified); + Standard_EXPORT void Modified(const TopoDS_Shape& S, NCollection_List& theModified); -protected: private: - Standard_Boolean MakeFacesSec(const Standard_Integer theIndex, - const BOPDS_PDS& theDS, - const Standard_Integer theFaceIndex1, - const Standard_Integer theFaceIndex2, - const Standard_Integer theSSInterfIndex); - - Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex, - const BOPDS_PDS& theDS, - const Standard_Integer theFaceIndex1, - const Standard_Integer theFaceIndex2); - - Standard_Boolean ChooseSection(const TopoDS_Shape& Comp, - const TopoDS_Vertex& theFirstVertex, - const TopoDS_Vertex& theLastVertex, - TopoDS_Shape& resWire, - gp_Pln& resPlane, - Standard_Boolean& IsSingular); - - BRepFill_TransitionStyle myTransition; - gp_Ax2 myAxeOfBisPlane; - gp_Vec myIntPointCrossDir; - TopoDS_Shape myShape1; - TopoDS_Shape myShape2; - Handle(TopTools_HArray2OfShape) myBounds; - Handle(TopTools_HArray2OfShape) myUEdges; - Handle(TopTools_HArray1OfShape) myVEdges; - Handle(TopTools_HArray2OfShape) myFaces; - Standard_Boolean myDone; - Standard_Boolean myHasSection; - TopTools_DataMapOfShapeListOfShape myHistMap; + bool MakeFacesSec(const int theIndex, + const BOPDS_PDS& theDS, + const int theFaceIndex1, + const int theFaceIndex2, + const int theSSInterfIndex); + + bool MakeFacesNonSec(const int theIndex, + const BOPDS_PDS& theDS, + const int theFaceIndex1, + const int theFaceIndex2); + + bool ChooseSection(const TopoDS_Shape& Comp, + const TopoDS_Vertex& theFirstVertex, + const TopoDS_Vertex& theLastVertex, + TopoDS_Shape& resWire, + gp_Pln& resPlane, + bool& IsSingular); + + BRepFill_TransitionStyle myTransition; + gp_Ax2 myAxeOfBisPlane; + gp_Vec myIntPointCrossDir; + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; + occ::handle> myBounds; + occ::handle> myUEdges; + occ::handle> myVEdges; + occ::handle> myFaces; + bool myDone; + bool myHasSection; + NCollection_DataMap, TopTools_ShapeMapHasher> + myHistMap; }; #endif // _BRepFill_TrimShellCorner_HeaderFile diff --git a/opencascade/BRepFill_TrimSurfaceTool.hxx b/opencascade/BRepFill_TrimSurfaceTool.hxx index 7d5a4a555..f49f6ba4a 100644 --- a/opencascade/BRepFill_TrimSurfaceTool.hxx +++ b/opencascade/BRepFill_TrimSurfaceTool.hxx @@ -23,61 +23,61 @@ #include #include -#include +#include +#include #include class Geom2d_Curve; class gp_Pnt2d; class Geom_Curve; -//! Compute the Pcurves and the 3d curves resulting +//! Compute the Pcurves and the 3d curves resulting //! of the trimming of a face by an extruded surface. class BRepFill_TrimSurfaceTool { public: DEFINE_STANDARD_ALLOC - Standard_EXPORT BRepFill_TrimSurfaceTool(const Handle(Geom2d_Curve)& Bis, - const TopoDS_Face& Face1, - const TopoDS_Face& Face2, - const TopoDS_Edge& Edge1, - const TopoDS_Edge& Edge2, - const Standard_Boolean Inv1, - const Standard_Boolean Inv2); + Standard_EXPORT BRepFill_TrimSurfaceTool(const occ::handle& Bis, + const TopoDS_Face& Face1, + const TopoDS_Face& Face2, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const bool Inv1, + const bool Inv2); - //! Intersect with the projection of the edges + //! Intersect with the projection of the edges //! and returns the intersecting parameters //! on Bis and on the edges //! P.X() : Parameter on Bis //! P.Y() : Parameter on EdgeOnF1 //! P.Z() : Parameter on EdgeOnF2 //! raises if is not a edge of Face1 or Face2. - Standard_EXPORT void IntersectWith(const TopoDS_Edge& EdgeOnF1, - const TopoDS_Edge& EdgeOnF2, - TColgp_SequenceOfPnt& Points) const; + Standard_EXPORT void IntersectWith(const TopoDS_Edge& EdgeOnF1, + const TopoDS_Edge& EdgeOnF2, + NCollection_Sequence& Points) const; //! returns True if the Line (P, DZ) intersect the Faces - Standard_EXPORT Standard_Boolean IsOnFace(const gp_Pnt2d& Point) const; + Standard_EXPORT bool IsOnFace(const gp_Pnt2d& Point) const; - //! returns the parameter of the point on the + //! returns the parameter of the point on the //! Edge , assuming that the point is on the edge. - Standard_EXPORT Standard_Real ProjOn(const gp_Pnt2d& Point, const TopoDS_Edge& Edge) const; + Standard_EXPORT double ProjOn(const gp_Pnt2d& Point, const TopoDS_Edge& Edge) const; - Standard_EXPORT void Project(const Standard_Real U1, - const Standard_Real U2, - Handle(Geom_Curve)& Curve, - Handle(Geom2d_Curve)& PCurve1, - Handle(Geom2d_Curve)& PCurve2, - GeomAbs_Shape& myCont) const; + Standard_EXPORT void Project(const double U1, + const double U2, + occ::handle& Curve, + occ::handle& PCurve1, + occ::handle& PCurve2, + GeomAbs_Shape& myCont) const; -protected: private: - TopoDS_Face myFace1; - TopoDS_Face myFace2; - TopoDS_Edge myEdge1; - TopoDS_Edge myEdge2; - Standard_Boolean myInv1; - Standard_Boolean myInv2; - Handle(Geom2d_Curve) myBis; + TopoDS_Face myFace1; + TopoDS_Face myFace2; + TopoDS_Edge myEdge1; + TopoDS_Edge myEdge2; + bool myInv1; + bool myInv2; + occ::handle myBis; }; #endif // _BRepFill_TrimSurfaceTool_HeaderFile diff --git a/opencascade/BRepFilletAPI_LocalOperation.hxx b/opencascade/BRepFilletAPI_LocalOperation.hxx index 64425ea17..cb7081855 100644 --- a/opencascade/BRepFilletAPI_LocalOperation.hxx +++ b/opencascade/BRepFilletAPI_LocalOperation.hxx @@ -23,7 +23,9 @@ #include #include -#include +#include +#include +#include class TopoDS_Edge; class TopoDS_Vertex; @@ -33,72 +35,67 @@ class BRepFilletAPI_LocalOperation : public BRepBuilderAPI_MakeShape public: DEFINE_STANDARD_ALLOC - //! Adds a contour in the builder (builds a - //! contour of tangent edges). + //! Adds a contour in the builder (builds a + //! contour of tangent edges). Standard_EXPORT virtual void Add(const TopoDS_Edge& E) = 0; //! Reset the contour of index IC, there is nomore //! information in the contour. - Standard_EXPORT virtual void ResetContour(const Standard_Integer IC) = 0; + Standard_EXPORT virtual void ResetContour(const int IC) = 0; //! Number of contours. - Standard_EXPORT virtual Standard_Integer NbContours() const = 0; + Standard_EXPORT virtual int NbContours() const = 0; - //! Returns the index of the contour containing the edge + //! Returns the index of the contour containing the edge //! E, returns 0 if E doesn't belong to any contour. - Standard_EXPORT virtual Standard_Integer Contour(const TopoDS_Edge& E) const = 0; + Standard_EXPORT virtual int Contour(const TopoDS_Edge& E) const = 0; //! Number of Edges in the contour I. - Standard_EXPORT virtual Standard_Integer NbEdges(const Standard_Integer I) const = 0; + Standard_EXPORT virtual int NbEdges(const int I) const = 0; //! Returns the Edge J in the contour I. - Standard_EXPORT virtual const TopoDS_Edge& Edge(const Standard_Integer I, - const Standard_Integer J) const = 0; + Standard_EXPORT virtual const TopoDS_Edge& Edge(const int I, const int J) const = 0; //! remove the contour containing the Edge E. Standard_EXPORT virtual void Remove(const TopoDS_Edge& E) = 0; //! returns the length the contour of index IC. - Standard_EXPORT virtual Standard_Real Length(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual double Length(const int IC) const = 0; //! Returns the first Vertex of the contour of index IC. - Standard_EXPORT virtual TopoDS_Vertex FirstVertex(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual TopoDS_Vertex FirstVertex(const int IC) const = 0; //! Returns the last Vertex of the contour of index IC. - Standard_EXPORT virtual TopoDS_Vertex LastVertex(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual TopoDS_Vertex LastVertex(const int IC) const = 0; //! returns the abscissa of the vertex V on //! the contour of index IC. - Standard_EXPORT virtual Standard_Real Abscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const = 0; + Standard_EXPORT virtual double Abscissa(const int IC, const TopoDS_Vertex& V) const = 0; //! returns the relative abscissa([0.,1.]) of the //! vertex V on the contour of index IC. - Standard_EXPORT virtual Standard_Real RelativeAbscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const = 0; + Standard_EXPORT virtual double RelativeAbscissa(const int IC, const TopoDS_Vertex& V) const = 0; //! returns true if the contour of index IC is closed //! an tangent. - Standard_EXPORT virtual Standard_Boolean ClosedAndTangent(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual bool ClosedAndTangent(const int IC) const = 0; //! returns true if the contour of index IC is closed - Standard_EXPORT virtual Standard_Boolean Closed(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual bool Closed(const int IC) const = 0; - //! Reset all the fields updated by Build operation and - //! leave the algorithm in the same state than before - //! build call. It allows contours and radius - //! modifications to build the result another time. + //! Reset all the fields updated by Build operation and + //! leave the algorithm in the same state than before + //! build call. It allows contours and radius + //! modifications to build the result another time. Standard_EXPORT virtual void Reset() = 0; - Standard_EXPORT virtual void Simulate(const Standard_Integer IC) = 0; + Standard_EXPORT virtual void Simulate(const int IC) = 0; - Standard_EXPORT virtual Standard_Integer NbSurf(const Standard_Integer IC) const = 0; + Standard_EXPORT virtual int NbSurf(const int IC) const = 0; - Standard_EXPORT virtual Handle(ChFiDS_SecHArray1) Sect(const Standard_Integer IC, - const Standard_Integer IS) const = 0; - -protected: -private: + Standard_EXPORT virtual occ::handle> Sect( + const int IC, + const int IS) const = 0; }; #endif // _BRepFilletAPI_LocalOperation_HeaderFile diff --git a/opencascade/BRepFilletAPI_MakeChamfer.hxx b/opencascade/BRepFilletAPI_MakeChamfer.hxx index 25b465e3c..7a900b2d7 100644 --- a/opencascade/BRepFilletAPI_MakeChamfer.hxx +++ b/opencascade/BRepFilletAPI_MakeChamfer.hxx @@ -22,12 +22,16 @@ #include #include -#include +#include +#include +#include #include #include #include -#include -#include +#include +#include +#include +#include class TopoDS_Shape; class TopoDS_Edge; class TopoDS_Face; @@ -53,7 +57,7 @@ public: //! Adds edge E to the table of edges used by this //! algorithm to build chamfers, where the parameters //! of the chamfer must be set after the - Standard_EXPORT void Add(const TopoDS_Edge& E) Standard_OVERRIDE; + Standard_EXPORT void Add(const TopoDS_Edge& E) override; //! Adds edge E to the table of edges used by this //! algorithm to build chamfers, where @@ -67,7 +71,7 @@ public: //! series of faces being located on either side of the contour. //! Warning //! Nothing is done if edge E or the face F does not belong to the initial shape. - Standard_EXPORT void Add(const Standard_Real Dis, const TopoDS_Edge& E); + Standard_EXPORT void Add(const double Dis, const TopoDS_Edge& E); //! Sets the distances Dis1 and Dis2 which give the //! parameters of the chamfer along the contour of index @@ -77,11 +81,9 @@ public: //! Warning //! Nothing is done if either the edge E or the face F //! does not belong to the initial shape. - Standard_EXPORT void SetDist(const Standard_Real Dis, - const Standard_Integer IC, - const TopoDS_Face& F); + Standard_EXPORT void SetDist(const double Dis, const int IC, const TopoDS_Face& F); - Standard_EXPORT void GetDist(const Standard_Integer IC, Standard_Real& Dis) const; + Standard_EXPORT void GetDist(const int IC, double& Dis) const; //! Adds edge E to the table of edges used by this //! algorithm to build chamfers, where @@ -96,10 +98,10 @@ public: //! series of faces being located on either side of the contour. //! Warning //! Nothing is done if edge E or the face F does not belong to the initial shape. - Standard_EXPORT void Add(const Standard_Real Dis1, - const Standard_Real Dis2, - const TopoDS_Edge& E, - const TopoDS_Face& F); + Standard_EXPORT void Add(const double Dis1, + const double Dis2, + const TopoDS_Edge& E, + const TopoDS_Face& F); //! Sets the distances Dis1 and Dis2 which give the //! parameters of the chamfer along the contour of index @@ -109,65 +111,61 @@ public: //! Warning //! Nothing is done if either the edge E or the face F //! does not belong to the initial shape. - Standard_EXPORT void SetDists(const Standard_Real Dis1, - const Standard_Real Dis2, - const Standard_Integer IC, - const TopoDS_Face& F); + Standard_EXPORT void SetDists(const double Dis1, + const double Dis2, + const int IC, + const TopoDS_Face& F); //! Returns the distances Dis1 and Dis2 which give the //! parameters of the chamfer along the contour of index IC //! in the internal data structure of this algorithm. //! Warning //! -1. is returned if IC is outside the bounds of the table of contours. - Standard_EXPORT void Dists(const Standard_Integer IC, - Standard_Real& Dis1, - Standard_Real& Dis2) const; + Standard_EXPORT void Dists(const int IC, double& Dis1, double& Dis2) const; - //! Adds a fillet contour in the builder (builds a - //! contour of tangent edges to and sets the + //! Adds a fillet contour in the builder (builds a + //! contour of tangent edges to and sets the //! distance and angle ( parameters of the chamfer ) ). - Standard_EXPORT void AddDA(const Standard_Real Dis, - const Standard_Real Angle, - const TopoDS_Edge& E, - const TopoDS_Face& F); + Standard_EXPORT void AddDA(const double Dis, + const double Angle, + const TopoDS_Edge& E, + const TopoDS_Face& F); //! set the distance and of the fillet //! contour of index in the DS with on . //! if the face is not one of common faces //! of an edge of the contour - Standard_EXPORT void SetDistAngle(const Standard_Real Dis, - const Standard_Real Angle, - const Standard_Integer IC, - const TopoDS_Face& F); + Standard_EXPORT void SetDistAngle(const double Dis, + const double Angle, + const int IC, + const TopoDS_Face& F); //! gives the distances and of the fillet //! contour of index in the DS - Standard_EXPORT void GetDistAngle(const Standard_Integer IC, - Standard_Real& Dis, - Standard_Real& Angle) const; + Standard_EXPORT void GetDistAngle(const int IC, double& Dis, double& Angle) const; //! Sets the mode of chamfer Standard_EXPORT void SetMode(const ChFiDS_ChamfMode theMode); //! return True if chamfer symmetric false else. - Standard_EXPORT Standard_Boolean IsSymetric(const Standard_Integer IC) const; + Standard_EXPORT bool IsSymetric(const int IC) const; //! return True if chamfer is made with two distances false else. - Standard_EXPORT Standard_Boolean IsTwoDistances(const Standard_Integer IC) const; + Standard_EXPORT bool IsTwoDistances(const int IC) const; //! return True if chamfer is made with distance and angle false else. - Standard_EXPORT Standard_Boolean IsDistanceAngle(const Standard_Integer IC) const; + Standard_EXPORT bool IsDistanceAngle(const int IC) const; //! Erases the chamfer parameters on the contour of //! index IC in the internal data structure of this algorithm. //! Use the SetDists function to reset this data. //! Warning //! Nothing is done if IC is outside the bounds of the table of contours. - Standard_EXPORT void ResetContour(const Standard_Integer IC) Standard_OVERRIDE; + Standard_EXPORT void ResetContour(const int IC) override; //! Returns the number of contours generated using the //! Add function in the internal data structure of this algorithm. - Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE; + Standard_EXPORT int NbContours() const override; //! Returns the index of the contour in the internal data //! structure of this algorithm, which contains the edge E of the shape. @@ -175,13 +173,13 @@ public: //! Warning //! This index can change if a contour is removed from the //! internal data structure of this algorithm using the function Remove. - Standard_EXPORT Standard_Integer Contour(const TopoDS_Edge& E) const Standard_OVERRIDE; + Standard_EXPORT int Contour(const TopoDS_Edge& E) const override; //! Returns the number of edges in the contour of index I in //! the internal data structure of this algorithm. //! Warning //! Returns 0 if I is outside the bounds of the table of contours. - Standard_EXPORT Standard_Integer NbEdges(const Standard_Integer I) const Standard_OVERRIDE; + Standard_EXPORT int NbEdges(const int I) const override; //! Returns the edge of index J in the contour of index I in //! the internal data structure of this algorithm. @@ -189,33 +187,32 @@ public: //! Returns a null shape if: //! - I is outside the bounds of the table of contours, or //! - J is outside the bounds of the table of edges of the contour of index I. - Standard_EXPORT const TopoDS_Edge& Edge(const Standard_Integer I, - const Standard_Integer J) const Standard_OVERRIDE; + Standard_EXPORT const TopoDS_Edge& Edge(const int I, const int J) const override; //! Removes the contour in the internal data structure of //! this algorithm which contains the edge E of the shape. //! Warning //! Nothing is done if the edge E does not belong to the //! contour in the internal data structure of this algorithm. - Standard_EXPORT void Remove(const TopoDS_Edge& E) Standard_OVERRIDE; + Standard_EXPORT void Remove(const TopoDS_Edge& E) override; //! Returns the length of the contour of index IC in the //! internal data structure of this algorithm. //! Warning //! Returns -1. if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Real Length(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT double Length(const int IC) const override; //! Returns the first vertex of the contour of index IC //! in the internal data structure of this algorithm. //! Warning //! Returns a null shape if IC is outside the bounds of the table of contours. - Standard_EXPORT TopoDS_Vertex FirstVertex(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex FirstVertex(const int IC) const override; //! Returns the last vertex of the contour of index IC //! in the internal data structure of this algorithm. //! Warning //! Returns a null shape if IC is outside the bounds of the table of contours. - Standard_EXPORT TopoDS_Vertex LastVertex(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex LastVertex(const int IC) const override; //! Returns the curvilinear abscissa of the vertex V on the //! contour of index IC in the internal data structure of this algorithm. @@ -223,8 +220,7 @@ public: //! Returns -1. if: //! - IC is outside the bounds of the table of contours, or //! - V is not on the contour of index IC. - Standard_EXPORT Standard_Real Abscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const Standard_OVERRIDE; + Standard_EXPORT double Abscissa(const int IC, const TopoDS_Vertex& V) const override; //! Returns the relative curvilinear abscissa (i.e. between 0 //! and 1) of the vertex V on the contour of index IC in the @@ -233,21 +229,19 @@ public: //! Returns -1. if: //! - IC is outside the bounds of the table of contours, or //! - V is not on the contour of index IC. - Standard_EXPORT Standard_Real RelativeAbscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const Standard_OVERRIDE; + Standard_EXPORT double RelativeAbscissa(const int IC, const TopoDS_Vertex& V) const override; //! eturns true if the contour of index IC in the internal //! data structure of this algorithm is closed and tangential at the point of closure. //! Warning //! Returns false if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Boolean - ClosedAndTangent(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT bool ClosedAndTangent(const int IC) const override; //! Returns true if the contour of index IC in the internal //! data structure of this algorithm is closed. //! Warning //! Returns false if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Boolean Closed(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT bool Closed(const int IC) const override; //! Builds the chamfers on all the contours in the internal //! data structure of this algorithm and constructs the resulting shape. @@ -267,40 +261,39 @@ public: //! intersection of 4 or more edges of the shape, or //! - the intersection of the chamfer with a face which //! limits the contour is not fully contained in this face. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Reinitializes this algorithm, thus canceling the effects of the Build function. //! This function allows modifications to be made to the //! contours and chamfer parameters in order to rebuild the shape. - Standard_EXPORT void Reset() Standard_OVERRIDE; + Standard_EXPORT void Reset() override; //! Returns the internal filleting algorithm. - Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const; + Standard_EXPORT occ::handle Builder() const; - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& EorV) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Generated( + const TopoDS_Shape& EorV) override; - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& F) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& F) override; - Standard_EXPORT void Simulate(const Standard_Integer IC) Standard_OVERRIDE; + Standard_EXPORT void Simulate(const int IC) override; - Standard_EXPORT Standard_Integer NbSurf(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT int NbSurf(const int IC) const override; - Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect(const Standard_Integer IC, - const Standard_Integer IS) const Standard_OVERRIDE; + Standard_EXPORT occ::handle> Sect( + const int IC, + const int IS) const override; -protected: private: - ChFi3d_ChBuilder myBuilder; - TopTools_MapOfShape myMap; + ChFi3d_ChBuilder myBuilder; + NCollection_Map myMap; }; #endif // _BRepFilletAPI_MakeChamfer_HeaderFile diff --git a/opencascade/BRepFilletAPI_MakeFillet.hxx b/opencascade/BRepFilletAPI_MakeFillet.hxx index 20239473f..c44880d8b 100644 --- a/opencascade/BRepFilletAPI_MakeFillet.hxx +++ b/opencascade/BRepFilletAPI_MakeFillet.hxx @@ -22,15 +22,19 @@ #include #include -#include +#include +#include +#include #include #include #include #include -#include +#include +#include #include -#include -#include +#include +#include +#include #include class TopoDS_Shape; class TopoDS_Edge; @@ -50,89 +54,82 @@ class BRepFilletAPI_MakeFillet : public BRepFilletAPI_LocalOperation public: DEFINE_STANDARD_ALLOC - //! Initializes the computation of the fillets. - //! sets the type of fillet surface. The - //! default value is ChFi3d_Rational (classical nurbs - //! representation of circles). ChFi3d_QuasiAngular - //! corresponds to a nurbs representation of circles - //! which parameterisation matches the circle one. - //! ChFi3d_Polynomial corresponds to a polynomial + //! Initializes the computation of the fillets. + //! sets the type of fillet surface. The + //! default value is ChFi3d_Rational (classical nurbs + //! representation of circles). ChFi3d_QuasiAngular + //! corresponds to a nurbs representation of circles + //! which parameterisation matches the circle one. + //! ChFi3d_Polynomial corresponds to a polynomial //! representation of circles. Standard_EXPORT BRepFilletAPI_MakeFillet(const TopoDS_Shape& S, const ChFi3d_FilletShape FShape = ChFi3d_Rational); - Standard_EXPORT void SetParams(const Standard_Real Tang, - const Standard_Real Tesp, - const Standard_Real T2d, - const Standard_Real TApp3d, - const Standard_Real TolApp2d, - const Standard_Real Fleche); + Standard_EXPORT void SetParams(const double Tang, + const double Tesp, + const double T2d, + const double TApp3d, + const double TolApp2d, + const double Fleche); - //! Changes the parameters of continiuity + //! Changes the parameters of continiuity //! InternalContinuity to produce fillet'surfaces with - //! an continuity Ci (i=0,1 or 2). + //! an continuity Ci (i=0,1 or 2). //! By defaultInternalContinuity = GeomAbs_C1. - //! AngularTolerance is the G1 tolerance between fillet + //! AngularTolerance is the G1 tolerance between fillet //! and support'faces. Standard_EXPORT void SetContinuity(const GeomAbs_Shape InternalContinuity, - const Standard_Real AngularTolerance); + const double AngularTolerance); - //! Adds a fillet contour in the builder (builds a - //! contour of tangent edges). + //! Adds a fillet contour in the builder (builds a + //! contour of tangent edges). //! The Radius must be set after. - Standard_EXPORT void Add(const TopoDS_Edge& E) Standard_OVERRIDE; + Standard_EXPORT void Add(const TopoDS_Edge& E) override; - //! Adds a fillet description in the builder - //! - builds a contour of tangent edges, + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, //! - sets the radius. - Standard_EXPORT void Add(const Standard_Real Radius, const TopoDS_Edge& E); + Standard_EXPORT void Add(const double Radius, const TopoDS_Edge& E); - //! Adds a fillet description in the builder - //! - builds a contour of tangent edges, + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, //! - sets a linear radius evolution law between //! the first and last vertex of the spine. - Standard_EXPORT void Add(const Standard_Real R1, const Standard_Real R2, const TopoDS_Edge& E); + Standard_EXPORT void Add(const double R1, const double R2, const TopoDS_Edge& E); - //! Adds a fillet description in the builder - //! - builds a contour of tangent edges, + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, //! - sest the radius evolution law. - Standard_EXPORT void Add(const Handle(Law_Function)& L, const TopoDS_Edge& E); + Standard_EXPORT void Add(const occ::handle& L, const TopoDS_Edge& E); - //! Adds a fillet description in the builder - //! - builds a contour of tangent edges, + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, //! - sets the radius evolution law interpolating the values //! given in the array UandR : //! //! p2d.X() = relative parameter on the spine [0,1] //! p2d.Y() = value of the radius. - Standard_EXPORT void Add(const TColgp_Array1OfPnt2d& UandR, const TopoDS_Edge& E); + Standard_EXPORT void Add(const NCollection_Array1& UandR, const TopoDS_Edge& E); //! Sets the parameters of the fillet //! along the contour of index IC generated using the Add function //! in the internal data structure of //! this algorithm, where Radius is the radius of the fillet. - Standard_EXPORT void SetRadius(const Standard_Real Radius, - const Standard_Integer IC, - const Standard_Integer IinC); + Standard_EXPORT void SetRadius(const double Radius, const int IC, const int IinC); //! Sets the parameters of the fillet //! along the contour of index IC generated using the Add function //! in the internal data structure of this algorithm, where the radius of the //! fillet evolves according to a linear evolution law defined //! from R1 to R2, between the first and last vertices of the contour of index IC. - Standard_EXPORT void SetRadius(const Standard_Real R1, - const Standard_Real R2, - const Standard_Integer IC, - const Standard_Integer IinC); + Standard_EXPORT void SetRadius(const double R1, const double R2, const int IC, const int IinC); //! Sets the parameters of the fillet //! along the contour of index IC generated using the Add function //! in the internal data structure of this algorithm, where the radius of the //! fillet evolves according to the evolution law L, between the //! first and last vertices of the contour of index IC. - Standard_EXPORT void SetRadius(const Handle(Law_Function)& L, - const Standard_Integer IC, - const Standard_Integer IinC); + Standard_EXPORT void SetRadius(const occ::handle& L, const int IC, const int IinC); //! Sets the parameters of the fillet //! along the contour of index IC generated using the Add function @@ -142,26 +139,26 @@ public: //! in the array UandR as follows: //! - the X coordinate of a point in UandR defines a //! relative parameter on the contour (i.e. a parameter between 0 and 1), - //! - the Y coordinate of a point in UandR gives the + //! - the Y coordinate of a point in UandR gives the //! corresponding value of the radius, and the radius evolves //! between the first and last vertices of the contour of index IC. - Standard_EXPORT void SetRadius(const TColgp_Array1OfPnt2d& UandR, - const Standard_Integer IC, - const Standard_Integer IinC); + Standard_EXPORT void SetRadius(const NCollection_Array1& UandR, + const int IC, + const int IinC); //! Erases the radius information on the contour of index //! IC in the internal data structure of this algorithm. //! Use the SetRadius function to reset this data. //! Warning //! Nothing is done if IC is outside the bounds of the table of contours. - Standard_EXPORT void ResetContour(const Standard_Integer IC) Standard_OVERRIDE; + Standard_EXPORT void ResetContour(const int IC) override; //! Returns true if the radius of the fillet along the contour of index IC //! in the internal data structure of this algorithm is constant, //! Warning //! False is returned if IC is outside the bounds of the table //! of contours or if E does not belong to the contour of index IC. - Standard_EXPORT Standard_Boolean IsConstant(const Standard_Integer IC); + Standard_EXPORT bool IsConstant(const int IC); //! Returns the radius of the fillet along the contour of index IC in the //! internal data structure of this algorithm @@ -169,7 +166,7 @@ public: //! - Use this function only if the radius is constant. //! - -1. is returned if IC is outside the bounds of the //! table of contours or if E does not belong to the contour of index IC. - Standard_EXPORT Standard_Real Radius(const Standard_Integer IC); + Standard_EXPORT double Radius(const int IC); //! Returns true if the radius of the fillet along the edge E of the //! contour of index IC in the internal data structure of @@ -177,7 +174,7 @@ public: //! Warning //! False is returned if IC is outside the bounds of the table //! of contours or if E does not belong to the contour of index IC. - Standard_EXPORT Standard_Boolean IsConstant(const Standard_Integer IC, const TopoDS_Edge& E); + Standard_EXPORT bool IsConstant(const int IC, const TopoDS_Edge& E); //! Returns the radius of the fillet along the edge E of the contour of index //! IC in the internal data structure of this algorithm. @@ -185,27 +182,20 @@ public: //! - Use this function only if the radius is constant. //! - -1 is returned if IC is outside the bounds of the //! table of contours or if E does not belong to the contour of index IC. - Standard_EXPORT Standard_Real Radius(const Standard_Integer IC, const TopoDS_Edge& E); + Standard_EXPORT double Radius(const int IC, const TopoDS_Edge& E); //! Assigns Radius as the radius of the fillet on the edge E - Standard_EXPORT void SetRadius(const Standard_Real Radius, - const Standard_Integer IC, - const TopoDS_Edge& E); + Standard_EXPORT void SetRadius(const double Radius, const int IC, const TopoDS_Edge& E); - Standard_EXPORT void SetRadius(const Standard_Real Radius, - const Standard_Integer IC, - const TopoDS_Vertex& V); + Standard_EXPORT void SetRadius(const double Radius, const int IC, const TopoDS_Vertex& V); - Standard_EXPORT Standard_Boolean GetBounds(const Standard_Integer IC, - const TopoDS_Edge& E, - Standard_Real& F, - Standard_Real& L); + Standard_EXPORT bool GetBounds(const int IC, const TopoDS_Edge& E, double& F, double& L); - Standard_EXPORT Handle(Law_Function) GetLaw(const Standard_Integer IC, const TopoDS_Edge& E); + Standard_EXPORT occ::handle GetLaw(const int IC, const TopoDS_Edge& E); - Standard_EXPORT void SetLaw(const Standard_Integer IC, - const TopoDS_Edge& E, - const Handle(Law_Function)& L); + Standard_EXPORT void SetLaw(const int IC, + const TopoDS_Edge& E, + const occ::handle& L); //! Assigns FShape as the type of fillet shape built by this algorithm. Standard_EXPORT void SetFilletShape(const ChFi3d_FilletShape FShape); @@ -215,7 +205,7 @@ public: //! Returns the number of contours generated using the //! Add function in the internal data structure of this algorithm. - Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE; + Standard_EXPORT int NbContours() const override; //! Returns the index of the contour in the internal data //! structure of this algorithm which contains the edge E of the shape. @@ -223,13 +213,13 @@ public: //! Warning //! This index can change if a contour is removed from the //! internal data structure of this algorithm using the function Remove. - Standard_EXPORT Standard_Integer Contour(const TopoDS_Edge& E) const Standard_OVERRIDE; + Standard_EXPORT int Contour(const TopoDS_Edge& E) const override; //! Returns the number of edges in the contour of index I in //! the internal data structure of this algorithm. //! Warning //! Returns 0 if I is outside the bounds of the table of contours. - Standard_EXPORT Standard_Integer NbEdges(const Standard_Integer I) const Standard_OVERRIDE; + Standard_EXPORT int NbEdges(const int I) const override; //! Returns the edge of index J in the contour of index I in //! the internal data structure of this algorithm. @@ -237,33 +227,32 @@ public: //! Returns a null shape if: //! - I is outside the bounds of the table of contours, or //! - J is outside the bounds of the table of edges of the index I contour. - Standard_EXPORT const TopoDS_Edge& Edge(const Standard_Integer I, - const Standard_Integer J) const Standard_OVERRIDE; + Standard_EXPORT const TopoDS_Edge& Edge(const int I, const int J) const override; //! Removes the contour in the internal data structure of //! this algorithm which contains the edge E of the shape. //! Warning //! Nothing is done if the edge E does not belong to the //! contour in the internal data structure of this algorithm. - Standard_EXPORT void Remove(const TopoDS_Edge& E) Standard_OVERRIDE; + Standard_EXPORT void Remove(const TopoDS_Edge& E) override; //! Returns the length of the contour of index IC in the //! internal data structure of this algorithm. //! Warning //! Returns -1. if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Real Length(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT double Length(const int IC) const override; //! Returns the first vertex of the contour of index IC //! in the internal data structure of this algorithm. //! Warning //! Returns a null shape if IC is outside the bounds of the table of contours. - Standard_EXPORT TopoDS_Vertex FirstVertex(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex FirstVertex(const int IC) const override; - //! Returns the last vertex of the contour of index IC + //! Returns the last vertex of the contour of index IC //! in the internal data structure of this algorithm. //! Warning //! Returns a null shape if IC is outside the bounds of the table of contours. - Standard_EXPORT TopoDS_Vertex LastVertex(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT TopoDS_Vertex LastVertex(const int IC) const override; //! Returns the curvilinear abscissa of the vertex V on the //! contour of index IC in the internal data structure of this algorithm. @@ -271,8 +260,7 @@ public: //! Returns -1. if: //! - IC is outside the bounds of the table of contours, or //! - V is not on the contour of index IC. - Standard_EXPORT Standard_Real Abscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const Standard_OVERRIDE; + Standard_EXPORT double Abscissa(const int IC, const TopoDS_Vertex& V) const override; //! Returns the relative curvilinear abscissa (i.e. between 0 //! and 1) of the vertex V on the contour of index IC in the @@ -281,22 +269,20 @@ public: //! Returns -1. if: //! - IC is outside the bounds of the table of contours, or //! - V is not on the contour of index IC. - Standard_EXPORT Standard_Real RelativeAbscissa(const Standard_Integer IC, - const TopoDS_Vertex& V) const Standard_OVERRIDE; + Standard_EXPORT double RelativeAbscissa(const int IC, const TopoDS_Vertex& V) const override; //! Returns true if the contour of index IC in the internal //! data structure of this algorithm is closed and tangential //! at the point of closure. //! Warning //! Returns false if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Boolean - ClosedAndTangent(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT bool ClosedAndTangent(const int IC) const override; //! Returns true if the contour of index IC in the internal //! data structure of this algorithm is closed. //! Warning //! Returns false if IC is outside the bounds of the table of contours. - Standard_EXPORT Standard_Boolean Closed(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT bool Closed(const int IC) const override; //! Builds the fillets on all the contours in the internal data //! structure of this algorithm and constructs the resulting shape. @@ -316,70 +302,69 @@ public: //! intersection of 4 or more edges of the shape, or //! - the intersection of the fillet with a face which limits //! the contour is not fully contained in this face. - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; //! Reinitializes this algorithm, thus canceling the effects of the Build function. //! This function allows modifications to be made to the //! contours and fillet parameters in order to rebuild the shape. - Standard_EXPORT void Reset() Standard_OVERRIDE; + Standard_EXPORT void Reset() override; //! Returns the internal topology building algorithm. - Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const; + Standard_EXPORT occ::handle Builder() const; - //! Returns the list of shapes generated from the + //! Returns the list of shapes generated from the //! shape . - Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& EorV) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Generated( + const TopoDS_Shape& EorV) override; - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& F) override; - Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& F) Standard_OVERRIDE; + Standard_EXPORT bool IsDeleted(const TopoDS_Shape& F) override; //! returns the number of surfaces //! after the shape creation. - Standard_EXPORT Standard_Integer NbSurfaces() const; + Standard_EXPORT int NbSurfaces() const; //! Return the faces created for surface . - Standard_EXPORT const TopTools_ListOfShape& NewFaces(const Standard_Integer I); + Standard_EXPORT const NCollection_List& NewFaces(const int I); - Standard_EXPORT void Simulate(const Standard_Integer IC) Standard_OVERRIDE; + Standard_EXPORT void Simulate(const int IC) override; - Standard_EXPORT Standard_Integer NbSurf(const Standard_Integer IC) const Standard_OVERRIDE; + Standard_EXPORT int NbSurf(const int IC) const override; - Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect(const Standard_Integer IC, - const Standard_Integer IS) const Standard_OVERRIDE; + Standard_EXPORT occ::handle> Sect( + const int IC, + const int IS) const override; //! Returns the number of contours where the computation //! of the fillet failed - Standard_EXPORT Standard_Integer NbFaultyContours() const; + Standard_EXPORT int NbFaultyContours() const; //! for each I in [1.. NbFaultyContours] returns the index IC of //! the contour where the computation of the fillet failed. //! the method NbEdges(IC) gives the number of edges in the contour IC //! the method Edge(IC,ie) gives the edge number ie of the contour IC - Standard_EXPORT Standard_Integer FaultyContour(const Standard_Integer I) const; + Standard_EXPORT int FaultyContour(const int I) const; //! returns the number of surfaces which have been //! computed on the contour IC - Standard_EXPORT Standard_Integer NbComputedSurfaces(const Standard_Integer IC) const; + Standard_EXPORT int NbComputedSurfaces(const int IC) const; //! returns the surface number IS concerning the contour IC - Standard_EXPORT Handle(Geom_Surface) ComputedSurface(const Standard_Integer IC, - const Standard_Integer IS) const; + Standard_EXPORT occ::handle ComputedSurface(const int IC, const int IS) const; //! returns the number of vertices where the computation failed - Standard_EXPORT Standard_Integer NbFaultyVertices() const; + Standard_EXPORT int NbFaultyVertices() const; //! returns the vertex where the computation failed - Standard_EXPORT TopoDS_Vertex FaultyVertex(const Standard_Integer IV) const; + Standard_EXPORT TopoDS_Vertex FaultyVertex(const int IV) const; //! returns true if a part of the result has been computed //! if the filling in a corner failed a shape with a hole is returned - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_EXPORT bool HasResult() const; //! if (HasResult()) returns the partial result Standard_EXPORT TopoDS_Shape BadShape() const; @@ -391,13 +376,12 @@ public: //! ChFiDS_TwistedSurface : the computation failed because of a twisted //! surface //! ChFiDS_WalkingFailure : there is a problem in the walking - //! ChFiDS_Error: other error different from above - Standard_EXPORT ChFiDS_ErrorStatus StripeStatus(const Standard_Integer IC) const; + //! ChFiDS_Error: other error different from above + Standard_EXPORT ChFiDS_ErrorStatus StripeStatus(const int IC) const; -protected: private: - ChFi3d_FilBuilder myBuilder; - TopTools_MapOfShape myMap; + ChFi3d_FilBuilder myBuilder; + NCollection_Map myMap; }; #endif // _BRepFilletAPI_MakeFillet_HeaderFile diff --git a/opencascade/BRepFilletAPI_MakeFillet2d.hxx b/opencascade/BRepFilletAPI_MakeFillet2d.hxx index 132cfbf94..41a783a5c 100644 --- a/opencascade/BRepFilletAPI_MakeFillet2d.hxx +++ b/opencascade/BRepFilletAPI_MakeFillet2d.hxx @@ -23,8 +23,9 @@ #include #include -#include -#include +#include +#include +#include #include class TopoDS_Face; class TopoDS_Edge; @@ -89,7 +90,7 @@ public: //! This initialize method allow to init the builder //! from a face RefFace and another face ModFace which derive from RefFace. - //! This is useful to modify a fillet or a chamfer already created on ModFace. + //! This is useful to modify a fillet or a chamfer already created on ModFace. Standard_EXPORT void Init(const TopoDS_Face& RefFace, const TopoDS_Face& ModFace); //! Adds a fillet of radius Radius between the two edges @@ -110,7 +111,7 @@ public: //! Do not use the returned fillet if the status of the construction is not ChFi2d_IsDone. //! Exceptions //! Standard_NegativeValue if Radius is less than or equal to zero. - Standard_EXPORT TopoDS_Edge AddFillet(const TopoDS_Vertex& V, const Standard_Real Radius); + Standard_EXPORT TopoDS_Edge AddFillet(const TopoDS_Vertex& V, const double Radius); //! Assigns the radius Radius to the fillet Fillet already //! built on the face modified by this algorithm. @@ -127,7 +128,7 @@ public: //! construction is not ChFi2d_IsDone. //! Exceptions //! Standard_NegativeValue if Radius is less than or equal to zero. - Standard_EXPORT TopoDS_Edge ModifyFillet(const TopoDS_Edge& Fillet, const Standard_Real Radius); + Standard_EXPORT TopoDS_Edge ModifyFillet(const TopoDS_Edge& Fillet, const double Radius); //! Removes the fillet Fillet already built on the face //! modified by this algorithm. @@ -150,10 +151,10 @@ public: //! tangent at the corresponding point. //! The angle Ang is given in radians. //! This function returns the chamfer and builds the resulting face. - Standard_EXPORT TopoDS_Edge AddChamfer(const TopoDS_Edge& E1, - const TopoDS_Edge& E2, - const Standard_Real D1, - const Standard_Real D2); + Standard_EXPORT TopoDS_Edge AddChamfer(const TopoDS_Edge& E1, + const TopoDS_Edge& E2, + const double D1, + const double D2); //! Adds a chamfer on the face modified by this algorithm //! between the two edges connected by the vertex V, @@ -184,19 +185,19 @@ public: //! the status of the construction is not ChFi2d_IsDone. Standard_EXPORT TopoDS_Edge AddChamfer(const TopoDS_Edge& E, const TopoDS_Vertex& V, - const Standard_Real D, - const Standard_Real Ang); + const double D, + const double Ang); //! Modifies the chamfer Chamfer on the face modified //! by this algorithm, where: //! E1 and E2 are the two adjacent edges on which //! Chamfer is already built; the extremities of the new //! chamfer are on E1 and E2 at distances D1 and D2 respectively. - Standard_EXPORT TopoDS_Edge ModifyChamfer(const TopoDS_Edge& Chamfer, - const TopoDS_Edge& E1, - const TopoDS_Edge& E2, - const Standard_Real D1, - const Standard_Real D2); + Standard_EXPORT TopoDS_Edge ModifyChamfer(const TopoDS_Edge& Chamfer, + const TopoDS_Edge& E1, + const TopoDS_Edge& E2, + const double D1, + const double D2); //! Modifies the chamfer Chamfer on the face modified //! by this algorithm, where: @@ -225,10 +226,10 @@ public: //! - ChFi2d_NotAuthorized if E1 or E2 is a fillet or chamfer. //! Do not use the returned chamfer if the status of the //! construction is not ChFi2d_IsDone. - Standard_EXPORT TopoDS_Edge ModifyChamfer(const TopoDS_Edge& Chamfer, - const TopoDS_Edge& E, - const Standard_Real D, - const Standard_Real Ang); + Standard_EXPORT TopoDS_Edge ModifyChamfer(const TopoDS_Edge& Chamfer, + const TopoDS_Edge& E, + const double D, + const double Ang); //! Removes the chamfer Chamfer already built on the face //! modified by this algorithm. @@ -245,33 +246,32 @@ public: //! algorithm is chamfered or filleted. //! Warning //! Returns false if E does not belong to the face modified by this algorithm. - Standard_Boolean IsModified(const TopoDS_Edge& E) const; + bool IsModified(const TopoDS_Edge& E) const; //! Returns the table of fillets on the face modified by this algorithm. - const TopTools_SequenceOfShape& FilletEdges() const; + const NCollection_Sequence& FilletEdges() const; //! Returns the number of fillets on the face modified by this algorithm. - Standard_Integer NbFillet() const; + int NbFillet() const; //! Returns the table of chamfers on the face modified by this algorithm. - const TopTools_SequenceOfShape& ChamferEdges() const; + const NCollection_Sequence& ChamferEdges() const; //! Returns the number of chamfers on the face modified by this algorithm. - Standard_Integer NbChamfer() const; + int NbChamfer() const; - //! Returns the list of shapes modified from the shape + //! Returns the list of shapes modified from the shape //! . - Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) - Standard_OVERRIDE; + Standard_EXPORT const NCollection_List& Modified(const TopoDS_Shape& S) override; //! returns the number of new curves //! after the shape creation. - Standard_EXPORT Standard_Integer NbCurves() const; + Standard_EXPORT int NbCurves() const; //! Return the Edges created for curve I. - Standard_EXPORT const TopTools_ListOfShape& NewEdges(const Standard_Integer I); + Standard_EXPORT const NCollection_List& NewEdges(const int I); - Standard_Boolean HasDescendant(const TopoDS_Edge& E) const; + bool HasDescendant(const TopoDS_Edge& E) const; //! Returns the chamfered or filleted edge built from the //! edge E on the face modified by this algorithm. If E has @@ -291,10 +291,9 @@ public: ChFi2d_ConstructionError Status() const; //! Update the result and set the Done flag - Standard_EXPORT virtual void Build( - const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) override; -protected: private: ChFi2d_Builder myMakeChFi2d; }; diff --git a/opencascade/BRepFilletAPI_MakeFillet2d.lxx b/opencascade/BRepFilletAPI_MakeFillet2d.lxx index 9edee307b..47843702b 100644 --- a/opencascade/BRepFilletAPI_MakeFillet2d.lxx +++ b/opencascade/BRepFilletAPI_MakeFillet2d.lxx @@ -14,80 +14,56 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : IsModified -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepFilletAPI_MakeFillet2d::IsModified(const TopoDS_Edge& E) const +inline bool BRepFilletAPI_MakeFillet2d::IsModified(const TopoDS_Edge& E) const { return myMakeChFi2d.IsModified(E); } -//======================================================================= -// function : FilletEdges -// purpose : -//======================================================================= +//================================================================================================= -inline const TopTools_SequenceOfShape& BRepFilletAPI_MakeFillet2d::FilletEdges() const +inline const NCollection_Sequence& BRepFilletAPI_MakeFillet2d::FilletEdges() const { return myMakeChFi2d.FilletEdges(); } -//======================================================================= -// function : NbFillet -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Integer BRepFilletAPI_MakeFillet2d::NbFillet() const +inline int BRepFilletAPI_MakeFillet2d::NbFillet() const { return myMakeChFi2d.NbFillet(); } -//======================================================================= -// function : ChamferEdges -// purpose : -//======================================================================= +//================================================================================================= -inline const TopTools_SequenceOfShape& BRepFilletAPI_MakeFillet2d::ChamferEdges() const +inline const NCollection_Sequence& BRepFilletAPI_MakeFillet2d::ChamferEdges() const { return myMakeChFi2d.ChamferEdges(); } -//======================================================================= -// function : NbChamfer -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Integer BRepFilletAPI_MakeFillet2d::NbChamfer() const +inline int BRepFilletAPI_MakeFillet2d::NbChamfer() const { return myMakeChFi2d.NbChamfer(); } -//======================================================================= -// function : HasDescendant -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Boolean BRepFilletAPI_MakeFillet2d::HasDescendant(const TopoDS_Edge& E) const +inline bool BRepFilletAPI_MakeFillet2d::HasDescendant(const TopoDS_Edge& E) const { return myMakeChFi2d.HasDescendant(E); } -//======================================================================= -// function : DescendantEdge -// purpose : -//======================================================================= +//================================================================================================= inline const TopoDS_Edge& BRepFilletAPI_MakeFillet2d::DescendantEdge(const TopoDS_Edge& E) const { return myMakeChFi2d.DescendantEdge(E); } -//======================================================================= -// function : Status -// purpose : -//======================================================================= +//================================================================================================= inline ChFi2d_ConstructionError BRepFilletAPI_MakeFillet2d::Status() const { diff --git a/opencascade/BRepGProp.hxx b/opencascade/BRepGProp.hxx index 28b78d347..67d2765e9 100644 --- a/opencascade/BRepGProp.hxx +++ b/opencascade/BRepGProp.hxx @@ -22,7 +22,8 @@ #include #include -#include +#include +#include class TopoDS_Shape; class GProp_GProps; @@ -81,14 +82,13 @@ public: //! If we have cube with sizes 1, 1, 1, its linear properties = 12 //! for SkipEdges = true and 24 for SkipEdges = false. //! UseTriangulation is a special flag, which defines preferable - //! source of geometry data. If UseTriangulation = Standard_False, + //! source of geometry data. If UseTriangulation = false, //! exact geometry objects (curves) are used, otherwise polygons of //! triangulation are used first. - Standard_EXPORT static void LinearProperties( - const TopoDS_Shape& S, - GProp_GProps& LProps, - const Standard_Boolean SkipShared = Standard_False, - const Standard_Boolean UseTriangulation = Standard_False); + Standard_EXPORT static void LinearProperties(const TopoDS_Shape& S, + GProp_GProps& LProps, + const bool SkipShared = false, + const bool UseTriangulation = false); //! Computes the surface global properties of the //! shape S, i.e. the global properties induced by each @@ -127,20 +127,19 @@ public: //! For ex., if SkipShared = True, faces, shared by two or more shells, //! are taken into calculation only once. //! UseTriangulation is a special flag, which defines preferable - //! source of geometry data. If UseTriangulation = Standard_False, + //! source of geometry data. If UseTriangulation = false, //! exact geometry objects (surfaces) are used, //! otherwise face triangulations are used first. - Standard_EXPORT static void SurfaceProperties( - const TopoDS_Shape& S, - GProp_GProps& SProps, - const Standard_Boolean SkipShared = Standard_False, - const Standard_Boolean UseTriangulation = Standard_False); + Standard_EXPORT static void SurfaceProperties(const TopoDS_Shape& S, + GProp_GProps& SProps, + const bool SkipShared = false, + const bool UseTriangulation = false); //! Updates with the shape , that contains its principal properties. //! The surface properties of all the faces in are computed. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (area) for each face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! Method returns estimation of relative error reached for whole shape. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. @@ -148,11 +147,10 @@ public: //! shared topological entities or not //! For ex., if SkipShared = True, faces, shared by two or more shells, //! are taken into calculation only once. - Standard_EXPORT static Standard_Real SurfaceProperties( - const TopoDS_Shape& S, - GProp_GProps& SProps, - const Standard_Real Eps, - const Standard_Boolean SkipShared = Standard_False); + Standard_EXPORT static double SurfaceProperties(const TopoDS_Shape& S, + GProp_GProps& SProps, + const double Eps, + const bool SkipShared = false); //! //! Computes the global volume properties of the solid //! S, and brings them together with the global @@ -192,22 +190,21 @@ public: //! (the same TShape, location and orientation) faces are taken //! into calculation only once. //! UseTriangulation is a special flag, which defines preferable - //! source of geometry data. If UseTriangulation = Standard_False, + //! source of geometry data. If UseTriangulation = false, //! exact geometry objects (surfaces) are used, //! otherwise face triangulations are used first. - Standard_EXPORT static void VolumeProperties( - const TopoDS_Shape& S, - GProp_GProps& VProps, - const Standard_Boolean OnlyClosed = Standard_False, - const Standard_Boolean SkipShared = Standard_False, - const Standard_Boolean UseTriangulation = Standard_False); + Standard_EXPORT static void VolumeProperties(const TopoDS_Shape& S, + GProp_GProps& VProps, + const bool OnlyClosed = false, + const bool SkipShared = false, + const bool UseTriangulation = false); //! Updates with the shape , that contains its principal properties. //! The volume properties of all the FORWARD and REVERSED faces in are computed. //! If OnlyClosed is True then computed faces must belong to closed Shells. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for each face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! Method returns estimation of relative error reached for whole shape. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. @@ -216,12 +213,11 @@ public: //! For ex., if SkipShared = True, the volumes formed by the equal //! (the same TShape, location and orientation) //! faces are taken into calculation only once. - Standard_EXPORT static Standard_Real VolumeProperties( - const TopoDS_Shape& S, - GProp_GProps& VProps, - const Standard_Real Eps, - const Standard_Boolean OnlyClosed = Standard_False, - const Standard_Boolean SkipShared = Standard_False); + Standard_EXPORT static double VolumeProperties(const TopoDS_Shape& S, + GProp_GProps& VProps, + const double Eps, + const bool OnlyClosed = false, + const bool SkipShared = false); //! Updates with the shape , that contains its principal properties. //! The volume properties of all the FORWARD and REVERSED faces in are computed. @@ -238,26 +234,24 @@ public: //! shared topological entities or not. //! For ex., if SkipShared = True, the volumes formed by the equal //! (the same TShape, location and orientation) faces are taken into calculation only once. - Standard_EXPORT static Standard_Real VolumePropertiesGK( - const TopoDS_Shape& S, - GProp_GProps& VProps, - const Standard_Real Eps = 0.001, - const Standard_Boolean OnlyClosed = Standard_False, - const Standard_Boolean IsUseSpan = Standard_False, - const Standard_Boolean CGFlag = Standard_False, - const Standard_Boolean IFlag = Standard_False, - const Standard_Boolean SkipShared = Standard_False); + Standard_EXPORT static double VolumePropertiesGK(const TopoDS_Shape& S, + GProp_GProps& VProps, + const double Eps = 0.001, + const bool OnlyClosed = false, + const bool IsUseSpan = false, + const bool CGFlag = false, + const bool IFlag = false, + const bool SkipShared = false); - Standard_EXPORT static Standard_Real VolumePropertiesGK( - const TopoDS_Shape& S, - GProp_GProps& VProps, - const gp_Pln& thePln, - const Standard_Real Eps = 0.001, - const Standard_Boolean OnlyClosed = Standard_False, - const Standard_Boolean IsUseSpan = Standard_False, - const Standard_Boolean CGFlag = Standard_False, - const Standard_Boolean IFlag = Standard_False, - const Standard_Boolean SkipShared = Standard_False); + Standard_EXPORT static double VolumePropertiesGK(const TopoDS_Shape& S, + GProp_GProps& VProps, + const gp_Pln& thePln, + const double Eps = 0.001, + const bool OnlyClosed = false, + const bool IsUseSpan = false, + const bool CGFlag = false, + const bool IFlag = false, + const bool SkipShared = false); }; #endif // _BRepGProp_HeaderFile diff --git a/opencascade/BRepGProp_Cinert.hxx b/opencascade/BRepGProp_Cinert.hxx index 08891e0ea..beea4a198 100644 --- a/opencascade/BRepGProp_Cinert.hxx +++ b/opencascade/BRepGProp_Cinert.hxx @@ -24,7 +24,7 @@ class BRepAdaptor_Curve; class gp_Pnt; -//! Computes the global properties of bounded curves +//! Computes the global properties of bounded curves //! in 3D space. The curve must have at least a continuity C1. //! It can be a curve as defined in the template CurveTool from //! package GProp. This template gives the minimum of methods @@ -42,9 +42,6 @@ public: Standard_EXPORT void SetLocation(const gp_Pnt& CLocation); Standard_EXPORT void Perform(const BRepAdaptor_Curve& C); - -protected: -private: }; #endif // _BRepGProp_Cinert_HeaderFile diff --git a/opencascade/BRepGProp_Domain.hxx b/opencascade/BRepGProp_Domain.hxx index cd2d6c9ae..08ffa1342 100644 --- a/opencascade/BRepGProp_Domain.hxx +++ b/opencascade/BRepGProp_Domain.hxx @@ -43,7 +43,7 @@ public: void Init(const TopoDS_Face& F); //! Returns True if there is another arc of curve in the list. - Standard_Boolean More(); + bool More(); //! Initializes the exploration with the face already set. void Init(); @@ -55,7 +55,6 @@ public: //! curve. Standard_EXPORT void Next(); -protected: private: TopExp_Explorer myExplorer; }; diff --git a/opencascade/BRepGProp_Domain.lxx b/opencascade/BRepGProp_Domain.lxx index 19ec83d07..f8c628312 100644 --- a/opencascade/BRepGProp_Domain.lxx +++ b/opencascade/BRepGProp_Domain.lxx @@ -17,12 +17,9 @@ #include #include -//======================================================================= -// function : BRepGProp_Domain -// purpose : Empty constructor. -//======================================================================= +//================================================================================================= -inline BRepGProp_Domain::BRepGProp_Domain() {} +inline BRepGProp_Domain::BRepGProp_Domain() = default; //======================================================================= // function : BRepGProp_Domain @@ -49,7 +46,7 @@ inline void BRepGProp_Domain::Init(const TopoDS_Face& F) // purpose : Returns True if there is another arc of curve in the list. //======================================================================= -inline Standard_Boolean BRepGProp_Domain::More() +inline bool BRepGProp_Domain::More() { return myExplorer.More(); } @@ -64,10 +61,7 @@ inline void BRepGProp_Domain::Init() myExplorer.ReInit(); } -//======================================================================= -// function : Value -// purpose : Returns the current edge. -//======================================================================= +//================================================================================================= inline const TopoDS_Edge& BRepGProp_Domain::Value() { diff --git a/opencascade/BRepGProp_EdgeTool.hxx b/opencascade/BRepGProp_EdgeTool.hxx index 3c87befd9..56ed05fe5 100644 --- a/opencascade/BRepGProp_EdgeTool.hxx +++ b/opencascade/BRepGProp_EdgeTool.hxx @@ -22,12 +22,12 @@ #include #include -#include +#include class BRepAdaptor_Curve; class gp_Pnt; class gp_Vec; -//! Provides the required methods to instantiate +//! Provides the required methods to instantiate //! CGProps from GProp with a Curve from BRepAdaptor. class BRepGProp_EdgeTool { @@ -35,48 +35,41 @@ public: DEFINE_STANDARD_ALLOC //! Returns the parametric value of the start point of - //! the curve. The curve is oriented from the start point + //! the curve. The curve is oriented from the start point //! to the end point. - Standard_EXPORT static Standard_Real FirstParameter(const BRepAdaptor_Curve& C); + Standard_EXPORT static double FirstParameter(const BRepAdaptor_Curve& C); //! Returns the parametric value of the end point of - //! the curve. The curve is oriented from the start point + //! the curve. The curve is oriented from the start point //! to the end point. - Standard_EXPORT static Standard_Real LastParameter(const BRepAdaptor_Curve& C); + Standard_EXPORT static double LastParameter(const BRepAdaptor_Curve& C); //! Returns the number of Gauss points required to do //! the integration with a good accuracy using the - //! Gauss method. For a polynomial curve of degree n + //! Gauss method. For a polynomial curve of degree n //! the maxima of accuracy is obtained with an order //! of integration equal to 2*n-1. - Standard_EXPORT static Standard_Integer IntegrationOrder(const BRepAdaptor_Curve& C); + Standard_EXPORT static int IntegrationOrder(const BRepAdaptor_Curve& C); //! Returns the point of parameter U on the loaded curve. - Standard_EXPORT static gp_Pnt Value(const BRepAdaptor_Curve& C, const Standard_Real U); + Standard_EXPORT static gp_Pnt Value(const BRepAdaptor_Curve& C, const double U); //! Returns the point of parameter U and the first derivative //! at this point. - Standard_EXPORT static void D1(const BRepAdaptor_Curve& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1); + Standard_EXPORT static void D1(const BRepAdaptor_Curve& C, const double U, gp_Pnt& P, gp_Vec& V1); - //! Returns the number of intervals for continuity + //! Returns the number of intervals for continuity //! . May be one if Continuity(me) >= - Standard_EXPORT static Standard_Integer NbIntervals(const BRepAdaptor_Curve& C, - const GeomAbs_Shape S); + Standard_EXPORT static int NbIntervals(const BRepAdaptor_Curve& C, const GeomAbs_Shape S); - //! Stores in the parameters bounding the intervals + //! Stores in the parameters bounding the intervals //! of continuity . //! - //! The array must provide enough room to accommodate + //! The array must provide enough room to accommodate //! for the parameters. i.e. T.Length() > NbIntervals() - Standard_EXPORT static void Intervals(const BRepAdaptor_Curve& C, - TColStd_Array1OfReal& T, - const GeomAbs_Shape S); - -protected: -private: + Standard_EXPORT static void Intervals(const BRepAdaptor_Curve& C, + NCollection_Array1& T, + const GeomAbs_Shape S); }; #endif // _BRepGProp_EdgeTool_HeaderFile diff --git a/opencascade/BRepGProp_Face.hxx b/opencascade/BRepGProp_Face.hxx index 9606179cd..4d955251f 100644 --- a/opencascade/BRepGProp_Face.hxx +++ b/opencascade/BRepGProp_Face.hxx @@ -25,15 +25,18 @@ #include #include #include -#include +#include #include -#include +#include +#include + class TopoDS_Face; class gp_Pnt; class gp_Vec; class TopoDS_Edge; class gp_Pnt2d; class gp_Vec2d; +class Geom_Surface; class BRepGProp_Face { @@ -44,61 +47,55 @@ public: //! that says if it is necessary to define spans on a face. //! This option has an effect only for BSpline faces. Spans //! are returned by the methods GetUKnots and GetTKnots. - BRepGProp_Face(const Standard_Boolean IsUseSpan = Standard_False); + BRepGProp_Face(const bool IsUseSpan = false); //! Constructor. Initializes the object with the face and the //! flag IsUseSpan that says if it is necessary to define //! spans on a face. This option has an effect only for //! BSpline faces. Spans are returned by the methods GetUKnots //! and GetTKnots. - BRepGProp_Face(const TopoDS_Face& F, const Standard_Boolean IsUseSpan = Standard_False); + BRepGProp_Face(const TopoDS_Face& F, const bool IsUseSpan = false); Standard_EXPORT void Load(const TopoDS_Face& F); - Standard_EXPORT Standard_Integer VIntegrationOrder() const; + Standard_EXPORT int VIntegrationOrder() const; - //! Returns Standard_True if the face is not trimmed. - Standard_Boolean NaturalRestriction() const; + //! Returns true if the face is not trimmed. + bool NaturalRestriction() const; //! Returns the TopoDS face. const TopoDS_Face& GetFace() const; //! Returns the value of the boundary curve of the face. - gp_Pnt2d Value2d(const Standard_Real U) const; + gp_Pnt2d Value2d(const double U) const; - Standard_EXPORT Standard_Integer SIntOrder(const Standard_Real Eps) const; + Standard_EXPORT int SIntOrder(const double Eps) const; - Standard_EXPORT Standard_Integer SVIntSubs() const; + Standard_EXPORT int SVIntSubs() const; - Standard_EXPORT Standard_Integer SUIntSubs() const; + Standard_EXPORT int SUIntSubs() const; - Standard_EXPORT void UKnots(TColStd_Array1OfReal& Knots) const; + Standard_EXPORT void UKnots(NCollection_Array1& Knots) const; - Standard_EXPORT void VKnots(TColStd_Array1OfReal& Knots) const; + Standard_EXPORT void VKnots(NCollection_Array1& Knots) const; - Standard_EXPORT Standard_Integer LIntOrder(const Standard_Real Eps) const; + Standard_EXPORT int LIntOrder(const double Eps) const; - Standard_EXPORT Standard_Integer LIntSubs() const; + Standard_EXPORT int LIntSubs() const; - Standard_EXPORT void LKnots(TColStd_Array1OfReal& Knots) const; + Standard_EXPORT void LKnots(NCollection_Array1& Knots) const; //! Returns the number of points required to do the //! integration in the U parametric direction with //! a good accuracy. - Standard_EXPORT Standard_Integer UIntegrationOrder() const; + Standard_EXPORT int UIntegrationOrder() const; //! Returns the parametric bounds of the Face. - Standard_EXPORT void Bounds(Standard_Real& U1, - Standard_Real& U2, - Standard_Real& V1, - Standard_Real& V2) const; + Standard_EXPORT void Bounds(double& U1, double& U2, double& V1, double& V2) const; //! Computes the point of parameter U, V on the Face and //! the normal to the face at this point. - Standard_EXPORT void Normal(const Standard_Real U, - const Standard_Real V, - gp_Pnt& P, - gp_Vec& VNor) const; + Standard_EXPORT void Normal(const double U, const double V, gp_Pnt& P, gp_Vec& VNor) const; //! Loading the boundary arc. //! Returns FALSE if edge has no P-Curve. @@ -106,30 +103,30 @@ public: //! Returns the parametric value of the start point of //! the current arc of curve. - Standard_Real FirstParameter() const; + double FirstParameter() const; //! Returns the parametric value of the end point of //! the current arc of curve. - Standard_Real LastParameter() const; + double LastParameter() const; //! Returns the number of points required to do the //! integration along the parameter of curve. - Standard_EXPORT Standard_Integer IntegrationOrder() const; + Standard_EXPORT int IntegrationOrder() const; //! Returns the point of parameter U and the first derivative //! at this point of a boundary curve. - void D12d(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const; + void D12d(const double U, gp_Pnt2d& P, gp_Vec2d& V1) const; //! Loading the boundary arc. This arc is either a top, bottom, //! left or right bound of a UV rectangle in which the //! parameters of surface are defined. - //! If IsFirstParam is equal to Standard_True, the face is + //! If IsFirstParam is equal to true, the face is //! initialized by either left of bottom bound. Otherwise it is //! initialized by the top or right one. //! If theIsoType is equal to GeomAbs_IsoU, the face is //! initialized with either left or right bound. Otherwise - //! with either top or bottom one. - Standard_EXPORT void Load(const Standard_Boolean IsFirstParam, const GeomAbs_IsoType theIsoType); + Standard_EXPORT void Load(const bool IsFirstParam, const GeomAbs_IsoType theIsoType); //! Returns an array of U knots of the face. The first and last //! elements of the array will be theUMin and theUMax. The @@ -137,9 +134,18 @@ public: //! then theUMin and lower then theUMax in increasing order. //! If the face is not a BSpline, the array initialized with //! theUMin and theUMax only. - Standard_EXPORT void GetUKnots(const Standard_Real theUMin, - const Standard_Real theUMax, - Handle(TColStd_HArray1OfReal)& theUKnots) const; + //! @param[in] theUMin lower U bound + //! @param[in] theUMax upper U bound + //! @return array of U knot values + [[nodiscard]] Standard_EXPORT occ::handle> GetUKnots( + const double theUMin, + const double theUMax) const; + + //! @deprecated Use GetUKnots() returning handle by value instead. + Standard_DEPRECATED("Use GetUKnots() returning handle by value instead") + Standard_EXPORT void GetUKnots(const double theUMin, + const double theUMax, + occ::handle>& theUKnots) const; //! Returns an array of combination of T knots of the arc and //! V knots of the face. The first and last elements of the @@ -150,16 +156,27 @@ public: //! theTMin and lower then theTMax in increasing order. //! If the face is not a BSpline, the array initialized with //! theTMin and theTMax only. - Standard_EXPORT void GetTKnots(const Standard_Real theTMin, - const Standard_Real theTMax, - Handle(TColStd_HArray1OfReal)& theTKnots) const; + //! @param[in] theTMin lower T bound + //! @param[in] theTMax upper T bound + //! @return array of T knot values + [[nodiscard]] Standard_EXPORT occ::handle> GetTKnots( + const double theTMin, + const double theTMax) const; + + //! @deprecated Use GetTKnots() returning handle by value instead. + Standard_DEPRECATED("Use GetTKnots() returning handle by value instead") + Standard_EXPORT void GetTKnots(const double theTMin, + const double theTMax, + occ::handle>& theTKnots) const; -protected: private: - BRepAdaptor_Surface mySurface; - Geom2dAdaptor_Curve myCurve; - Standard_Boolean mySReverse; - Standard_Boolean myIsUseSpan; + BRepAdaptor_Surface mySurface; + Geom2dAdaptor_Curve myCurve; + occ::handle myFaceSurface; + TopLoc_Location myFaceLocation; + bool myIsFaceContextReady; + bool mySReverse; + bool myIsUseSpan; }; #include diff --git a/opencascade/BRepGProp_Face.lxx b/opencascade/BRepGProp_Face.lxx index fc14d4733..f2554bd4e 100644 --- a/opencascade/BRepGProp_Face.lxx +++ b/opencascade/BRepGProp_Face.lxx @@ -20,8 +20,9 @@ // purpose : Constructor. Initializes the object with IsUseSpan. //======================================================================= -inline BRepGProp_Face::BRepGProp_Face(const Standard_Boolean IsUseSpan) - : mySReverse(Standard_False), +inline BRepGProp_Face::BRepGProp_Face(const bool IsUseSpan) + : myIsFaceContextReady(false), + mySReverse(false), myIsUseSpan(IsUseSpan) { } @@ -32,27 +33,27 @@ inline BRepGProp_Face::BRepGProp_Face(const Standard_Boolean IsUseSpan) // IsUseSpan flan. //======================================================================= -inline BRepGProp_Face::BRepGProp_Face(const TopoDS_Face& F, const Standard_Boolean IsUseSpan) - : myIsUseSpan(IsUseSpan) +inline BRepGProp_Face::BRepGProp_Face(const TopoDS_Face& F, const bool IsUseSpan) + : myIsFaceContextReady(false), + mySReverse(false), + myIsUseSpan(IsUseSpan) { Load(F); } //======================================================================= // function : NaturalRestriction -// purpose : Returns Standard_True if the face is not trimmed. +// purpose : Returns true if the face is not trimmed. //======================================================================= -inline Standard_Boolean BRepGProp_Face::NaturalRestriction() const +inline bool BRepGProp_Face::NaturalRestriction() const { return BRep_Tool::NaturalRestriction(mySurface.Face()); } // -//======================================================================= -// function : GetFace -// purpose : Returns TopoDS Face. -//======================================================================= + +//================================================================================================= inline const TopoDS_Face& BRepGProp_Face::GetFace() const { @@ -64,7 +65,7 @@ inline const TopoDS_Face& BRepGProp_Face::GetFace() const // purpose : Returns the value of the boundary curve of the face. //======================================================================= -inline gp_Pnt2d BRepGProp_Face::Value2d(const Standard_Real U) const +inline gp_Pnt2d BRepGProp_Face::Value2d(const double U) const { return myCurve.Value(U); } @@ -75,7 +76,7 @@ inline gp_Pnt2d BRepGProp_Face::Value2d(const Standard_Real U) const // at this point of a boundary curve. //======================================================================= -inline void BRepGProp_Face::D12d(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const +inline void BRepGProp_Face::D12d(const double U, gp_Pnt2d& P, gp_Vec2d& V1) const { myCurve.D1(U, P, V1); } @@ -86,7 +87,7 @@ inline void BRepGProp_Face::D12d(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V // the current arc of curve. //======================================================================= -inline Standard_Real BRepGProp_Face::FirstParameter() const +inline double BRepGProp_Face::FirstParameter() const { return myCurve.FirstParameter(); } @@ -97,7 +98,7 @@ inline Standard_Real BRepGProp_Face::FirstParameter() const // the current arc of curve. //======================================================================= -inline Standard_Real BRepGProp_Face::LastParameter() const +inline double BRepGProp_Face::LastParameter() const { return myCurve.LastParameter(); } diff --git a/opencascade/BRepGProp_Gauss.hxx b/opencascade/BRepGProp_Gauss.hxx index c41f201dc..75bac0bcb 100644 --- a/opencascade/BRepGProp_Gauss.hxx +++ b/opencascade/BRepGProp_Gauss.hxx @@ -31,20 +31,20 @@ class BRepGProp_Gauss { //! Mass of the current system (without density). //! May correspond to: length, area, volume. - Standard_Real Mass; + double Mass; //! Static moments of inertia. - Standard_Real Ix; - Standard_Real Iy; - Standard_Real Iz; + double Ix; + double Iy; + double Iz; //! Quadratic moments of inertia. - Standard_Real Ixx; - Standard_Real Iyy; - Standard_Real Izz; - Standard_Real Ixy; - Standard_Real Ixz; - Standard_Real Iyz; + double Ixx; + double Iyy; + double Izz; + double Ixy; + double Ixz; + double Iyz; //! Default constructor. Inertia(); @@ -54,7 +54,7 @@ class BRepGProp_Gauss }; typedef NCollection_Handle> InertiaArray; - typedef Standard_Real (*BRepGProp_GaussFunc)(const Standard_Real, const Standard_Real); + typedef double (*BRepGProp_GaussFunc)(const double, const double); public: //! @name public API //! Describes types of geometric objects. @@ -85,13 +85,13 @@ public: //! @name public API //! @param[out] theOutMass - mass (volume) of region; //! @param[out] theOutGravityCenter - garvity center of region; //! @param[out] theOutInertia - matrix of inertia; - Standard_EXPORT void Compute(const BRepGProp_Face& theSurface, - const gp_Pnt& theLocation, - const Standard_Real theCoeff[], - const Standard_Boolean theIsByPoint, - Standard_Real& theOutMass, - gp_Pnt& theOutGravityCenter, - gp_Mat& theOutInertia); + Standard_EXPORT void Compute(const BRepGProp_Face& theSurface, + const gp_Pnt& theLocation, + const double theCoeff[], + const bool theIsByPoint, + double& theOutMass, + gp_Pnt& theOutGravityCenter, + gp_Mat& theOutInertia); //! Computes the global properties of a surface. Surface can be closed. //! The method is quick and its precision is enough for many cases of analytical surfaces. @@ -105,7 +105,7 @@ public: //! @name public API //! @param[out] theOutInertia - matrix of inertia; Standard_EXPORT void Compute(const BRepGProp_Face& theSurface, const gp_Pnt& theLocation, - Standard_Real& theOutMass, + double& theOutMass, gp_Pnt& theOutGravityCenter, gp_Mat& theOutInertia); @@ -123,14 +123,14 @@ public: //! @name public API //! @param[out] theOutMass - mass (volume) of region; //! @param[out] theOutGravityCenter - garvity center of region; //! @param[out] theOutInertia - matrix of inertia; - Standard_EXPORT void Compute(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& theLocation, - const Standard_Real theCoeff[], - const Standard_Boolean theIsByPoint, - Standard_Real& theOutMass, - gp_Pnt& theOutGravityCenter, - gp_Mat& theOutInertia); + Standard_EXPORT void Compute(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& theLocation, + const double theCoeff[], + const bool theIsByPoint, + double& theOutMass, + gp_Pnt& theOutGravityCenter, + gp_Mat& theOutInertia); //! Computes the global properties of a surface. Surface can be closed. //! The method is quick and its precision is enough for many cases of analytical surfaces. @@ -146,7 +146,7 @@ public: //! @name public API Standard_EXPORT void Compute(BRepGProp_Face& theSurface, BRepGProp_Domain& theDomain, const gp_Pnt& theLocation, - Standard_Real& theOutMass, + double& theOutMass, gp_Pnt& theOutGravityCenter, gp_Mat& theOutInertia); @@ -164,17 +164,17 @@ public: //! @name public API //! @param[out] theOutGravityCenter - garvity center of region; //! @param[out] theOutInertia - matrix of inertia; //! @return value of error which is calculated as - //! Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. - Standard_EXPORT Standard_Real Compute(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& theLocation, - const Standard_Real theEps, - const Standard_Real theCoeff[], - const Standard_Boolean theByPoint, - Standard_Real& theOutMass, - gp_Pnt& theOutGravityCenter, - gp_Mat& theOutInertia); + Standard_EXPORT double Compute(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& theLocation, + const double theEps, + const double theCoeff[], + const bool theByPoint, + double& theOutMass, + gp_Pnt& theOutGravityCenter, + gp_Mat& theOutInertia); //! Computes the global properties of the face. Adaptive 2D Gauss integration is used. //! If Epsilon more than 0.001 then algorithm performs non-adaptive integration. @@ -186,78 +186,74 @@ public: //! @name public API //! @param[out] theOutGravityCenter - garvity center of region; //! @param[out] theOutInertia - matrix of inertia; //! @return value of error which is calculated as - //! Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. - Standard_EXPORT Standard_Real Compute(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& theLocation, - const Standard_Real theEps, - Standard_Real& theOutMass, - gp_Pnt& theOutGravityCenter, - gp_Mat& theOutInertia); + Standard_EXPORT double Compute(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& theLocation, + const double theEps, + double& theOutMass, + gp_Pnt& theOutGravityCenter, + gp_Mat& theOutInertia); private: //! @name private methods - BRepGProp_Gauss(BRepGProp_Gauss const&); - BRepGProp_Gauss& operator=(BRepGProp_Gauss const&); + BRepGProp_Gauss(BRepGProp_Gauss const&) = delete; + BRepGProp_Gauss& operator=(BRepGProp_Gauss const&) = delete; void computeVInertiaOfElementaryPart(const gp_Pnt& thePoint, const gp_Vec& theNormal, const gp_Pnt& theLocation, - const Standard_Real theWeight, - const Standard_Real theCoeff[], - const Standard_Boolean theIsByPoint, + const double theWeight, + const double theCoeff[], + const bool theIsByPoint, BRepGProp_Gauss::Inertia& theOutInertia); void computeSInertiaOfElementaryPart(const gp_Pnt& thePoint, const gp_Vec& theNormal, const gp_Pnt& theLocation, - const Standard_Real theWeight, + const double theWeight, BRepGProp_Gauss::Inertia& theOutInertia); - void checkBounds(const Standard_Real theU1, - const Standard_Real theU2, - const Standard_Real theV1, - const Standard_Real theV2); + void checkBounds(const double theU1, const double theU2, const double theV1, const double theV2); void addAndRestoreInertia(const BRepGProp_Gauss::Inertia& theInInertia, BRepGProp_Gauss::Inertia& theOutInertia); - void multAndRestoreInertia(const Standard_Real theValue, BRepGProp_Gauss::Inertia& theInertia); + void multAndRestoreInertia(const double theValue, BRepGProp_Gauss::Inertia& theInertia); void convert(const BRepGProp_Gauss::Inertia& theInertia, gp_Pnt& theOutGravityCenter, gp_Mat& theOutMatrixOfInertia, - Standard_Real& theOutMass); + double& theOutMass); void convert(const BRepGProp_Gauss::Inertia& theInertia, - const Standard_Real theCoeff[], - const Standard_Boolean theIsByPoint, + const double theCoeff[], + const bool theIsByPoint, gp_Pnt& theOutGravityCenter, gp_Mat& theOutMatrixOfInertia, - Standard_Real& theOutMass); + double& theOutMass); - static Standard_Integer MaxSubs(const Standard_Integer theN, - const Standard_Integer theCoeff = 32); + static int MaxSubs(const int theN, const int theCoeff = 32); static void Init(NCollection_Handle& theOutVec, - const Standard_Real theValue, - const Standard_Integer theFirst = 0, - const Standard_Integer theLast = 0); + const double theValue, + const int theFirst = 0, + const int theLast = 0); - static void InitMass(const Standard_Real theValue, - const Standard_Integer theFirst, - const Standard_Integer theLast, - InertiaArray& theArray); + static void InitMass(const double theValue, + const int theFirst, + const int theLast, + InertiaArray& theArray); - static Standard_Integer FillIntervalBounds(const Standard_Real theA, - const Standard_Real theB, - const TColStd_Array1OfReal& theKnots, - const Standard_Integer theNumSubs, - InertiaArray& theInerts, - NCollection_Handle& theParam1, - NCollection_Handle& theParam2, - NCollection_Handle& theError, - NCollection_Handle& theCommonError); + static int FillIntervalBounds(const double theA, + const double theB, + const NCollection_Array1& theKnots, + const int theNumSubs, + InertiaArray& theInerts, + NCollection_Handle& theParam1, + NCollection_Handle& theParam2, + NCollection_Handle& theError, + NCollection_Handle& theCommonError); private: //! @name private fields BRepGProp_GaussType myType; //!< Type of geometric object diff --git a/opencascade/BRepGProp_MeshCinert.hxx b/opencascade/BRepGProp_MeshCinert.hxx index 838610d7a..553bfc58d 100644 --- a/opencascade/BRepGProp_MeshCinert.hxx +++ b/opencascade/BRepGProp_MeshCinert.hxx @@ -16,14 +16,15 @@ #include #include #include -#include -#include +#include +#include +#include #include class gp_Pnt; class TopoDS_Edge; -//! Computes the global properties of -//! of polylines represented by set of points. +//! Computes the global properties of +//! of polylines represented by set of points. //! This class is used for computation of global //! properties of edge, which has no exact geometry //! (3d or 2d curve), but has any of allowed @@ -38,18 +39,21 @@ public: Standard_EXPORT void SetLocation(const gp_Pnt& CLocation); - //! Computes the global properties of - //! of polylines represented by set of points. - Standard_EXPORT void Perform(const TColgp_Array1OfPnt& theNodes); - - //! Prepare set of 3d points on base of any available edge polygons: - //! 3D polygon, polygon on triangulation, 2d polygon on surface - //! If edge has no polygons, array thePolyg is left unchanged - Standard_EXPORT static void PreparePolygon(const TopoDS_Edge& theE, - Handle(TColgp_HArray1OfPnt)& thePolyg); - -protected: -private: + //! Computes the global properties of + //! of polylines represented by set of points. + Standard_EXPORT void Perform(const NCollection_Array1& theNodes); + + //! Prepares set of 3d points on base of any available edge polygons: + //! 3D polygon, polygon on triangulation, 2d polygon on surface. + //! @param[in] theE the edge to extract polygon from + //! @return array of 3D points, or null handle if edge has no polygons + [[nodiscard]] Standard_EXPORT static occ::handle> PreparePolygon( + const TopoDS_Edge& theE); + + //! @deprecated Use PreparePolygon() returning handle by value instead. + Standard_DEPRECATED("Use PreparePolygon() returning handle by value instead") + Standard_EXPORT static void PreparePolygon(const TopoDS_Edge& theE, + occ::handle>& thePolyg); }; #endif // _BRepGProp_MeshCinert_HeaderFile diff --git a/opencascade/BRepGProp_MeshProps.hxx b/opencascade/BRepGProp_MeshProps.hxx index ab3930b26..bca213dd8 100644 --- a/opencascade/BRepGProp_MeshProps.hxx +++ b/opencascade/BRepGProp_MeshProps.hxx @@ -16,7 +16,8 @@ #include #include -#include +#include +#include class Poly_Triangulation; class TopLoc_Location; @@ -52,25 +53,25 @@ public: //! over triangle surfaces using Gauss cubature formulas. //! Depending on the mesh object type used in constructor this method can //! calculate the surface or volume properties of the mesh. - Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh, - const TopLoc_Location& theLoc, - const TopAbs_Orientation theOri); + Standard_EXPORT void Perform(const occ::handle& theMesh, + const TopLoc_Location& theLoc, + const TopAbs_Orientation theOri); - Standard_EXPORT void Perform(const Handle(Poly_Triangulation)& theMesh, - const TopAbs_Orientation theOri); + Standard_EXPORT void Perform(const occ::handle& theMesh, + const TopAbs_Orientation theOri); //! Computes the global properties of triangle {p1, p2, p3} relatively //! point Apex //! If isVolume = true, volume properties are calculated //! otherwise - surface ones - Standard_EXPORT static void CalculateProps(const gp_Pnt& p1, - const gp_Pnt& p2, - const gp_Pnt& p3, - const gp_Pnt& Apex, - const Standard_Boolean isVolume, - Standard_Real GProps[10], - const Standard_Integer NbGaussPoints, - const Standard_Real* GaussPnts); + Standard_EXPORT static void CalculateProps(const gp_Pnt& p1, + const gp_Pnt& p2, + const gp_Pnt& p3, + const gp_Pnt& Apex, + const bool isVolume, + double GProps[10], + const int NbGaussPoints, + const double* GaussPnts); //! Get type of mesh object BRepGProp_MeshObjType GetMeshObjType() const { return myType; } diff --git a/opencascade/BRepGProp_Sinert.hxx b/opencascade/BRepGProp_Sinert.hxx index 7491bef0d..f9110e76c 100644 --- a/opencascade/BRepGProp_Sinert.hxx +++ b/opencascade/BRepGProp_Sinert.hxx @@ -43,14 +43,12 @@ public: //! of Edge from TopoDS (see DomainTool from GProp) Standard_EXPORT BRepGProp_Sinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& SLocation); - Standard_EXPORT BRepGProp_Sinert(BRepGProp_Face& S, - const gp_Pnt& SLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Sinert(BRepGProp_Face& S, const gp_Pnt& SLocation, const double Eps); - Standard_EXPORT BRepGProp_Sinert(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pnt& SLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Sinert(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pnt& SLocation, + const double Eps); Standard_EXPORT void SetLocation(const gp_Pnt& SLocation); @@ -58,19 +56,16 @@ public: Standard_EXPORT void Perform(BRepGProp_Face& S, BRepGProp_Domain& D); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, const double Eps); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - BRepGProp_Domain& D, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const double Eps); //! If previously used method contained Eps parameter - //! get actual relative error of the computation, else return 1.0. - Standard_EXPORT Standard_Real GetEpsilon(); + //! get actual relative error of the computation, else return 1.0. + Standard_EXPORT double GetEpsilon(); -protected: private: - Standard_Real myEpsilon; + double myEpsilon; }; #endif // _BRepGProp_Sinert_HeaderFile diff --git a/opencascade/BRepGProp_TFunction.hxx b/opencascade/BRepGProp_TFunction.hxx index 2394c8b62..b52630e41 100644 --- a/opencascade/BRepGProp_TFunction.hxx +++ b/opencascade/BRepGProp_TFunction.hxx @@ -43,20 +43,20 @@ public: //! lower bound of the inner integral. This value is fixed for //! any integral. And the value of tolerance of inner integral //! computation. - //! If IsByPoint is equal to Standard_True, the number of the + //! If IsByPoint is equal to true, the number of the //! coefficients is equal to 3 and they represent X, Y and Z //! coordinates (theCoeff[0], theCoeff[1] and theCoeff[2] //! correspondingly) of the shift if the inertia is computed //! with respect to the point different then the location. - //! If IsByPoint is equal to Standard_False, the number of the + //! If IsByPoint is equal to false, the number of the //! coefficients is 4 and they represent the combination of //! plane parameters and shift values. - Standard_EXPORT BRepGProp_TFunction(const BRepGProp_Face& theSurface, - const gp_Pnt& theVertex, - const Standard_Boolean IsByPoint, - const Standard_Real* theCoeffs, - const Standard_Real theUMin, - const Standard_Real theTolerance); + Standard_EXPORT BRepGProp_TFunction(const BRepGProp_Face& theSurface, + const gp_Pnt& theVertex, + const bool IsByPoint, + const double* theCoeffs, + const double theUMin, + const double theTolerance); Standard_EXPORT void Init(); @@ -70,49 +70,47 @@ public: //! current number. If the law in math_KronrodSingleIntegration //! is changed, the modification algo should be modified //! accordingly. - void SetNbKronrodPoints(const Standard_Integer theNbPoints); + void SetNbKronrodPoints(const int theNbPoints); //! Setting the type of the value to be returned. This //! parameter is directly passed to the UFunction. void SetValueType(const GProp_ValueType aType); - //! Setting the tolerance for inner integration - void SetTolerance(const Standard_Real aTol); + //! Setting the tolerance for inner integration + void SetTolerance(const double aTol); //! Returns the relative reached error of all values computation since //! the last call of GetStateNumber method. - Standard_Real ErrorReached() const; + double ErrorReached() const; //! Returns the absolut reached error of all values computation since //! the last call of GetStateNumber method. - Standard_Real AbsolutError() const; + double AbsolutError() const; //! Returns a value of the function. The value represents an //! integral of UFunction. It is computed with the predefined //! tolerance using the adaptive Gauss-Kronrod method. - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real X, - Standard_Real& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const double X, double& F) override; - //! Redefined method. Remembers the error reached during + //! Redefined method. Remembers the error reached during //! computation of integral values since the object creation //! or the last call of GetStateNumber. It is invoked in each //! algorithm from the package math. Particularly in the //! algorithm math_KronrodSingleIntegration that is used to //! compute the integral of TFunction. - Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE; + Standard_EXPORT int GetStateNumber() override; -protected: private: BRepGProp_Face mySurface; BRepGProp_UFunction myUFunction; - Standard_Real myUMin; - Standard_Real myTolerance; - Standard_Real myTolReached; - Standard_Real myErrReached; - Standard_Real myAbsError; + double myUMin; + double myTolerance; + double myTolReached; + double myErrReached; + double myAbsError; GProp_ValueType myValueType; - Standard_Boolean myIsByPoint; - Standard_Integer myNbPntOuter; + bool myIsByPoint; + int myNbPntOuter; }; #include diff --git a/opencascade/BRepGProp_TFunction.lxx b/opencascade/BRepGProp_TFunction.lxx index 93c7021e8..a35bb5c8d 100644 --- a/opencascade/BRepGProp_TFunction.lxx +++ b/opencascade/BRepGProp_TFunction.lxx @@ -13,20 +13,14 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//======================================================================= -// function : SetNbKronrodPoints -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepGProp_TFunction::SetNbKronrodPoints(const Standard_Integer theNbPoints) +inline void BRepGProp_TFunction::SetNbKronrodPoints(const int theNbPoints) { myNbPntOuter = (theNbPoints % 2 == 0) ? theNbPoints + 1 : theNbPoints; } -//======================================================================= -// function : SetValueType -// purpose : -//======================================================================= +//================================================================================================= inline void BRepGProp_TFunction::SetValueType(const GProp_ValueType theType) { @@ -34,32 +28,23 @@ inline void BRepGProp_TFunction::SetValueType(const GProp_ValueType theType) myUFunction.SetValueType(myValueType); } -//======================================================================= -// function : SetTolerance -// purpose : -//======================================================================= +//================================================================================================= -inline void BRepGProp_TFunction::SetTolerance(const Standard_Real theTolerance) +inline void BRepGProp_TFunction::SetTolerance(const double theTolerance) { myTolerance = theTolerance; } -//======================================================================= -// function : TolReached -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Real BRepGProp_TFunction::ErrorReached() const +inline double BRepGProp_TFunction::ErrorReached() const { return myErrReached; } -//======================================================================= -// function : ErrorReached -// purpose : -//======================================================================= +//================================================================================================= -inline Standard_Real BRepGProp_TFunction::AbsolutError() const +inline double BRepGProp_TFunction::AbsolutError() const { return myAbsError; } diff --git a/opencascade/BRepGProp_UFunction.hxx b/opencascade/BRepGProp_UFunction.hxx index 9e02837ce..69e270985 100644 --- a/opencascade/BRepGProp_UFunction.hxx +++ b/opencascade/BRepGProp_UFunction.hxx @@ -41,7 +41,7 @@ class gp_XYZ; //! GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ //! - moments of inertia computation. //! -//! If the flag IsByPoint is set to Standard_True, the value is +//! If the flag IsByPoint is set to true, the value is //! returned for the region of space that is delimited by a //! surface and a point. Otherwise all computations are //! performed for the region of space delimited by a surface @@ -55,29 +55,28 @@ public: //! location point, the flag IsByPoint and the coefficients //! theCoeff that have different meaning depending on the value //! of IsByPoint. - //! If IsByPoint is equal to Standard_True, the number of the + //! If IsByPoint is equal to true, the number of the //! coefficients is equal to 3 and they represent X, Y and Z //! coordinates (theCoeff[0], theCoeff[1] and theCoeff[2] //! correspondingly) of the shift, if the inertia is computed //! with respect to the point different then the location. - //! If IsByPoint is equal to Standard_False, the number of the + //! If IsByPoint is equal to false, the number of the //! coefficients is 4 and they represent the combination of //! plane parameters and shift values. - Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface, - const gp_Pnt& theVertex, - const Standard_Boolean IsByPoint, - const Standard_Real* theCoeffs); + Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface, + const gp_Pnt& theVertex, + const bool IsByPoint, + const double* theCoeffs); //! Setting the type of the value to be returned. void SetValueType(const GProp_ValueType theType); //! Setting the V parameter that is constant during the //! integral computation. - void SetVParam(const Standard_Real theVParam); + void SetVParam(const double theVParam); //! Returns a value of the function. - Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real X, - Standard_Real& F) Standard_OVERRIDE; + Standard_EXPORT bool Value(const double X, double& F) override; private: //! Private method. Returns the value for volume computation. @@ -86,32 +85,29 @@ private: //! - theS and theD1 coefficients that are computed and used //! for computation of center of mass and inertia values //! by plane. - Standard_EXPORT Standard_Real VolumeValue(const Standard_Real X, - gp_XYZ& thePMP0, - Standard_Real& theS, - Standard_Real& theD1); + Standard_EXPORT double VolumeValue(const double X, gp_XYZ& thePMP0, double& theS, double& theD1); //! Private method. Returns a value for the center of mass //! computation. If the value type other then GProp_CenterMassX, //! GProp_CenterMassY or GProp_CenterMassZ this method returns - //! Standard_False. Returns Standard_True in case of successful + //! false. Returns true in case of successful //! computation of a value. - Standard_EXPORT Standard_Boolean CenterMassValue(const Standard_Real X, Standard_Real& F); + Standard_EXPORT bool CenterMassValue(const double X, double& F); //! Private method. Computes the value of inertia. The type of //! a value returned is defined by the value type. If it is //! other then GProp_InertiaXX, GProp_InertiaYY, //! GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or - //! GProp_InertiaYZ, the method returns Standard_False. Returns - //! Standard_True in case of successful computation of a value - Standard_EXPORT Standard_Boolean InertiaValue(const Standard_Real X, Standard_Real& F); + //! GProp_InertiaYZ, the method returns false. Returns + //! true in case of successful computation of a value + Standard_EXPORT bool InertiaValue(const double X, double& F); - BRepGProp_Face mySurface; - gp_Pnt myVertex; - const Standard_Real* myCoeffs; - Standard_Real myVParam; - GProp_ValueType myValueType; - Standard_Boolean myIsByPoint; + BRepGProp_Face mySurface; + gp_Pnt myVertex; + const double* myCoeffs; + double myVParam; + GProp_ValueType myValueType; + bool myIsByPoint; }; #include diff --git a/opencascade/BRepGProp_UFunction.lxx b/opencascade/BRepGProp_UFunction.lxx index fcc686fca..3edc86981 100644 --- a/opencascade/BRepGProp_UFunction.lxx +++ b/opencascade/BRepGProp_UFunction.lxx @@ -29,7 +29,7 @@ inline void BRepGProp_UFunction::SetValueType(const GProp_ValueType theType) // integral computation. //======================================================================= -inline void BRepGProp_UFunction::SetVParam(const Standard_Real theVParam) +inline void BRepGProp_UFunction::SetVParam(const double theVParam) { myVParam = theVParam; } diff --git a/opencascade/BRepGProp_Vinert.hxx b/opencascade/BRepGProp_Vinert.hxx index 85da1c66f..c30651501 100644 --- a/opencascade/BRepGProp_Vinert.hxx +++ b/opencascade/BRepGProp_Vinert.hxx @@ -50,7 +50,7 @@ public: //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pnt& VLocation); @@ -58,18 +58,16 @@ public: //! delimited with the surface and the point VLocation. S can be closed //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, const gp_Pnt& VLocation, const double Eps); //! Computes the global properties of the region of 3D space //! delimited with the surface and the point VLocation. //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pnt& O, @@ -79,20 +77,20 @@ public: //! delimited with the surface and the point VLocation. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - const gp_Pnt& O, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, + const gp_Pnt& O, + const gp_Pnt& VLocation, + const double Eps); //! Computes the global properties of the region of 3D space //! delimited with the surface and the plane Pln. //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pln& Pl, @@ -102,20 +100,20 @@ public: //! delimited with the surface and the plane Pln. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - const gp_Pln& Pl, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, + const gp_Pln& Pl, + const gp_Pnt& VLocation, + const double Eps); //! Computes the global properties of a region of 3D space //! delimited with the surface and the point VLocation. S can be closed //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& VLocation); @@ -123,19 +121,19 @@ public: //! delimited with the surface and the point VLocation. S can be closed //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pnt& VLocation, + const double Eps); //! Computes the global properties of the region of 3D space //! delimited with the surface and the point VLocation. //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, @@ -146,21 +144,21 @@ public: //! delimited with the surface and the point VLocation. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pnt& O, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pnt& O, + const gp_Pnt& VLocation, + const double Eps); //! Computes the global properties of the region of 3D space //! delimited with the surface and the plane Pln. //! The method is quick and its precision is enough for many cases of analytical //! surfaces. //! Non-adaptive 2D Gauss integration with predefined numbers of Gauss points - //! is used. Numbers of points depend on types of surfaces and curves. + //! is used. Numbers of points depend on types of surfaces and curves. //! Error of the computation is not calculated. Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, @@ -171,60 +169,53 @@ public: //! delimited with the surface and the plane Pln. //! Adaptive 2D Gauss integration is used. //! Parameter Eps sets maximal relative error of computed mass (volume) for face. - //! Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values + //! Error is calculated as std::abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values //! for two successive steps of adaptive integration. //! WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. - Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pln& Pl, - const gp_Pnt& VLocation, - const Standard_Real Eps); + Standard_EXPORT BRepGProp_Vinert(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pln& Pl, + const gp_Pnt& VLocation, + const double Eps); Standard_EXPORT void SetLocation(const gp_Pnt& VLocation); Standard_EXPORT void Perform(const BRepGProp_Face& S); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, const double Eps); Standard_EXPORT void Perform(const BRepGProp_Face& S, const gp_Pnt& O); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - const gp_Pnt& O, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, const gp_Pnt& O, const double Eps); Standard_EXPORT void Perform(const BRepGProp_Face& S, const gp_Pln& Pl); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - const gp_Pln& Pl, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, const gp_Pln& Pl, const double Eps); Standard_EXPORT void Perform(BRepGProp_Face& S, BRepGProp_Domain& D); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - BRepGProp_Domain& D, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const double Eps); Standard_EXPORT void Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& O); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pnt& O, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pnt& O, + const double Eps); Standard_EXPORT void Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pln& Pl); - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& S, - BRepGProp_Domain& D, - const gp_Pln& Pl, - const Standard_Real Eps); + Standard_EXPORT double Perform(BRepGProp_Face& S, + BRepGProp_Domain& D, + const gp_Pln& Pl, + const double Eps); - //! If previously used methods containe Eps parameter - //! gets actual relative error of the computation, else returns 1.0. - Standard_EXPORT Standard_Real GetEpsilon(); + //! If previously used methods contain Eps parameter + //! gets actual relative error of the computation, else returns 1.0. + Standard_EXPORT double GetEpsilon(); -protected: private: - Standard_Real myEpsilon; + double myEpsilon; }; #endif // _BRepGProp_Vinert_HeaderFile diff --git a/opencascade/BRepGProp_VinertGK.hxx b/opencascade/BRepGProp_VinertGK.hxx index 9fe3ba5d1..5b0659ebb 100644 --- a/opencascade/BRepGProp_VinertGK.hxx +++ b/opencascade/BRepGProp_VinertGK.hxx @@ -64,65 +64,65 @@ public: //! Constructor. Computes the global properties of a region of //! 3D space delimited with the naturally restricted surface //! and the point VLocation. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Constructor. Computes the global properties of a region of //! 3D space delimited with the naturally restricted surface //! and the point VLocation. The inertia is computed with //! respect to thePoint. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - const gp_Pnt& thePoint, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + const gp_Pnt& thePoint, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Constructor. Computes the global properties of a region of //! 3D space delimited with the surface bounded by the domain //! and the point VLocation. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Constructor. Computes the global properties of a region of //! 3D space delimited with the surface bounded by the domain //! and the point VLocation. The inertia is computed with //! respect to thePoint. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& thePoint, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& thePoint, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Constructor. Computes the global properties of a region of //! 3D space delimited with the naturally restricted surface //! and the plane. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - const gp_Pln& thePlane, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + const gp_Pln& thePlane, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Constructor. Computes the global properties of a region of //! 3D space delimited with the surface bounded by the domain //! and the plane. - Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pln& thePlane, - const gp_Pnt& theLocation, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT BRepGProp_VinertGK(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pln& thePlane, + const gp_Pnt& theLocation, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Sets the vertex that delimit 3D closed region of space. void SetLocation(const gp_Pnt& theLocation) { loc = theLocation; } @@ -130,79 +130,79 @@ public: //! Computes the global properties of a region of 3D space //! delimited with the naturally restricted surface and the //! point VLocation. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Computes the global properties of a region of 3D space //! delimited with the naturally restricted surface and the //! point VLocation. The inertia is computed with respect to //! thePoint. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - const gp_Pnt& thePoint, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + const gp_Pnt& thePoint, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Computes the global properties of a region of 3D space //! delimited with the surface bounded by the domain and the //! point VLocation. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Computes the global properties of a region of 3D space //! delimited with the surface bounded by the domain and the //! point VLocation. The inertia is computed with respect to //! thePoint. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pnt& thePoint, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pnt& thePoint, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Computes the global properties of a region of 3D space //! delimited with the naturally restricted surface and the //! plane. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - const gp_Pln& thePlane, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + const gp_Pln& thePlane, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Computes the global properties of a region of 3D space //! delimited with the surface bounded by the domain and the //! plane. - Standard_EXPORT Standard_Real Perform(BRepGProp_Face& theSurface, - BRepGProp_Domain& theDomain, - const gp_Pln& thePlane, - const Standard_Real theTolerance = 0.001, - const Standard_Boolean theCGFlag = Standard_False, - const Standard_Boolean theIFlag = Standard_False); + Standard_EXPORT double Perform(BRepGProp_Face& theSurface, + BRepGProp_Domain& theDomain, + const gp_Pln& thePlane, + const double theTolerance = 0.001, + const bool theCGFlag = false, + const bool theIFlag = false); //! Returns the relative reached computation error. - Standard_Real GetErrorReached() const { return myErrorReached; } + double GetErrorReached() const { return myErrorReached; } //! Returns the absolut reached computation error. - Standard_Real GetAbsolutError() const; + double GetAbsolutError() const; private: //! Main method for computation of the global properties that //! is invoked by each Perform method. - Standard_EXPORT Standard_Real PrivatePerform(BRepGProp_Face& theSurface, - const Standard_Address thePtrDomain, - const Standard_Boolean IsByPoint, - const Standard_Real* theCoeffs, - const Standard_Real theTolerance, - const Standard_Boolean theCGFlag, - const Standard_Boolean theIFlag); - - Standard_Real myErrorReached; - Standard_Real myAbsolutError; + Standard_EXPORT double PrivatePerform(BRepGProp_Face& theSurface, + void* const thePtrDomain, + const bool IsByPoint, + const double* theCoeffs, + const double theTolerance, + const bool theCGFlag, + const bool theIFlag); + + double myErrorReached; + double myAbsolutError; }; #endif // _BRepGProp_VinertGK_HeaderFile diff --git a/opencascade/BRepGraph.hxx b/opencascade/BRepGraph.hxx new file mode 100644 index 000000000..1d728dc02 --- /dev/null +++ b/opencascade/BRepGraph.hxx @@ -0,0 +1,308 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_HeaderFile +#define _BRepGraph_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +template +class BRepGraph_MutGuard; + +struct BRepGraph_Data; +class BRepGraphInc_Storage; +class BRepGraph_Layer; +class BRepGraph_MeshCacheStorage; +class NCollection_BaseAllocator; +class TCollection_AsciiString; + +class BRepGraph_Builder; +class BRepGraph_History; + +//! @brief Topology-geometry graph over TopoDS / BRep. +//! +//! Stores B-Rep topology as flat entity vectors (incidence-table model) with +//! integer cross-references, enabling cache-friendly traversal, O(1) upward +//! navigation via reverse indices, and parallel face-level geometry extraction. +//! +//! Key design concepts: +//! - **NodeId** (Kind + Index): lightweight typed address into per-kind vectors. +//! - **UID** (Kind + Counter): persistent identity surviving compaction/reorder. +//! - **RepId** (Kind + Index): separate geometry/mesh addressing (Surface, +//! Curve3D, Curve2D, Triangulation, Polygon) decoupled from topology nodes. +//! - **CoEdge**: half-edge entity owning PCurve data for each edge-face binding; +//! seam edges use paired CoEdges with opposite Orientation (Parasolid convention). +//! - **Lifecycle**: BRepGraph_Builder::Add() populates from TopoDS_Shape; +//! Editor() is the single mutation entry point for both structural creation/removal +//! (Add*, Remove*, Append*) and field-level RAII-scoped mutation (Mut*()) with +//! automatic cache invalidation and upward SubtreeGen propagation. +//! +//! Per-occurrence data (orientation, location) lives on incidence refs. +//! Definition types are aliases to BRepGraphInc entity structs. +//! +//! ## Grouped View API +//! Related methods are grouped behind lightweight view objects. +//! Include the corresponding header (e.g. BRepGraph_TopoView.hxx) to use. +//! +//! ## Thread safety +//! Const query methods are safe for concurrent reads. +//! Concurrent reads during active mutation still require external synchronization. +//! Deferred invalidation (BRepGraph_DeferredScope) batches SubtreeGen propagation; +//! concurrent Editor().Mut*() calls during deferred mode still require external +//! serialization. +//! BRepGraph_Builder::Add() is internally parallel when requested. +//! +//! ## UID persistence +//! UIDs use monotonic counters (not vector indices), persisting across Compact() +//! and node removal. Only BRepGraph::Clear() resets counters (new generation). +//! See BRepGraph_UID.hxx for the serialization contract. +//! +//! ## Extension model +//! Extend via BRepGraph_Layer (per-node attributes) or BRepGraph_TransientCache +//! (algorithm-computed caches). Direct storage extension is not supported. +//! +//! ## ID systems +//! Four ID types with different stability guarantees: +//! - **NodeId** (Kind + per-kind Index): fast graph-local address. NOT stable across Compact(). +//! Use for in-graph traversal and short-lived algorithm temporaries. +//! - **UID** (Kind + monotonic Counter): persistent identity surviving Compact() and node removal. +//! Use for cross-session storage, history tracking, and external references. +//! - **RefId** (Kind + per-kind Index): same stability as NodeId, but addresses reference entries +//! (Shell->Solid binding, Face->Shell binding, CoEdge->Wire binding) rather than defs. +//! - **RepId** (Kind + per-kind Index): addresses geometry/mesh representation objects (Surface, +//! Curve3D, Curve2D, Triangulation, Polygon) independently of topology nodes. +//! +//! ## Iterator guide +//! Choose the iterator that matches your traversal need: +//! - **BRepGraph_Iterator\**: flat sequential scan of ALL definitions of one kind +//! (e.g. every FaceDef, skipping removed). Use for bulk per-kind algorithms. +//! - **BRepGraph_DefsIterator / BRepGraph_RefsIterator**: single-level typed children of one +//! parent (e.g. active shells of one solid, coedge refs of one wire). Zero allocation. +//! Use when you have a specific parent and need its direct children. +//! - **BRepGraph_ChildExplorer**: depth-first downward walk from a root with accumulated +//! location/orientation per step. Use when visiting descendants across multiple levels or +//! when the global transform matters. Supports Recursive and DirectChildren modes. +//! - **BRepGraph_ParentExplorer**: upward walk via reverse indices from a starting node. +//! Use when tracing which shells/solids/compounds contain a given face or edge. +//! - **BRepGraph_RelatedIterator**: single-level semantic neighbors (adjacent faces, boundary +//! edges, incident vertices). No structural descent; no location accumulation. +//! - **BRepGraph_WireExplorer**: ordered edge traversal within a single wire, following +//! connectivity order (graph equivalent of BRepTools_WireExplorer). +class BRepGraph +{ +public: + DEFINE_STANDARD_ALLOC + + BRepGraph(const BRepGraph&) = delete; + BRepGraph& operator=(const BRepGraph&) = delete; + + //! Default constructor. Creates an empty graph with default allocator. + Standard_EXPORT BRepGraph(); + //! Construct with a custom allocator for internal collections. + //! @param[in] theAlloc allocator for internal collections (null uses CommonBaseAllocator) + Standard_EXPORT explicit BRepGraph(const occ::handle& theAlloc); + //! Destructor. + Standard_EXPORT ~BRepGraph(); + //! Move constructor. + Standard_EXPORT BRepGraph(BRepGraph&&) noexcept; + //! Move assignment operator. + Standard_EXPORT BRepGraph& operator=(BRepGraph&&) noexcept; + + //! Reset the graph to an empty state. Increments generation and regenerates the graph GUID. + Standard_EXPORT void Clear(); + + //! Return true if the graph was successfully built. + [[nodiscard]] Standard_EXPORT bool IsDone() const; + + //! Verify reverse-index consistency against forward entity / reference-entry tables. + //! Intended for debug builds and regression tests of incremental mutation paths. + //! @return true when every forward ref has a matching reverse entry. + [[nodiscard]] Standard_EXPORT bool ValidateReverseIndex() const; + + //! Return root product identifiers (products not referenced by any active occurrence). + //! Maintained incrementally by Editor/EditorView mutations. + //! Returns empty vector if the graph has not been built. + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& + RootProductIds() const; + + //! Replace the internal allocator and re-create all storage. + Standard_EXPORT void SetAllocator(const occ::handle& theAlloc); + + //! Return the current allocator. + [[nodiscard]] Standard_EXPORT const occ::handle& Allocator() const; + +public: + //! Shared cache for edge/vertex shapes during multi-face reconstruction. + using ReconstructCache = NCollection_DataMap; + + class TopoView; + class UIDsView; + class CacheView; + class RefsView; + class ShapesView; + class EditorView; + class MeshView; + + //! Access topology definitions, representation access, adjacency queries, + //! raw Product/Occurrence definition storage, and assembly classification. + [[nodiscard]] Standard_EXPORT const TopoView& Topo() const; + //! Access unique identifiers. + [[nodiscard]] Standard_EXPORT const UIDsView& UIDs() const; + //! Access transient cache values through the stable grouped-view API. + //! This is the only public cache interface. + [[nodiscard]] Standard_EXPORT CacheView& Cache(); + //! Access transient cache values (const, read-only Get/Has/CacheKinds). + //! This is the only public cache interface. + [[nodiscard]] Standard_EXPORT const CacheView& Cache() const; + //! Access reference entries and their UIDs. + [[nodiscard]] Standard_EXPORT const RefsView& Refs() const; + //! Access cached and fresh shape reconstruction. + [[nodiscard]] Standard_EXPORT const ShapesView& Shapes() const; + //! Access programmatic graph construction and mutation. + [[nodiscard]] Standard_EXPORT EditorView& Editor(); + //! Const access to editor-specific state queries. + //! Exposes IsDeferredMode() and ValidateMutationBoundary() on a const graph. + //! All structural mutation methods require the non-const Editor() overload. + [[nodiscard]] Standard_EXPORT const EditorView& Editor() const; + //! Access mesh data with cache-first, persistent-fallback priority. + //! For mesh cache writes and rep creation, use BRepGraph_Tool::Mesh. + [[nodiscard]] Standard_EXPORT const MeshView& Mesh() const; + + //! Access history subsystem directly. + //! History is returned directly rather than through a lightweight view + //! because it is already a self-contained query and recording subsystem + //! with no per-view cached state. + //! @return history subsystem for tracking modifications + [[nodiscard]] Standard_EXPORT BRepGraph_History& History(); + //! Access history subsystem directly (const). + //! @return history subsystem for tracking modifications + [[nodiscard]] Standard_EXPORT const BRepGraph_History& History() const; + + //! Access registered graph layers. + //! @return layer registry for managing attribute layers + [[nodiscard]] Standard_EXPORT BRepGraph_LayerRegistry& LayerRegistry(); + //! Access registered graph layers (const). + //! @return layer registry for managing attribute layers + [[nodiscard]] Standard_EXPORT const BRepGraph_LayerRegistry& LayerRegistry() const; + +private: + friend class BRepGraph_Builder; + friend class BRepGraph_Compact; + friend class BRepGraph_Copy; + friend class BRepGraph_Tool; + friend class BRepGraph_Transform; + template + friend class BRepGraph_MutGuard; + + //! @{ + + //! Access the underlying storage. + [[nodiscard]] Standard_EXPORT BRepGraphInc_Storage& incStorage(); + [[nodiscard]] Standard_EXPORT const BRepGraphInc_Storage& incStorage() const; + + //! Access the graph data structure. + [[nodiscard]] Standard_EXPORT BRepGraph_Data* data(); + [[nodiscard]] Standard_EXPORT const BRepGraph_Data* data() const; + + //! Access the layer registry. + [[nodiscard]] Standard_EXPORT BRepGraph_LayerRegistry& layerRegistry(); + [[nodiscard]] Standard_EXPORT const BRepGraph_LayerRegistry& layerRegistry() const; + + //! Access the raw transient cache for friend algorithms and builders. + [[nodiscard]] Standard_EXPORT BRepGraph_TransientCache& transientCache(); + [[nodiscard]] Standard_EXPORT const BRepGraph_TransientCache& transientCache() const; + + //! Access the raw reference transient cache. + [[nodiscard]] Standard_EXPORT BRepGraph_RefTransientCache& refTransientCache(); + [[nodiscard]] Standard_EXPORT const BRepGraph_RefTransientCache& refTransientCache() const; + + //! Access the mesh cache storage. + [[nodiscard]] Standard_EXPORT BRepGraph_MeshCacheStorage& meshCache(); + [[nodiscard]] Standard_EXPORT const BRepGraph_MeshCacheStorage& meshCache() const; + + //! Generic reference lookup by RefId (const). + //! Returns nullptr if the RefId is invalid or out of range. + Standard_EXPORT const BRepGraphInc::BaseRef* refEntity(const BRepGraph_RefId theId) const; + + //! @} + + Standard_EXPORT void invalidateSubgraphImpl(const BRepGraph_NodeId theNode); + Standard_EXPORT BRepGraph_UID allocateUID(const BRepGraph_NodeId theNodeId); + Standard_EXPORT BRepGraph_RefUID allocateRefUID(const BRepGraph_RefId theRefId); + + Standard_EXPORT void markModified(const BRepGraph_NodeId theNodeId) noexcept; + Standard_EXPORT void markRefModified(const BRepGraph_RefId theRefId) noexcept; + + //! Optimized overload: skips changeTopoEntity() dispatch + //! when the caller already holds a mutable reference to the target entity. + Standard_EXPORT void markModified(const BRepGraph_NodeId theNodeId, + BRepGraphInc::BaseDef& theEntity) noexcept; + Standard_EXPORT void markRefModified(const BRepGraph_RefId theRefId, + BRepGraphInc::BaseRef& theRef) noexcept; + + //! Increment SubtreeGen on a parent node (NOT OwnGen - parent's own data didn't change). + //! Uses wave guard to prevent exponential blowup on diamond topologies. + //! Mutex-free: no shape cache clear, no dispatch. + Standard_EXPORT void markParentSubtreeGen(const BRepGraph_NodeId theParentId) noexcept; + + //! Propagate SubtreeGen upward through reverse indices via markParentSubtreeGen(). + Standard_EXPORT void propagateSubtreeGen(const BRepGraph_NodeId theNodeId) noexcept; + + //! Increment OwnGen on a representation and propagate mutation + //! to the owning topology node(s). + Standard_EXPORT void markRepModified(const BRepGraph_RepId theRepId) noexcept; + + //! Generic topology definition lookup by NodeId (const). + Standard_EXPORT const BRepGraphInc::BaseDef* topoEntity(const BRepGraph_NodeId theId) const; + + //! Generic mutable topology definition lookup by NodeId. + Standard_EXPORT BRepGraphInc::BaseDef* changeTopoEntity(const BRepGraph_NodeId theId); + + //! Initialize cached view objects to point to this graph. + Standard_EXPORT void initViews(); + + // Fields at the bottom (OCCT style) + std::unique_ptr myData; + + //! Registered layers are stored on BRepGraph, not BRepGraph_Data, to survive Compact swap. + BRepGraph_LayerRegistry myLayerRegistry; + BRepGraph_TransientCache myTransientCache; //!< Transient algorithm caches (BndBox, UVBounds) + BRepGraph_RefTransientCache myRefTransientCache; //!< Transient per-reference caches +}; + +// Included after BRepGraph is complete so the template body sees markModified(). +#include + +#endif // _BRepGraph_HeaderFile diff --git a/opencascade/BRepGraphInc_Definition.hxx b/opencascade/BRepGraphInc_Definition.hxx new file mode 100644 index 000000000..cffcc67a4 --- /dev/null +++ b/opencascade/BRepGraphInc_Definition.hxx @@ -0,0 +1,300 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Definition_HeaderFile +#define _BRepGraphInc_Definition_HeaderFile + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +//! @brief Definition structs for the incidence-table topology model. +//! +//! Each definition holds intrinsic geometry properties plus forward-direction +//! children (via RefId indices). The incidence model stores topology as flat +//! vectors of definitions (one per kind) with integer cross-references, +//! enabling cache-friendly traversal and parallel geometry extraction. +namespace BRepGraphInc +{ + +//! Helper: reinitialize a vector member with the given allocator and block size. +template +inline void InitVec(NCollection_DynamicArray& theVec, + const occ::handle& theAlloc, + const int theBlockSize = 4) +{ + theVec = NCollection_DynamicArray(theBlockSize, theAlloc); +} + +//! Fields shared by every entity. +struct BaseDef +{ + using TypeId = BRepGraph_NodeId; + + //! Own-data mutation counter, incremented ONLY when the entity's own + //! definition fields change (tolerance, point, flags, etc.). + //! NOT incremented by descendant changes. + //! Used by VersionStamp for persistent identity staleness detection. + uint32_t OwnGen = 0; + + //! Subtree mutation counter, incremented when own data OR any descendant + //! data changes. Propagated upward via markParentSubtreeGen(). + //! Used by TransientCache and shape cache for hierarchical freshness. + uint32_t SubtreeGen = 0; + + //! Wave counter from the last propagation that visited this node. + //! Used as a re-visit guard in markParentSubtreeGen() to prevent + //! exponential blowup on diamond topologies. Compared against + //! BRepGraph_Data::myPropagationWave. + uint32_t LastPropWave = 0; + + bool IsRemoved = false; //!< Soft-removal flag +}; + +//! Vertex definition: 3D point + tolerance. +struct VertexDef : public BaseDef +{ + using TypeId = BRepGraph_VertexId; + + //! 3D point in definition frame (raw BRep_TVertex::Pnt, without vertex-in-edge Location). + gp_Pnt Point; + + //! Tolerance from BRep_TVertex. + double Tolerance = 0.0; + + void InitVectors(const occ::handle&) {} +}; + +//! Edge entity: parameter range, boundary vertices, flags. +//! Geometry (curve, polygon) accessed via rep indices into Storage vectors. +struct EdgeDef : public BaseDef +{ + using TypeId = BRepGraph_EdgeId; + + //! Typed representation id into Storage::myCurves3D (invalid for degenerate edges). + BRepGraph_Curve3DRepId Curve3DRepId; + + //! Curve parameter range. + double ParamFirst = 0.0; + double ParamLast = 0.0; + + //! Tolerance from BRep_TEdge. + double Tolerance = 0.0; + + //! True if this edge collapses to a point on the surface. + bool IsDegenerate = false; + + //! True if all PCurves are reparametrized to the same range as the 3D curve. + bool SameParameter = false; + + //! True if the PCurve parameter range equals the 3D curve parameter range. + bool SameRange = false; + + //! True if StartVertex == EndVertex (topological loop, e.g. circle edge). + bool IsClosed = false; + + //! Boundary vertex reference ids (indices into VertexRef table). + //! For closed edges, the start and end ref entries point to the same VertexDefId. + BRepGraph_VertexRefId StartVertexRefId; + BRepGraph_VertexRefId EndVertexRefId; + + //! Additional vertex reference ids with INTERNAL or EXTERNAL orientation. + //! Edges with only FORWARD/REVERSED boundary vertices leave this empty. + NCollection_DynamicArray InternalVertexRefIds; + + //! Typed representation id into Storage::myPolygons3D (invalid if no polygon). + BRepGraph_Polygon3DRepId Polygon3DRepId; + + //! Reinitialize inner vectors with the given allocator. + void InitVectors(const occ::handle& theAlloc) + { + InitVec(InternalVertexRefIds, theAlloc, 2); // typically 0 + } +}; + +//! CoEdge entity: use of an edge on a specific face, owns PCurve data. +//! +//! Each coedge represents one edge-face binding with its parametric curve. +//! Wires reference coedges rather than edges directly. +//! Seam edges produce two coedges on the same face with opposite Orientation; +//! the seam relation is queryable via BRepGraph_Tool::CoEdge::SeamPair. +struct CoEdgeDef : public BaseDef +{ + using TypeId = BRepGraph_CoEdgeId; + + BRepGraph_EdgeId EdgeDefId; //!< Parent edge definition id + BRepGraph_FaceId FaceDefId; //!< Face this coedge belongs to (invalid for free wires) + TopAbs_Orientation Orientation = TopAbs_FORWARD; //!< Orientation relative to parent edge + + //! Typed representation id into Storage::myCurves2D (invalid for free-wire coedges). + BRepGraph_Curve2DRepId Curve2DRepId; + double ParamFirst = 0.0; + double ParamLast = 0.0; + gp_Pnt2d UV1; //!< UV at ParamFirst + gp_Pnt2d UV2; //!< UV at ParamLast + + //! Typed representation id into Storage::myPolygons2D (invalid if no polygon-on-surface). + BRepGraph_Polygon2DRepId Polygon2DRepId; + + //! Typed representation id into Storage::myPolygonsOnTri (persistent/imported). + BRepGraph_PolygonOnTriRepId PolygonOnTriRepId; + + void InitVectors(const occ::handle&) {} +}; + +//! Wire entity: ordered coedge references with closure flag. +struct WireDef : public BaseDef +{ + using TypeId = BRepGraph_WireId; + + bool IsClosed = false; + NCollection_DynamicArray CoEdgeRefIds; //!< Ordered coedge ref indices + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(CoEdgeRefIds, theAlloc, 8); // typically 3-8 coedges per wire + } +}; + +//! Face entity: surface, triangulations, wires. +struct FaceDef : public BaseDef +{ + using TypeId = BRepGraph_FaceId; + + BRepGraph_SurfaceRepId SurfaceRepId; //!< Typed id into mySurfaces + BRepGraph_TriangulationRepId + TriangulationRepId; //!< Typed id into myTriangulations (persistent/imported) + + double Tolerance = 0.0; + bool NaturalRestriction = false; + + NCollection_DynamicArray WireRefIds; //!< Wire ref indices (outer first) + + //! Direct INTERNAL/EXTERNAL vertex children (not inside wires). + //! Boundary vertices are normally reached through WireRefIds -> CoEdgeRefIds + //! -> CoEdgeDef.EdgeDefId -> EdgeDef.{StartVertexRefId, EndVertexRefId}. + //! This vector is for additional direct face-owned vertex usage. + NCollection_DynamicArray VertexRefIds; + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(WireRefIds, theAlloc, 2); // typically 1-2 (outer + holes) + InitVec(VertexRefIds, theAlloc, 2); // typically 0 + } +}; + +//! Shell entity: ordered face references with local locations. +struct ShellDef : public BaseDef +{ + using TypeId = BRepGraph_ShellId; + + bool IsClosed = false; //!< True if shell forms a watertight (closed) boundary. + NCollection_DynamicArray FaceRefIds; //!< Face ref indices + NCollection_DynamicArray + AuxChildRefIds; //!< Non-face children (wires, edges) + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(FaceRefIds, theAlloc, 8); // typically 4-8 faces per shell + InitVec(AuxChildRefIds, theAlloc, 2); // typically 0 + } +}; + +//! Solid entity: ordered shell references with local locations. +struct SolidDef : public BaseDef +{ + using TypeId = BRepGraph_SolidId; + + NCollection_DynamicArray ShellRefIds; //!< Shell ref indices + NCollection_DynamicArray + AuxChildRefIds; //!< Non-shell children (edges, vertices) + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(ShellRefIds, theAlloc, 2); // typically 1 + InitVec(AuxChildRefIds, theAlloc, 2); // typically 0 + } +}; + +//! Compound entity: heterogeneous child references. +struct CompoundDef : public BaseDef +{ + using TypeId = BRepGraph_CompoundId; + + NCollection_DynamicArray ChildRefIds; //!< Child ref indices + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(ChildRefIds, theAlloc, 4); + } +}; + +//! Comp-solid entity: ordered solid references. +struct CompSolidDef : public BaseDef +{ + using TypeId = BRepGraph_CompSolidId; + + NCollection_DynamicArray SolidRefIds; //!< Solid ref indices + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(SolidRefIds, theAlloc, 2); + } +}; + +//! Product entity: reusable shape definition (part or assembly). +//! Children are managed uniformly via OccurrenceRefIds: +//! - A part product has one occurrence whose ChildDefId is a topology root node. +//! - An assembly product has occurrences whose ChildDefId values are other products. +//! Products carry no location or orientation - those live on references. +struct ProductDef : public BaseDef +{ + using TypeId = BRepGraph_ProductId; + + NCollection_DynamicArray + OccurrenceRefIds; //!< All children (shape roots and sub-products) + + void InitVectors(const occ::handle& theAlloc) + { + InitVec(OccurrenceRefIds, theAlloc, 4); + } +}; + +//! Occurrence entity: reference to a child node (topology root or product). +//! The parent product is determined from OccurrenceRef::ParentId (BaseRef). +//! Placement lives on OccurrenceRef::LocalLocation (definitions never carry location). +//! Path-based traversal (PathView::ForEachPathTo) resolves DAG paths without +//! stored parent-occurrence pointers. +struct OccurrenceDef : public BaseDef +{ + using TypeId = BRepGraph_OccurrenceId; + + BRepGraph_NodeId ChildDefId; //!< Referenced child node (topology root or product) + + //! No-op: OccurrenceDef has no inner vectors to reinitialize. + //! Present for uniform DefStore::Append() logic. + void InitVectors(const occ::handle&) {} +}; + +} // namespace BRepGraphInc + +#endif // _BRepGraphInc_Definition_HeaderFile diff --git a/opencascade/BRepGraphInc_Instance.hxx b/opencascade/BRepGraphInc_Instance.hxx new file mode 100644 index 000000000..05e6dcecd --- /dev/null +++ b/opencascade/BRepGraphInc_Instance.hxx @@ -0,0 +1,92 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Instance_HeaderFile +#define _BRepGraphInc_Instance_HeaderFile + +#include +#include +#include +#include + +#include + +//! @file BRepGraphInc_Instance.hxx +//! @brief Unified lightweight container binding a node identity with placement. +//! +//! Instance is the BRepGraph analogue of TopoDS_Shape: a lightweight value type +//! that bundles a definition id with its location and orientation in context. +//! +//! Supports C++17 structured bindings (aggregate type): +//! @code +//! for (auto [aDefId, aLoc, anOri] : BRepGraph_ChildExplorer(aGraph, aRoot, Kind::Face)) +//! { +//! // ... +//! } +//! @endcode +namespace BRepGraphInc +{ + +//! @brief Unified instance container template. +//! +//! Bundles a typed definition id with location and orientation. +//! +//! @tparam TypedIdT typed definition id (e.g. BRepGraph_FaceId, BRepGraph_NodeId). +template +struct Instance +{ + TypedIdT DefId; + TopLoc_Location Location; + TopAbs_Orientation Orientation = TopAbs_FORWARD; +}; + +using VertexInstance = Instance; +using CoEdgeInstance = Instance; +using FaceInstance = Instance; +using ShellInstance = Instance; +using SolidInstance = Instance; +using OccurrenceInstance = Instance; +using CompoundInstance = Instance; +using CompSolidInstance = Instance; +using ProductInstance = Instance; + +//! NodeInstance is Instance. +//! Returned by BRepGraph_ChildExplorer and BRepGraph_ParentExplorer +//! with accumulated transforms from traversal root to the current node. +//! Implicitly convertible from any typed Instance via BRepGraph_NodeId::Typed +//! implicit conversion to BRepGraph_NodeId. +using NodeInstance = Instance; + +//! Wire instance with an additional flag indicating whether this is the outer wire. +struct WireInstance : Instance +{ + bool IsOuter = false; +}; + +} // namespace BRepGraphInc + +//! std::hash specialization for BRepGraphInc::Instance. +template +struct std::hash> +{ + size_t operator()(const BRepGraphInc::Instance& theInstance) const noexcept + { + size_t aCombination[3]; + aCombination[0] = std::hash{}(theInstance.DefId); + aCombination[1] = theInstance.Location.HashCode(); + aCombination[2] = opencascade::hash(static_cast(theInstance.Orientation)); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; + +#endif // _BRepGraphInc_Instance_HeaderFile diff --git a/opencascade/BRepGraphInc_Populate.hxx b/opencascade/BRepGraphInc_Populate.hxx new file mode 100644 index 000000000..010eee225 --- /dev/null +++ b/opencascade/BRepGraphInc_Populate.hxx @@ -0,0 +1,127 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Populate_HeaderFile +#define _BRepGraphInc_Populate_HeaderFile + +#include + +#include +#include +#include + +class TopoDS_Shape; +class BRepGraphInc_Storage; +class BRepGraph_LayerParam; +class BRepGraph_LayerRegularity; + +//! @brief Backend population pipeline for BRepGraphInc_Storage. +//! +//! This class is part of the BRepGraphInc backend and is intended for +//! backend maintenance, tests, and low-level infrastructure only. +//! External code should enter through BRepGraph_Builder::Add(), which owns the +//! public lifecycle, cache invalidation, and layer coordination. +//! +//! Adapted from BRepGraph_Builder, but writes to incidence-table storage +//! instead of Def/Usage two-layer storage. Entity structs carry forward +//! child references directly (no separate Usage objects). +//! +//! The population pipeline: +//! 1. Sequential hierarchy traversal (Compound/CompSolid/Solid/Shell) +//! 2. Parallel per-face geometry extraction +//! 3. Sequential registration with TShape deduplication +//! 4. Reverse index construction +class BRepGraphInc_Populate +{ +public: + DEFINE_STANDARD_ALLOC + + //! Options controlling which post-passes are executed during population. + struct Options + { + bool ExtractRegularities; //!< Phase 3b: edge regularities + bool ExtractVertexPointReps; //!< Phase 3c: vertex point representations + + Options() + : ExtractRegularities(true), + ExtractVertexPointReps(true) + { + } + }; + + //! Build backend incidence storage from a TopoDS_Shape. + //! @param[out] theStorage storage to populate (cleared first) + //! @param[in] theShape root shape + //! @param[in] theParallel if true, face-level extraction runs in parallel + //! @param[in] theOptions optional post-pass controls + //! @param[in] theParamLayer optional point-rep layer to populate + //! @param[in] theRegularityLayer optional edge-regularity layer to populate + //! @param[in] theTmpAlloc optional allocator for temporary scratch data + static Standard_EXPORT void Perform( + BRepGraphInc_Storage& theStorage, + const TopoDS_Shape& theShape, + const bool theParallel, + const Options& theOptions = Options(), + const occ::handle& theParamLayer = occ::handle(), + const occ::handle& theRegularityLayer = + occ::handle(), + const occ::handle& theTmpAlloc = + occ::handle()); + + //! Extend existing backend storage with additional shapes (no clear). + //! Flattens hierarchy containers away; Solid/Shell/Compound/CompSolid inputs + //! contribute appended face roots instead of container entities. + //! Recomputes the built-in metadata layers from the populated storage. + //! @param[in,out] theStorage storage to extend + //! @param[in] theShape shape to append + //! @param[in] theParallel if true, face-level extraction runs in parallel + //! @param[out] theAppendedRoots collected root NodeIds for non-container shapes + //! @param[in] theOptions optional post-pass controls + //! @param[in] theTmpAlloc optional allocator for temporary scratch data + static Standard_EXPORT void AppendFlattened( + BRepGraphInc_Storage& theStorage, + const TopoDS_Shape& theShape, + const bool theParallel, + NCollection_DynamicArray& theAppendedRoots, + const Options& theOptions = Options(), + const occ::handle& theParamLayer = occ::handle(), + const occ::handle& theRegularityLayer = + occ::handle(), + const occ::handle& theTmpAlloc = + occ::handle()); + + //! Extend existing backend storage with additional shapes (no clear). + //! Preserves the full shape hierarchy: Solid/Shell/Compound/CompSolid nodes + //! are created alongside Face/Edge/Vertex nodes. Shapes already present in + //! the storage (same TShape pointer) are deduplicated and not re-added. + //! @param[in,out] theStorage storage to extend + //! @param[in] theShape shape to append + //! @param[in] theParallel if true, face-level extraction runs in parallel + //! @param[in] theOptions optional post-pass controls + //! @param[in] theTmpAlloc optional allocator for temporary scratch data + static Standard_EXPORT void Append( + BRepGraphInc_Storage& theStorage, + const TopoDS_Shape& theShape, + const bool theParallel, + const Options& theOptions = Options(), + const occ::handle& theParamLayer = occ::handle(), + const occ::handle& theRegularityLayer = + occ::handle(), + const occ::handle& theTmpAlloc = + occ::handle()); + +private: + BRepGraphInc_Populate() = delete; +}; + +#endif // _BRepGraphInc_Populate_HeaderFile diff --git a/opencascade/BRepGraphInc_Reconstruct.hxx b/opencascade/BRepGraphInc_Reconstruct.hxx new file mode 100644 index 000000000..9fbd374b8 --- /dev/null +++ b/opencascade/BRepGraphInc_Reconstruct.hxx @@ -0,0 +1,153 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Reconstruct_HeaderFile +#define _BRepGraphInc_Reconstruct_HeaderFile + +#include +#include +#include +#include + +#include + +class BRepGraphInc_Storage; +class BRepGraph_LayerParam; +class BRepGraph_LayerRegularity; + +//! @brief Backend reconstruction helpers over incidence-table storage. +//! +//! Converts BRepGraphInc_Storage entity data back into TopoDS shapes. +//! This class is part of the BRepGraphInc backend; external callers should +//! prefer BRepGraph::Shapes() so reconstruction stays behind the facade. +//! Supports single-node and cached multi-face reconstruction with +//! shared edge/vertex reuse via the Cache. +class BRepGraphInc_Reconstruct +{ +public: + DEFINE_STANDARD_ALLOC + + //! Per-Kind dense vector cache for O(1) shape lookup by entity index. + //! Replaces NCollection_DataMap to eliminate hash/equality overhead. + struct Cache + { + //! Number of Kind slots used by BRepGraph_NodeId dense-kind indexing. + //! Includes topology kinds, assembly kinds, and the reserved gap at kind 9. + static constexpr int THE_KIND_COUNT = BRepGraph_NodeId::THE_KIND_COUNT; + static constexpr int THE_DEFAULT_INCREMENT = 32; + + occ::handle myAllocator; + occ::handle myTempAllocator; + NCollection_DynamicArray myKinds[THE_KIND_COUNT]; + int myTempScopeDepth = 0; + + struct TempScope + { + Cache& myCache; + + explicit TempScope(Cache& theCache) + : myCache(theCache) + { + if (myCache.myTempScopeDepth == 0 && !myCache.myTempAllocator.IsNull()) + myCache.myTempAllocator->Reset(false); + ++myCache.myTempScopeDepth; + } + + ~TempScope() + { + --myCache.myTempScopeDepth; + if (myCache.myTempScopeDepth == 0 && !myCache.myTempAllocator.IsNull()) + myCache.myTempAllocator->Reset(false); + } + }; + + Cache() + : myAllocator(new NCollection_IncAllocator()), + myTempAllocator(new NCollection_IncAllocator()) + { + for (int aKindIdx = 0; aKindIdx < THE_KIND_COUNT; ++aKindIdx) + { + myKinds[aKindIdx] = + NCollection_DynamicArray(THE_DEFAULT_INCREMENT, myAllocator); + } + } + + //! Seek a cached shape. Returns nullptr if not yet cached. + const TopoDS_Shape* Seek(const BRepGraph_NodeId theNode) const + { + const int aKindIdx = static_cast(theNode.NodeKind); + if (aKindIdx < 0 || aKindIdx >= THE_KIND_COUNT) + return nullptr; + const NCollection_DynamicArray& aVec = myKinds[aKindIdx]; + if (theNode.Index >= aVec.Size()) + return nullptr; + const TopoDS_Shape& aShape = aVec.Value(static_cast(theNode.Index)); + return aShape.IsNull() ? nullptr : &aShape; + } + + //! Bind a reconstructed shape to a node. Grows the vector as needed. + void Bind(const BRepGraph_NodeId theNode, const TopoDS_Shape& theShape) + { + const int aKindIdx = static_cast(theNode.NodeKind); + if (aKindIdx < 0 || aKindIdx >= THE_KIND_COUNT) + return; + NCollection_DynamicArray& aVec = myKinds[aKindIdx]; + aVec.SetValue(static_cast(theNode.Index), theShape); + } + + //! Check if a node is already cached. + bool IsBound(const BRepGraph_NodeId theNode) const { return Seek(theNode) != nullptr; } + }; + + //! Reconstruct a TopoDS_Shape from an entity node. + //! Creates a local cache internally; shared vertices/edges are not reused + //! across calls. + //! @param[in] theStorage incidence storage + //! @param[in] theNode entity node id + //! @return reconstructed shape + static Standard_EXPORT TopoDS_Shape + Node(const BRepGraphInc_Storage& theStorage, + const BRepGraph_NodeId theNode, + const BRepGraph_LayerParam* theParams = nullptr, + const BRepGraph_LayerRegularity* theRegularities = nullptr); + + //! Reconstruct a TopoDS_Shape with a shared cache for sub-shape reuse. + //! Vertices and edges already in theCache are returned directly. + //! @param[in] theStorage incidence storage + //! @param[in] theNode entity node id + //! @param[in,out] theCache shared cache for vertex/edge/face shapes + //! @return reconstructed shape + static Standard_EXPORT TopoDS_Shape + Node(const BRepGraphInc_Storage& theStorage, + const BRepGraph_NodeId theNode, + Cache& theCache, + const BRepGraph_LayerParam* theParams = nullptr, + const BRepGraph_LayerRegularity* theRegularities = nullptr); + + //! Reconstruct a face with shared edge/vertex cache for multi-face contexts. + //! @param[in] theStorage incidence storage + //! @param[in] theFaceId face entity id + //! @param[in,out] theCache shared cache for edge and vertex shapes + //! @return reconstructed face shape + static Standard_EXPORT TopoDS_Shape + FaceWithCache(const BRepGraphInc_Storage& theStorage, + const BRepGraph_FaceId theFaceId, + Cache& theCache, + const BRepGraph_LayerParam* theParams = nullptr, + const BRepGraph_LayerRegularity* theRegularities = nullptr); + +private: + BRepGraphInc_Reconstruct() = delete; +}; + +#endif // _BRepGraphInc_Reconstruct_HeaderFile diff --git a/opencascade/BRepGraphInc_Reference.hxx b/opencascade/BRepGraphInc_Reference.hxx new file mode 100644 index 000000000..a4c8f1b71 --- /dev/null +++ b/opencascade/BRepGraphInc_Reference.hxx @@ -0,0 +1,136 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Reference_HeaderFile +#define _BRepGraphInc_Reference_HeaderFile + +#include +#include +#include +#include + +//! @brief Managed reference entry structs for the incidence-table storage. +//! +//! Each reference entry extends BaseRef with payload fields describing +//! how a child definition is used by its parent (orientation, location). +//! Reference entries are stored in flat per-kind vectors in BRepGraphInc_Storage +//! and support mutation tracking and soft-removal. +//! Not every definition kind has a dedicated Ref kind by design: +//! - Edge usage is represented by CoEdgeRef -> CoEdgeDef (which then targets EdgeDef) +//! - Compound children use ChildRef (heterogeneous NodeId target) +//! - Product children use OccurrenceRef (placement owned by OccurrenceDef) +//! - CompSolid children use SolidRef +//! +//! For lightweight read-only projections without lifecycle fields, see +//! BRepGraphInc_Instance.hxx (Instance structs carry only DefId + Orientation + Location). +namespace BRepGraphInc +{ + +//! Fields shared by every reference entry. +struct BaseRef +{ + using TypeId = BRepGraph_RefId; + + BRepGraph_NodeId ParentId; //!< Parent topology node owning this reference usage + uint32_t OwnGen = 0; //!< Per-reference mutation counter + bool IsRemoved = false; //!< Soft-removal flag +}; + +//! Shell reference storage entry. +struct ShellRef : public BaseRef +{ + using TypeId = BRepGraph_ShellRefId; + + BRepGraph_ShellId ShellDefId; + TopAbs_Orientation Orientation = TopAbs_FORWARD; + TopLoc_Location LocalLocation; +}; + +//! Face reference storage entry. +struct FaceRef : public BaseRef +{ + using TypeId = BRepGraph_FaceRefId; + + BRepGraph_FaceId FaceDefId; + TopAbs_Orientation Orientation = TopAbs_FORWARD; + TopLoc_Location LocalLocation; +}; + +//! Wire reference storage entry. +struct WireRef : public BaseRef +{ + using TypeId = BRepGraph_WireRefId; + + BRepGraph_WireId WireDefId; + bool IsOuter = false; + TopAbs_Orientation Orientation = TopAbs_FORWARD; + TopLoc_Location LocalLocation; +}; + +//! CoEdge reference storage entry. +//! No Orientation field: CoEdgeDef::Orientation already owns the edge-on-face sense, +//! coupled with PCurve parametrization, so duplicating orientation here would +//! create a second competing source of truth. +struct CoEdgeRef : public BaseRef +{ + using TypeId = BRepGraph_CoEdgeRefId; + + BRepGraph_CoEdgeId CoEdgeDefId; + TopLoc_Location LocalLocation; +}; + +//! Vertex reference storage entry. +struct VertexRef : public BaseRef +{ + using TypeId = BRepGraph_VertexRefId; + + BRepGraph_VertexId VertexDefId; + TopAbs_Orientation Orientation = + TopAbs_INTERNAL; //!< INTERNAL: B-Rep vertex classification convention + TopLoc_Location LocalLocation; +}; + +//! Solid reference storage entry. +struct SolidRef : public BaseRef +{ + using TypeId = BRepGraph_SolidRefId; + + BRepGraph_SolidId SolidDefId; + TopAbs_Orientation Orientation = TopAbs_FORWARD; + TopLoc_Location LocalLocation; +}; + +//! Child reference storage entry. +struct ChildRef : public BaseRef +{ + using TypeId = BRepGraph_ChildRefId; + + BRepGraph_NodeId ChildDefId; + TopAbs_Orientation Orientation = TopAbs_FORWARD; + TopLoc_Location LocalLocation; +}; + +//! Occurrence reference storage entry. +//! Like ChildRef but without Orientation - placement is a reference property. +//! Structurally parallel to other ref types: definitions carry no location. +struct OccurrenceRef : public BaseRef +{ + using TypeId = BRepGraph_OccurrenceRefId; + + BRepGraph_OccurrenceId OccurrenceDefId; + TopLoc_Location LocalLocation; //!< Placement relative to parent product +}; + +} // namespace BRepGraphInc + +#endif // _BRepGraphInc_Reference_HeaderFile diff --git a/opencascade/BRepGraphInc_Representation.hxx b/opencascade/BRepGraphInc_Representation.hxx new file mode 100644 index 000000000..58e7b44fa --- /dev/null +++ b/opencascade/BRepGraphInc_Representation.hxx @@ -0,0 +1,105 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Representation_HeaderFile +#define _BRepGraphInc_Representation_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include + +//! @brief Geometry and mesh representation structs for the incidence-table model. +//! +//! Each representation struct wraps a single piece of geometry or discretization +//! data (surface, curve, triangulation, polygon) with a typed RepId address +//! and lifecycle tracking fields. Representations are stored in flat per-kind +//! vectors in BRepGraphInc_Storage and referenced from definitions by typed RepId. +namespace BRepGraphInc +{ + +//! Fields shared by every representation entity. +struct BaseRep +{ + using TypeId = BRepGraph_RepId; + + uint32_t OwnGen = 0; //!< Per-rep mutation counter + bool IsRemoved = false; //!< Soft-removal flag +}; + +//! Surface geometry representation for faces. +struct SurfaceRep : public BaseRep +{ + using TypeId = BRepGraph_SurfaceRepId; + + occ::handle Surface; //!< The geometric surface +}; + +//! 3D curve geometry representation for edges. +struct Curve3DRep : public BaseRep +{ + using TypeId = BRepGraph_Curve3DRepId; + + occ::handle Curve; //!< The 3D curve geometry +}; + +//! 2D parametric curve (PCurve) representation for coedges. +struct Curve2DRep : public BaseRep +{ + using TypeId = BRepGraph_Curve2DRepId; + + occ::handle Curve; //!< The 2D parametric curve +}; + +//! Triangulation mesh representation for faces. +struct TriangulationRep : public BaseRep +{ + using TypeId = BRepGraph_TriangulationRepId; + + occ::handle Triangulation; //!< The mesh +}; + +//! 3D polygon discretization for edges. +struct Polygon3DRep : public BaseRep +{ + using TypeId = BRepGraph_Polygon3DRepId; + + occ::handle Polygon; //!< The 3D polygon +}; + +//! 2D polygon-on-surface discretization for coedges. +struct Polygon2DRep : public BaseRep +{ + using TypeId = BRepGraph_Polygon2DRepId; + + occ::handle Polygon; //!< The 2D polygon on surface parametric space +}; + +//! Polygon-on-triangulation for coedges. +//! Links a polygon to a specific triangulation rep (global index, not face-local). +struct PolygonOnTriRep : public BaseRep +{ + using TypeId = BRepGraph_PolygonOnTriRepId; + + occ::handle Polygon; //!< Polygon indices into triangulation + BRepGraph_TriangulationRepId TriangulationRepId; //!< Typed id into myTriangulationsRep +}; + +} // namespace BRepGraphInc + +#endif // _BRepGraphInc_Representation_HeaderFile diff --git a/opencascade/BRepGraphInc_ReverseIndex.hxx b/opencascade/BRepGraphInc_ReverseIndex.hxx new file mode 100644 index 000000000..95379e9ef --- /dev/null +++ b/opencascade/BRepGraphInc_ReverseIndex.hxx @@ -0,0 +1,618 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_ReverseIndex_HeaderFile +#define _BRepGraphInc_ReverseIndex_HeaderFile + +#include +#include +#include +#include + +class BRepGraphInc_Storage; + +namespace BRepGraphInc +{ +struct VertexDef; +struct EdgeDef; +struct CoEdgeDef; +struct WireDef; +struct FaceDef; +struct ShellDef; +struct SolidDef; +struct CompoundDef; +struct CompSolidDef; +struct ProductDef; +struct OccurrenceDef; +struct ShellRef; +struct FaceRef; +struct WireRef; +struct CoEdgeRef; +struct SolidRef; +struct ChildRef; +struct VertexRef; +} // namespace BRepGraphInc + +//! @brief Backend reverse incidence indices for O(1) upward navigation. +//! +//! Built from entity and reference-entry tables after population. +//! Full ReverseIndex::Build() is used for initial construction, while builder-side +//! mutations maintain the index incrementally through targeted bind/unbind +//! operations and ReverseIndex::BuildDelta() for append workflows. +//! +//! ## Two query tiers +//! Pointer-returning methods (e.g. WiresOfEdge() -> nullptr for empty) serve +//! performance-critical backend code that avoids static-empty-vector overhead. +//! Safe-reference methods (e.g. WiresOfEdgeRef() -> static empty vector) serve +//! the public facade (TopoView delegates to Ref variants). +class BRepGraphInc_ReverseIndex +{ +public: + DEFINE_STANDARD_ALLOC + + //! Set allocator for internal index tables. + void SetAllocator(const occ::handle& theAlloc) + { + myAllocator = theAlloc; + } + + //! Clear all indices. + Standard_EXPORT void Clear(); + + //! Rebuild all reverse indices from storage tables. + //! Thin wrapper over the explicit-table overload retained for compatibility. + Standard_EXPORT void Build(const BRepGraphInc_Storage& theStorage); + + //! Rebuild all reverse indices from the entity and reference-entry tables. + //! Edge-to-face index is derived from CoEdge.FaceDefId links. + //! @pre SetAllocator() must have been called (uses myAllocator for inner vectors). + //! @param[in] theEdges edge entity vector (for vertex-to-edge, edge-to-face) + //! @param[in] theCoEdges coedge entity vector (for edge-to-coedge and edge-to-face) + //! @param[in] theWires wire entity vector (parent validation for coedge refs) + //! @param[in] theFaces face entity vector (parent validation for wire refs) + //! @param[in] theShells shell entity vector (parent validation for face refs) + //! @param[in] theSolids solid entity vector (parent validation for shell refs) + //! @param[in] theCompounds compound entity vector (parent validation for child refs) + //! @param[in] theCompSolids compsolid entity vector (parent validation for solid refs) + //! @param[in] theShellRefs shell ref-entry table (solid -> shell reverse) + //! @param[in] theFaceRefs face ref-entry table (shell -> face reverse) + //! @param[in] theWireRefs wire ref-entry table (face -> wire reverse) + //! @param[in] theCoEdgeRefs coedge ref-entry table (wire -> coedge/edge reverse) + //! @param[in] theSolidRefs solid ref-entry table (compsolid -> solid reverse) + //! @param[in] theChildRefs child ref-entry table (compound child reverse) + //! @param[in] theVertexRefs vertex ref-entry table (edge vertex resolution) + Standard_EXPORT void Build( + const NCollection_DynamicArray& theVertices, + const NCollection_DynamicArray& theEdges, + const NCollection_DynamicArray& theCoEdges, + const NCollection_DynamicArray& theWires, + const NCollection_DynamicArray& theFaces, + const NCollection_DynamicArray& theShells, + const NCollection_DynamicArray& theSolids, + const NCollection_DynamicArray& theCompounds, + const NCollection_DynamicArray& theCompSolids, + const NCollection_DynamicArray& theShellRefs, + const NCollection_DynamicArray& theFaceRefs, + const NCollection_DynamicArray& theWireRefs, + const NCollection_DynamicArray& theCoEdgeRefs, + const NCollection_DynamicArray& theSolidRefs, + const NCollection_DynamicArray& theChildRefs, + const NCollection_DynamicArray& theVertexRefs); + + //! Incrementally update reverse indices for entities/ref-parents appended after a previous + //! ReverseIndex::Build(). Only processes entities from the old counts to the current vector + //! lengths and appended reference entries. + //! @param[in] theOldNbEdges edge count before the append operation + //! @param[in] theOldNbWires wire count before the append operation + //! @param[in] theOldNbFaces face count before the append operation + //! @param[in] theOldNbShells shell count before the append operation + //! @param[in] theOldNbSolids solid count before the append operation + //! @param[in] theOldNbCompounds compound count before the append operation + //! @param[in] theOldNbCompSolids compsolid count before the append operation + //! @param[in] theOldNbChildRefs ChildRef count before the append operation + //! @param[in] theOldNbSolidRefs SolidRef count before the append operation + Standard_EXPORT void BuildDelta( + const NCollection_DynamicArray& theVertices, + const NCollection_DynamicArray& theEdges, + const NCollection_DynamicArray& theCoEdges, + const NCollection_DynamicArray& theWires, + const NCollection_DynamicArray& theFaces, + const NCollection_DynamicArray& theShells, + const NCollection_DynamicArray& theSolids, + const NCollection_DynamicArray& theCompounds, + const NCollection_DynamicArray& theCompSolids, + const NCollection_DynamicArray& theShellRefs, + const NCollection_DynamicArray& theFaceRefs, + const NCollection_DynamicArray& theWireRefs, + const NCollection_DynamicArray& theCoEdgeRefs, + const NCollection_DynamicArray& theSolidRefs, + const NCollection_DynamicArray& theChildRefs, + const NCollection_DynamicArray& theVertexRefs, + const uint32_t theOldNbEdges, + const uint32_t theOldNbWires, + const uint32_t theOldNbFaces, + const uint32_t theOldNbShells, + const uint32_t theOldNbSolids, + const uint32_t theOldNbCompounds, + const uint32_t theOldNbCompSolids, + const uint32_t theOldNbChildRefs, + const uint32_t theOldNbSolidRefs); + + //! Build product-to-occurrences reverse index. + //! @param[in] theOccurrences occurrence entity vector + //! @param[in] theNbProducts total number of products (for pre-sizing) + Standard_EXPORT void BuildProductOccurrences( + const NCollection_DynamicArray& theOccurrences, + const uint32_t theNbProducts); + + //! Return wire indices containing the given edge. + [[nodiscard]] const NCollection_DynamicArray* WiresOfEdge( + const BRepGraph_EdgeId theEdgeId) const + { + return seekVec(myEdgeToWires, theEdgeId.Index); + } + + //! Return face indices containing the given edge (derived from CoEdge.FaceDefId links). + [[nodiscard]] const NCollection_DynamicArray* FacesOfEdge( + const BRepGraph_EdgeId theEdgeId) const + { + return seekVec(myEdgeToFaces, theEdgeId.Index); + } + + //! Return coedge indices referencing the given edge. + [[nodiscard]] const NCollection_DynamicArray* CoEdgesOfEdge( + const BRepGraph_EdgeId theEdgeId) const + { + return seekVec(myEdgeToCoEdges, theEdgeId.Index); + } + + //! Return the number of faces incident to an edge - O(1). + //! Derived directly from the edge-to-faces adjacency vector to keep a single source of truth. + [[nodiscard]] uint32_t NbFacesOfEdge(const BRepGraph_EdgeId theEdgeId) const + { + const NCollection_DynamicArray* aFaces = + seekVec(myEdgeToFaces, theEdgeId.Index); + return aFaces != nullptr ? static_cast(aFaces->Size()) : 0u; + } + + //! Return edge indices incident to the given vertex. + [[nodiscard]] const NCollection_DynamicArray* EdgesOfVertex( + const BRepGraph_VertexId theVertexId) const + { + return seekVec(myVertexToEdges, theVertexId.Index); + } + + //! Return face indices containing the given wire. + [[nodiscard]] const NCollection_DynamicArray* FacesOfWire( + const BRepGraph_WireId theWireId) const + { + return seekVec(myWireToFaces, theWireId.Index); + } + + //! Return shell indices containing the given face. + [[nodiscard]] const NCollection_DynamicArray* ShellsOfFace( + const BRepGraph_FaceId theFaceId) const + { + return seekVec(myFaceToShells, theFaceId.Index); + } + + //! Return solid indices containing the given shell. + [[nodiscard]] const NCollection_DynamicArray* SolidsOfShell( + const BRepGraph_ShellId theShellId) const + { + return seekVec(myShellToSolids, theShellId.Index); + } + + //! Return compound indices containing the given solid as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfSolid( + const BRepGraph_SolidId theSolidId) const + { + return seekVec(myCompoundsOfSolid, theSolidId.Index); + } + + //! Return compsolid indices containing the given solid as a SolidInstance. + [[nodiscard]] const NCollection_DynamicArray* CompSolidsOfSolid( + const BRepGraph_SolidId theSolidId) const + { + return seekVec(myCompSolidsOfSolid, theSolidId.Index); + } + + //! Return compound indices containing the given shell as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfShell( + const BRepGraph_ShellId theShellId) const + { + return seekVec(myCompoundsOfShell, theShellId.Index); + } + + //! Return compound indices containing the given face as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfFace( + const BRepGraph_FaceId theFaceId) const + { + return seekVec(myCompoundsOfFace, theFaceId.Index); + } + + //! Return compound indices containing the given compound as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfCompound( + const BRepGraph_CompoundId theCompoundId) const + { + return seekVec(myCompoundsOfCompound, theCompoundId.Index); + } + + //! Return compound indices containing the given compsolid as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfCompSolid( + const BRepGraph_CompSolidId theCompSolidId) const + { + return seekVec(myCompoundsOfCompSolid, theCompSolidId.Index); + } + + //! Return compound indices containing the given wire as a NodeInstance. + //! OCCT `TopoDS_Compound` can legally hold atomic topology (wire / edge / + //! vertex); these reverse maps round-trip that case. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfWire( + const BRepGraph_WireId theWireId) const + { + return seekVec(myCompoundsOfWire, theWireId.Index); + } + + //! Return compound indices containing the given edge as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfEdge( + const BRepGraph_EdgeId theEdgeId) const + { + return seekVec(myCompoundsOfEdge, theEdgeId.Index); + } + + //! Return compound indices containing the given vertex as a NodeInstance. + [[nodiscard]] const NCollection_DynamicArray* CompoundsOfVertex( + const BRepGraph_VertexId theVertexId) const + { + return seekVec(myCompoundsOfVertex, theVertexId.Index); + } + + //! Return wire indices containing the given coedge. + [[nodiscard]] const NCollection_DynamicArray* WiresOfCoEdge( + const BRepGraph_CoEdgeId theCoEdgeId) const + { + return seekVec(myCoEdgeToWires, theCoEdgeId.Index); + } + + //! Return occurrence indices that reference the given product. + [[nodiscard]] const NCollection_DynamicArray* OccurrencesOfProduct( + const BRepGraph_ProductId theProductId) const + { + return seekVec(myProductToOccurrences, theProductId.Index); + } + + // --- Safe reference accessors (return empty vector instead of nullptr) --- + + //! Return wire indices containing the given edge (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& WiresOfEdgeRef( + const BRepGraph_EdgeId theEdgeId) const + { + return seekRef(myEdgeToWires, theEdgeId.Index); + } + + //! Return face indices containing the given edge (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& FacesOfEdgeRef( + const BRepGraph_EdgeId theEdgeId) const + { + return seekRef(myEdgeToFaces, theEdgeId.Index); + } + + //! Return coedge indices referencing the given edge (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& CoEdgesOfEdgeRef( + const BRepGraph_EdgeId theEdgeId) const + { + return seekRef(myEdgeToCoEdges, theEdgeId.Index); + } + + //! Return face indices containing the given wire (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& FacesOfWireRef( + const BRepGraph_WireId theWireId) const + { + return seekRef(myWireToFaces, theWireId.Index); + } + + //! Return edge indices incident to the given vertex (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& EdgesOfVertexRef( + const BRepGraph_VertexId theVertexId) const + { + return seekRef(myVertexToEdges, theVertexId.Index); + } + + //! Return shell indices containing the given face (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& ShellsOfFaceRef( + const BRepGraph_FaceId theFaceId) const + { + return seekRef(myFaceToShells, theFaceId.Index); + } + + //! Return solid indices containing the given shell (safe reference, never null). + [[nodiscard]] const NCollection_DynamicArray& SolidsOfShellRef( + const BRepGraph_ShellId theShellId) const + { + return seekRef(myShellToSolids, theShellId.Index); + } + + //! Verify reverse index consistency against forward entity/reference-entry tables. + //! For each forward ref (e.g., wire->edge), checks that the corresponding + //! reverse entry exists (edge->wire). Intended for debug validation. + //! @return true if all forward refs have matching reverse entries + Standard_EXPORT bool Validate( + const NCollection_DynamicArray& theVertices, + const NCollection_DynamicArray& theEdges, + const NCollection_DynamicArray& theCoEdges, + const NCollection_DynamicArray& theWires, + const NCollection_DynamicArray& theFaces, + const NCollection_DynamicArray& theShells, + const NCollection_DynamicArray& theSolids, + const NCollection_DynamicArray& theCompounds, + const NCollection_DynamicArray& theCompSolids, + const NCollection_DynamicArray& theShellRefs, + const NCollection_DynamicArray& theFaceRefs, + const NCollection_DynamicArray& theWireRefs, + const NCollection_DynamicArray& theCoEdgeRefs, + const NCollection_DynamicArray& theSolidRefs, + const NCollection_DynamicArray& theChildRefs, + const NCollection_DynamicArray& theVertexRefs) const; + + // --- Incremental mutation --- + + //! Register an edge as belonging to a wire (O(1) amortized). + Standard_EXPORT void BindEdgeToWire(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_WireId theWireId); + + //! Remove a wire from the edge-to-wire index for a given edge. + Standard_EXPORT void UnbindEdgeFromWire(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_WireId theWireId); + + //! Replace an edge in the edge-to-wire index for a specific wire. + Standard_EXPORT void ReplaceEdgeInWireMap(const BRepGraph_EdgeId theOldEdgeId, + const BRepGraph_EdgeId theNewEdgeId, + const BRepGraph_WireId theWireId); + + //! Register a vertex as incident to an edge (O(1) amortized, deduplicates). + Standard_EXPORT void BindVertexToEdge(const BRepGraph_VertexId theVertexId, + const BRepGraph_EdgeId theEdgeId); + + //! Remove an edge from the vertex-to-edge index for a given vertex. + Standard_EXPORT void UnbindVertexFromEdge(const BRepGraph_VertexId theVertexId, + const BRepGraph_EdgeId theEdgeId); + + //! Register a coedge as referencing an edge (O(1) amortized). + Standard_EXPORT void BindEdgeToCoEdge(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_CoEdgeId theCoEdgeId); + + //! Remove a coedge from the edge-to-coedge index for a given edge. + Standard_EXPORT void UnbindEdgeFromCoEdge(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_CoEdgeId theCoEdgeId); + + //! Register a coedge as belonging to a wire (O(1) amortized). + Standard_EXPORT void BindCoEdgeToWire(const BRepGraph_CoEdgeId theCoEdgeId, + const BRepGraph_WireId theWireId); + + //! Remove a wire from the coedge-to-wire index for a given coedge. + Standard_EXPORT void UnbindCoEdgeFromWire(const BRepGraph_CoEdgeId theCoEdgeId, + const BRepGraph_WireId theWireId); + + //! Register an edge as belonging to a face (O(1) amortized, deduplicates). + Standard_EXPORT void BindEdgeToFace(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_FaceId theFaceId); + + //! Remove a face from the edge-to-face index for a given edge. + Standard_EXPORT void UnbindEdgeFromFace(const BRepGraph_EdgeId theEdgeId, + const BRepGraph_FaceId theFaceId); + + //! Register a wire as belonging to a face (O(1) amortized, deduplicates). + Standard_EXPORT void BindWireToFace(const BRepGraph_WireId theWireId, + const BRepGraph_FaceId theFaceId); + + //! Remove a face from the wire-to-face index for a given wire. + Standard_EXPORT void UnbindWireFromFace(const BRepGraph_WireId theWireId, + const BRepGraph_FaceId theFaceId); + + //! Register a face as belonging to a shell (O(1) amortized, deduplicates). + Standard_EXPORT void BindFaceToShell(const BRepGraph_FaceId theFaceId, + const BRepGraph_ShellId theShellId); + + //! Remove a shell from the face-to-shell index for a given face. + Standard_EXPORT void UnbindFaceFromShell(const BRepGraph_FaceId theFaceId, + const BRepGraph_ShellId theShellId); + + //! Register a shell as belonging to a solid (O(1) amortized, deduplicates). + Standard_EXPORT void BindShellToSolid(const BRepGraph_ShellId theShellId, + const BRepGraph_SolidId theSolidId); + + //! Remove a solid from the shell-to-solid index for a given shell. + Standard_EXPORT void UnbindShellFromSolid(const BRepGraph_ShellId theShellId, + const BRepGraph_SolidId theSolidId); + + //! Register a solid as belonging to a compsolid (O(1) amortized, deduplicates). + Standard_EXPORT void BindSolidToCompSolid(const BRepGraph_SolidId theSolidId, + const BRepGraph_CompSolidId theCompSolidId); + + //! Remove a compsolid from the solid-to-compsolid index for a given solid. + Standard_EXPORT void UnbindSolidFromCompSolid(const BRepGraph_SolidId theSolidId, + const BRepGraph_CompSolidId theCompSolidId); + + //! Register a child node as belonging to a compound (dispatched on NodeKind). + //! Routes to the appropriate per-kind compound reverse map. No-op for unsupported kinds. + Standard_EXPORT void BindCompoundChild(const BRepGraph_NodeId theChildDefId, + const BRepGraph_CompoundId theCompoundId); + + //! Remove a compound from the per-kind compound reverse map for a given child node. + Standard_EXPORT void UnbindCompoundChild(const BRepGraph_NodeId theChildDefId, + const BRepGraph_CompoundId theCompoundId); + + //! Register an occurrence as referencing a product (O(1) amortized, deduplicates). + Standard_EXPORT void BindProductOccurrence(const BRepGraph_OccurrenceId theOccurrenceId, + const BRepGraph_ProductId theProductId); + + //! Remove an occurrence from the product-to-occurrences index for a given product. + Standard_EXPORT void UnbindProductOccurrence(const BRepGraph_OccurrenceId theOccurrenceId, + const BRepGraph_ProductId theProductId); + +private: + //! Dense vector type: outer index = entity key, inner vector = typed adjacency list. + template + using TypedIndexTable = NCollection_DynamicArray>; + + //! Bounds-checked lookup returning nullptr for out-of-range or empty slots. + template + static const NCollection_DynamicArray* seekVec(const TypedIndexTable& theIdx, + const uint32_t theKey) + { + if (theKey >= theIdx.Size()) + return nullptr; + const NCollection_DynamicArray& aVec = theIdx.Value(static_cast(theKey)); + return aVec.IsEmpty() ? nullptr : &aVec; + } + + //! Bounds-checked lookup returning a const reference (empty vector for missing keys). + template + static const NCollection_DynamicArray& seekRef(const TypedIndexTable& theIdx, + const uint32_t theKey) + { + const NCollection_DynamicArray* aPtr = seekVec(theIdx, theKey); + if (aPtr != nullptr) + return *aPtr; + static const NCollection_DynamicArray THE_EMPTY; + return THE_EMPTY; + } + + //! Ensure theIdx has at least theSize slots (pre-sizing with empty vectors). + //! If theAlloc is non-null, inner vectors are constructed with it. + template + static void ensureSize(TypedIndexTable& theIdx, + const uint32_t theSize, + const occ::handle& theAlloc = + occ::handle()) + { + if (theSize <= theIdx.Size()) + return; + + if (!theAlloc.IsNull()) + { + for (size_t i = theIdx.Size(), aNb = static_cast(theSize); i < aNb; ++i) + { + theIdx.Append(NCollection_DynamicArray(16, theAlloc)); + } + } + else + { + for (size_t i = theIdx.Size(), aNb = static_cast(theSize); i < aNb; ++i) + { + theIdx.Appended(); + } + } + } + + //! Ensure theVec has at least theSize elements. + //! New elements are default-constructed (zero for scalar types). + template + static void ensureSize(NCollection_DynamicArray& theVec, const uint32_t theSize) + { + while (theVec.Size() < static_cast(theSize)) + { + theVec.Appended(); + } + } + + //! Resize theIdx exactly to theSize slots (clears previous content first). + template + static void preSize(TypedIndexTable& theIdx, + const uint32_t theSize, + const occ::handle& theAlloc = + occ::handle()) + { + theIdx.Clear(); + ensureSize(theIdx, theSize, theAlloc); + } + + //! Add theVal to the vector at theKey, creating if needed. Skips duplicates. + template + static void appendUnique(TypedIndexTable& theIdx, const uint32_t theKey, const T theVal) + { + if (theKey >= theIdx.Size()) + ensureSize(theIdx, theKey + 1u); + + NCollection_DynamicArray& aVec = theIdx.ChangeValue(static_cast(theKey)); + for (const T& anElem : aVec) + { + if (anElem == theVal) + return; + } + aVec.Append(theVal); + } + + //! Add theVal to the vector at theKey unconditionally (no duplicate check). + //! Used during ReverseIndex::Build() where freshly-cleared indices guarantee no duplicates. + template + static void appendDirect(TypedIndexTable& theIdx, const uint32_t theKey, const T theVal) + { + if (theKey >= theIdx.Size()) + ensureSize(theIdx, theKey + 1u); + + theIdx.ChangeValue(static_cast(theKey)).Append(theVal); + } + + //! Remove first occurrence of theVal from the vector at theKey via swap-with-last + erase-last. + //! No-op if theKey is out of range or theVal is absent. O(N) lookup, O(1) removal. + template + static void eraseSwapLast(TypedIndexTable& theIdx, const uint32_t theKey, const T theVal) + { + if (theKey >= theIdx.Size()) + return; + NCollection_DynamicArray& aVec = theIdx.ChangeValue(static_cast(theKey)); + const size_t aNb = aVec.Size(); + for (size_t i = 0; i < aNb; ++i) + { + if (aVec.Value(i) == theVal) + { + if (i + 1u < aNb) + aVec.ChangeValue(i) = aVec.Value(aNb - 1u); + aVec.EraseLast(); + return; + } + } + } + + occ::handle myAllocator; + + TypedIndexTable myEdgeToWires; + TypedIndexTable myEdgeToFaces; + TypedIndexTable myEdgeToCoEdges; + TypedIndexTable myVertexToEdges; + TypedIndexTable myWireToFaces; + TypedIndexTable myFaceToShells; + TypedIndexTable myShellToSolids; + TypedIndexTable myProductToOccurrences; + + TypedIndexTable myCompoundsOfSolid; //!< Solid -> parent Compound indices. + TypedIndexTable + myCompSolidsOfSolid; //!< Solid -> parent CompSolid indices. + TypedIndexTable myCompoundsOfShell; //!< Shell -> parent Compound indices. + TypedIndexTable myCompoundsOfFace; //!< Face -> parent Compound indices. + TypedIndexTable + myCompoundsOfCompound; //!< Compound -> parent Compound indices. + TypedIndexTable + myCompoundsOfCompSolid; //!< CompSolid -> parent Compound indices. + TypedIndexTable myCompoundsOfWire; //!< Wire -> parent Compound indices. + TypedIndexTable myCompoundsOfEdge; //!< Edge -> parent Compound indices. + TypedIndexTable myCompoundsOfVertex; //!< Vertex -> parent Compound indices. + TypedIndexTable myCoEdgeToWires; //!< CoEdge -> parent Wire indices. + + uint32_t myNbIndexedCoEdges = + 0; //!< Number of coedges indexed by ReverseIndex::Build()/BuildDelta(). +}; + +#endif // _BRepGraphInc_ReverseIndex_HeaderFile diff --git a/opencascade/BRepGraphInc_Storage.hxx b/opencascade/BRepGraphInc_Storage.hxx new file mode 100644 index 000000000..791bf56e0 --- /dev/null +++ b/opencascade/BRepGraphInc_Storage.hxx @@ -0,0 +1,1080 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraphInc_Storage_HeaderFile +#define _BRepGraphInc_Storage_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//! @brief Central backend storage container for the incidence-table topology model. +//! +//! Holds all entity vectors (Vertex through Occurrence), representation +//! vectors (Surface, Curve3D, Curve2D, Triangulation, Polygon), reverse +//! indices for O(1) upward navigation, TShape deduplication maps, original +//! shape bindings, and per-kind UID vectors. Provides typed accessors +//! enforcing compile-time safety for backend code. External callers should +//! normally use the BRepGraph facade rather than reaching into this storage +//! directly. BRepGraphInc_Populate has friend access for efficient bulk writes +//! during graph population. +class BRepGraph_Builder; + +class BRepGraphInc_Storage +{ +public: + DEFINE_STANDARD_ALLOC + + //! Construct with allocator for internal collections. + //! If null, uses CommonBaseAllocator. + Standard_EXPORT explicit BRepGraphInc_Storage( + const occ::handle& theAlloc = + occ::handle()); + + //! Return the allocator used for internal collections. + [[nodiscard]] const occ::handle& Allocator() const + { + return myAllocator; + } + + //! Returns the total number of vertex entities (including removed). + [[nodiscard]] uint32_t NbVertices() const { return myVertices.Nb(); } + + //! Returns the total number of edge entities (including removed). + [[nodiscard]] uint32_t NbEdges() const { return myEdges.Nb(); } + + //! Returns the total number of coedge entities (including removed). + [[nodiscard]] uint32_t NbCoEdges() const { return myCoEdges.Nb(); } + + //! Returns the total number of wire entities (including removed). + [[nodiscard]] uint32_t NbWires() const { return myWires.Nb(); } + + //! Returns the total number of face entities (including removed). + [[nodiscard]] uint32_t NbFaces() const { return myFaces.Nb(); } + + //! Returns the total number of shell entities (including removed). + [[nodiscard]] uint32_t NbShells() const { return myShells.Nb(); } + + //! Returns the total number of solid entities (including removed). + [[nodiscard]] uint32_t NbSolids() const { return mySolids.Nb(); } + + //! Returns the total number of compound entities (including removed). + [[nodiscard]] uint32_t NbCompounds() const { return myCompounds.Nb(); } + + //! Returns the total number of compsolid entities (including removed). + [[nodiscard]] uint32_t NbCompSolids() const { return myCompSolids.Nb(); } + + //! Returns the total number of product entities (including removed). + [[nodiscard]] uint32_t NbProducts() const { return myProducts.Nb(); } + + //! Returns the total number of occurrence entities (including removed). + [[nodiscard]] uint32_t NbOccurrences() const { return myOccurrences.Nb(); } + + //! Returns the total number of shell reference entries (including removed). + [[nodiscard]] uint32_t NbShellRefs() const { return myShellRefs.Nb(); } + + //! Returns the total number of face reference entries (including removed). + [[nodiscard]] uint32_t NbFaceRefs() const { return myFaceRefs.Nb(); } + + //! Returns the total number of wire reference entries (including removed). + [[nodiscard]] uint32_t NbWireRefs() const { return myWireRefs.Nb(); } + + //! Returns the total number of coedge reference entries (including removed). + [[nodiscard]] uint32_t NbCoEdgeRefs() const { return myCoEdgeRefs.Nb(); } + + //! Returns the total number of vertex reference entries (including removed). + [[nodiscard]] uint32_t NbVertexRefs() const { return myVertexRefs.Nb(); } + + //! Returns the total number of solid reference entries (including removed). + [[nodiscard]] uint32_t NbSolidRefs() const { return mySolidRefs.Nb(); } + + //! Returns the total number of child reference entries (including removed). + [[nodiscard]] uint32_t NbChildRefs() const { return myChildRefs.Nb(); } + + //! Returns the total number of occurrence reference entries (including removed). + [[nodiscard]] uint32_t NbOccurrenceRefs() const { return myOccurrenceRefs.Nb(); } + + //! Returns the total number of surface representations. + [[nodiscard]] uint32_t NbSurfaces() const { return mySurfaces.Nb(); } + + //! Returns the total number of 3D curve representations. + [[nodiscard]] uint32_t NbCurves3D() const { return myCurves3D.Nb(); } + + //! Returns the total number of 2D curve representations. + [[nodiscard]] uint32_t NbCurves2D() const { return myCurves2D.Nb(); } + + //! Returns the total number of triangulation representations. + [[nodiscard]] uint32_t NbTriangulations() const { return myTriangulationsRep.Nb(); } + + //! Returns the total number of 3D polygon representations. + [[nodiscard]] uint32_t NbPolygons3D() const { return myPolygons3D.Nb(); } + + //! Returns the total number of 2D polygon representations. + [[nodiscard]] uint32_t NbPolygons2D() const { return myPolygons2D.Nb(); } + + //! Returns the total number of polygon-on-triangulation representations. + [[nodiscard]] uint32_t NbPolygonsOnTri() const { return myPolygonsOnTri.Nb(); } + + //! Returns the number of active surface representations (excluding removed). + [[nodiscard]] uint32_t NbActiveSurfaces() const { return mySurfaces.NbActive; } + + //! Returns the number of active 3D curve representations (excluding removed). + [[nodiscard]] uint32_t NbActiveCurves3D() const { return myCurves3D.NbActive; } + + //! Returns the number of active 2D curve representations (excluding removed). + [[nodiscard]] uint32_t NbActiveCurves2D() const { return myCurves2D.NbActive; } + + //! Returns the number of active triangulation representations (excluding removed). + [[nodiscard]] uint32_t NbActiveTriangulations() const { return myTriangulationsRep.NbActive; } + + //! Returns the number of active 3D polygon representations (excluding removed). + [[nodiscard]] uint32_t NbActivePolygons3D() const { return myPolygons3D.NbActive; } + + //! Returns the number of active 2D polygon representations (excluding removed). + [[nodiscard]] uint32_t NbActivePolygons2D() const { return myPolygons2D.NbActive; } + + //! Returns the number of active polygon-on-triangulation representations (excluding removed). + [[nodiscard]] uint32_t NbActivePolygonsOnTri() const { return myPolygonsOnTri.NbActive; } + + //! Returns the number of active vertex entities (excluding removed). + [[nodiscard]] uint32_t NbActiveVertices() const { return myVertices.NbActive; } + + //! Returns the number of active edge entities (excluding removed). + [[nodiscard]] uint32_t NbActiveEdges() const { return myEdges.NbActive; } + + //! Returns the number of active coedge entities (excluding removed). + [[nodiscard]] uint32_t NbActiveCoEdges() const { return myCoEdges.NbActive; } + + //! Returns the number of active wire entities (excluding removed). + [[nodiscard]] uint32_t NbActiveWires() const { return myWires.NbActive; } + + //! Returns the number of active face entities (excluding removed). + [[nodiscard]] uint32_t NbActiveFaces() const { return myFaces.NbActive; } + + //! Returns the number of active shell entities (excluding removed). + [[nodiscard]] uint32_t NbActiveShells() const { return myShells.NbActive; } + + //! Returns the number of active solid entities (excluding removed). + [[nodiscard]] uint32_t NbActiveSolids() const { return mySolids.NbActive; } + + //! Returns the number of active compound entities (excluding removed). + [[nodiscard]] uint32_t NbActiveCompounds() const { return myCompounds.NbActive; } + + //! Returns the number of active compsolid entities (excluding removed). + [[nodiscard]] uint32_t NbActiveCompSolids() const { return myCompSolids.NbActive; } + + //! Returns the number of active product entities (excluding removed). + [[nodiscard]] uint32_t NbActiveProducts() const { return myProducts.NbActive; } + + //! Returns the number of active occurrence entities (excluding removed). + [[nodiscard]] uint32_t NbActiveOccurrences() const { return myOccurrences.NbActive; } + + //! Returns the number of active shell reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveShellRefs() const { return myShellRefs.NbActive; } + + //! Returns the number of active face reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveFaceRefs() const { return myFaceRefs.NbActive; } + + //! Returns the number of active wire reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveWireRefs() const { return myWireRefs.NbActive; } + + //! Returns the number of active coedge reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveCoEdgeRefs() const { return myCoEdgeRefs.NbActive; } + + //! Returns the number of active vertex reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveVertexRefs() const { return myVertexRefs.NbActive; } + + //! Returns the number of active solid reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveSolidRefs() const { return mySolidRefs.NbActive; } + + //! Returns the number of active child reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveChildRefs() const { return myChildRefs.NbActive; } + + //! Returns the number of active occurrence reference entries (excluding removed). + [[nodiscard]] uint32_t NbActiveOccurrenceRefs() const { return myOccurrenceRefs.NbActive; } + + //! Mark an entity node as removed and decrement its active counter once. + //! @param[in] theNodeId typed entity id + //! @return true if the node transitioned from active to removed + Standard_EXPORT bool MarkRemoved(const BRepGraph_NodeId theNodeId); + + //! Mark a reference entry as removed and decrement its active counter once. + //! @param[in] theRefId typed reference id + //! @return true if the ref transitioned from active to removed + Standard_EXPORT bool MarkRemovedRef(const BRepGraph_RefId theRefId); + + //! Mark a representation entry as removed and decrement its active counter once. + //! @param[in] theRepId typed representation id + //! @return true if the representation transitioned from active to removed + Standard_EXPORT bool MarkRemovedRep(const BRepGraph_RepId theRepId); + + //! Returns the surface representation at the given typed id. + //! @param[in] theRep typed surface representation id + [[nodiscard]] const BRepGraphInc::SurfaceRep& SurfaceRep( + const BRepGraph_SurfaceRepId theRep) const + { + return mySurfaces.Get(theRep); + } + + //! Returns the 3D curve representation at the given typed id. + //! @param[in] theRep typed curve-3D representation id + [[nodiscard]] const BRepGraphInc::Curve3DRep& Curve3DRep( + const BRepGraph_Curve3DRepId theRep) const + { + return myCurves3D.Get(theRep); + } + + //! Returns the 2D curve representation at the given typed id. + //! @param[in] theRep typed curve-2D representation id + [[nodiscard]] const BRepGraphInc::Curve2DRep& Curve2DRep( + const BRepGraph_Curve2DRepId theRep) const + { + return myCurves2D.Get(theRep); + } + + //! Returns the triangulation representation at the given typed id. + //! @param[in] theRep typed triangulation representation id + [[nodiscard]] const BRepGraphInc::TriangulationRep& TriangulationRep( + const BRepGraph_TriangulationRepId theRep) const + { + return myTriangulationsRep.Get(theRep); + } + + //! Returns the 3D polygon representation at the given typed id. + //! @param[in] theRep typed polygon-3D representation id + [[nodiscard]] const BRepGraphInc::Polygon3DRep& Polygon3DRep( + const BRepGraph_Polygon3DRepId theRep) const + { + return myPolygons3D.Get(theRep); + } + + //! Returns the 2D polygon representation at the given typed id. + //! @param[in] theRep typed polygon-2D representation id + [[nodiscard]] const BRepGraphInc::Polygon2DRep& Polygon2DRep( + const BRepGraph_Polygon2DRepId theRep) const + { + return myPolygons2D.Get(theRep); + } + + //! Returns the polygon-on-triangulation representation at the given typed id. + //! @param[in] theRep typed polygon-on-triangulation representation id + [[nodiscard]] const BRepGraphInc::PolygonOnTriRep& PolygonOnTriRep( + const BRepGraph_PolygonOnTriRepId theRep) const + { + return myPolygonsOnTri.Get(theRep); + } + + //! Returns a mutable reference to the surface representation at the given typed id. + //! @param[in] theRep typed surface representation id + BRepGraphInc::SurfaceRep& ChangeSurfaceRep(const BRepGraph_SurfaceRepId theRep) + { + return mySurfaces.Change(theRep); + } + + //! Returns a mutable reference to the 3D curve representation at the given typed id. + //! @param[in] theRep typed curve-3D representation id + BRepGraphInc::Curve3DRep& ChangeCurve3DRep(const BRepGraph_Curve3DRepId theRep) + { + return myCurves3D.Change(theRep); + } + + //! Returns a mutable reference to the 2D curve representation at the given typed id. + //! @param[in] theRep typed curve-2D representation id + BRepGraphInc::Curve2DRep& ChangeCurve2DRep(const BRepGraph_Curve2DRepId theRep) + { + return myCurves2D.Change(theRep); + } + + //! Returns a mutable reference to the triangulation representation at the given typed id. + //! @param[in] theRep typed triangulation representation id + BRepGraphInc::TriangulationRep& ChangeTriangulationRep(const BRepGraph_TriangulationRepId theRep) + { + return myTriangulationsRep.Change(theRep); + } + + //! Returns a mutable reference to the 3D polygon representation at the given typed id. + //! @param[in] theRep typed polygon-3D representation id + BRepGraphInc::Polygon3DRep& ChangePolygon3DRep(const BRepGraph_Polygon3DRepId theRep) + { + return myPolygons3D.Change(theRep); + } + + //! Returns a mutable reference to the 2D polygon representation at the given typed id. + //! @param[in] theRep typed polygon-2D representation id + BRepGraphInc::Polygon2DRep& ChangePolygon2DRep(const BRepGraph_Polygon2DRepId theRep) + { + return myPolygons2D.Change(theRep); + } + + //! Returns a mutable reference to the polygon-on-triangulation representation at the given typed + //! id. + //! @param[in] theRep typed polygon-on-triangulation representation id + BRepGraphInc::PolygonOnTriRep& ChangePolygonOnTriRep(const BRepGraph_PolygonOnTriRepId theRep) + { + return myPolygonsOnTri.Change(theRep); + } + + //! Appends a new surface representation slot and returns its typed id. + BRepGraph_SurfaceRepId AppendSurfaceRep() { return mySurfaces.Append(); } + + //! Appends a new 3D curve representation slot and returns its typed id. + BRepGraph_Curve3DRepId AppendCurve3DRep() { return myCurves3D.Append(); } + + //! Appends a new 2D curve representation slot and returns its typed id. + BRepGraph_Curve2DRepId AppendCurve2DRep() { return myCurves2D.Append(); } + + //! Appends a new triangulation representation slot and returns its typed id. + BRepGraph_TriangulationRepId AppendTriangulationRep() { return myTriangulationsRep.Append(); } + + //! Appends a new 3D polygon representation slot and returns its typed id. + BRepGraph_Polygon3DRepId AppendPolygon3DRep() { return myPolygons3D.Append(); } + + //! Appends a new 2D polygon representation slot and returns its typed id. + BRepGraph_Polygon2DRepId AppendPolygon2DRep() { return myPolygons2D.Append(); } + + //! Appends a new polygon-on-triangulation representation slot and returns its typed id. + BRepGraph_PolygonOnTriRepId AppendPolygonOnTriRep() { return myPolygonsOnTri.Append(); } + + //! Returns the vertex entity at the given typed id. + //! @param[in] theVertex typed vertex id + [[nodiscard]] const BRepGraphInc::VertexDef& Vertex(const BRepGraph_VertexId theVertex) const + { + return myVertices.Get(theVertex); + } + + //! Returns the edge entity at the given typed id. + //! @param[in] theEdge typed edge id + [[nodiscard]] const BRepGraphInc::EdgeDef& Edge(const BRepGraph_EdgeId theEdge) const + { + return myEdges.Get(theEdge); + } + + //! Returns the coedge entity at the given typed id. + //! @param[in] theCoEdge typed coedge id + [[nodiscard]] const BRepGraphInc::CoEdgeDef& CoEdge(const BRepGraph_CoEdgeId theCoEdge) const + { + return myCoEdges.Get(theCoEdge); + } + + //! Returns the wire entity at the given typed id. + //! @param[in] theWire typed wire id + [[nodiscard]] const BRepGraphInc::WireDef& Wire(const BRepGraph_WireId theWire) const + { + return myWires.Get(theWire); + } + + //! Returns the face entity at the given typed id. + //! @param[in] theFace typed face id + [[nodiscard]] const BRepGraphInc::FaceDef& Face(const BRepGraph_FaceId theFace) const + { + return myFaces.Get(theFace); + } + + //! Returns the shell entity at the given typed id. + //! @param[in] theShell typed shell id + [[nodiscard]] const BRepGraphInc::ShellDef& Shell(const BRepGraph_ShellId theShell) const + { + return myShells.Get(theShell); + } + + //! Returns the solid entity at the given typed id. + //! @param[in] theSolid typed solid id + [[nodiscard]] const BRepGraphInc::SolidDef& Solid(const BRepGraph_SolidId theSolid) const + { + return mySolids.Get(theSolid); + } + + //! Returns the compound entity at the given typed id. + //! @param[in] theCompound typed compound id + [[nodiscard]] const BRepGraphInc::CompoundDef& Compound( + const BRepGraph_CompoundId theCompound) const + { + return myCompounds.Get(theCompound); + } + + //! Returns the compsolid entity at the given typed id. + //! @param[in] theCompSolid typed comp-solid id + [[nodiscard]] const BRepGraphInc::CompSolidDef& CompSolid( + const BRepGraph_CompSolidId theCompSolid) const + { + return myCompSolids.Get(theCompSolid); + } + + //! Returns the product entity at the given typed id. + //! @param[in] theProduct typed product id + [[nodiscard]] const BRepGraphInc::ProductDef& Product(const BRepGraph_ProductId theProduct) const + { + return myProducts.Get(theProduct); + } + + //! Returns the occurrence entity at the given typed id. + //! @param[in] theOccurrence typed occurrence id + [[nodiscard]] const BRepGraphInc::OccurrenceDef& Occurrence( + const BRepGraph_OccurrenceId theOccurrence) const + { + return myOccurrences.Get(theOccurrence); + } + + //! Returns the shell reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::ShellRef& ShellRef(const BRepGraph_ShellRefId theRefId) const + { + return myShellRefs.Get(theRefId); + } + + //! Returns the face reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::FaceRef& FaceRef(const BRepGraph_FaceRefId theRefId) const + { + return myFaceRefs.Get(theRefId); + } + + //! Returns the wire reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::WireRef& WireRef(const BRepGraph_WireRefId theRefId) const + { + return myWireRefs.Get(theRefId); + } + + //! Returns the coedge reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::CoEdgeRef& CoEdgeRef(const BRepGraph_CoEdgeRefId theRefId) const + { + return myCoEdgeRefs.Get(theRefId); + } + + //! Returns the vertex reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::VertexRef& VertexRef(const BRepGraph_VertexRefId theRefId) const + { + return myVertexRefs.Get(theRefId); + } + + //! Returns the solid reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::SolidRef& SolidRef(const BRepGraph_SolidRefId theRefId) const + { + return mySolidRefs.Get(theRefId); + } + + //! Returns the child reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::ChildRef& ChildRef(const BRepGraph_ChildRefId theRefId) const + { + return myChildRefs.Get(theRefId); + } + + //! Returns the occurrence reference entry at the given typed id. + [[nodiscard]] const BRepGraphInc::OccurrenceRef& OccurrenceRef( + const BRepGraph_OccurrenceRefId theRefId) const + { + return myOccurrenceRefs.Get(theRefId); + } + + //! Returns a mutable reference to the vertex entity at the given typed id. + //! @param[in] theVertex typed vertex id + BRepGraphInc::VertexDef& ChangeVertex(const BRepGraph_VertexId theVertex) + { + return myVertices.Change(theVertex); + } + + //! Returns a mutable reference to the edge entity at the given typed id. + //! @param[in] theEdge typed edge id + BRepGraphInc::EdgeDef& ChangeEdge(const BRepGraph_EdgeId theEdge) + { + return myEdges.Change(theEdge); + } + + //! Returns a mutable reference to the coedge entity at the given typed id. + //! @param[in] theCoEdge typed coedge id + BRepGraphInc::CoEdgeDef& ChangeCoEdge(const BRepGraph_CoEdgeId theCoEdge) + { + return myCoEdges.Change(theCoEdge); + } + + //! Returns a mutable reference to the wire entity at the given typed id. + //! @param[in] theWire typed wire id + BRepGraphInc::WireDef& ChangeWire(const BRepGraph_WireId theWire) + { + return myWires.Change(theWire); + } + + //! Returns a mutable reference to the face entity at the given typed id. + //! @param[in] theFace typed face id + BRepGraphInc::FaceDef& ChangeFace(const BRepGraph_FaceId theFace) + { + return myFaces.Change(theFace); + } + + //! Returns a mutable reference to the shell entity at the given typed id. + //! @param[in] theShell typed shell id + BRepGraphInc::ShellDef& ChangeShell(const BRepGraph_ShellId theShell) + { + return myShells.Change(theShell); + } + + //! Returns a mutable reference to the solid entity at the given typed id. + //! @param[in] theSolid typed solid id + BRepGraphInc::SolidDef& ChangeSolid(const BRepGraph_SolidId theSolid) + { + return mySolids.Change(theSolid); + } + + //! Returns a mutable reference to the compound entity at the given typed id. + //! @param[in] theCompound typed compound id + BRepGraphInc::CompoundDef& ChangeCompound(const BRepGraph_CompoundId theCompound) + { + return myCompounds.Change(theCompound); + } + + //! Returns a mutable reference to the compsolid entity at the given typed id. + //! @param[in] theCompSolid typed comp-solid id + BRepGraphInc::CompSolidDef& ChangeCompSolid(const BRepGraph_CompSolidId theCompSolid) + { + return myCompSolids.Change(theCompSolid); + } + + //! Returns a mutable reference to the product entity at the given typed id. + //! @param[in] theProduct typed product id + BRepGraphInc::ProductDef& ChangeProduct(const BRepGraph_ProductId theProduct) + { + return myProducts.Change(theProduct); + } + + //! Returns a mutable reference to the occurrence entity at the given typed id. + //! @param[in] theOccurrence typed occurrence id + BRepGraphInc::OccurrenceDef& ChangeOccurrence(const BRepGraph_OccurrenceId theOccurrence) + { + return myOccurrences.Change(theOccurrence); + } + + //! Returns a mutable reference to the shell reference entry at the given typed id. + BRepGraphInc::ShellRef& ChangeShellRef(const BRepGraph_ShellRefId theRefId) + { + return myShellRefs.Change(theRefId); + } + + //! Returns a mutable reference to the face reference entry at the given typed id. + BRepGraphInc::FaceRef& ChangeFaceRef(const BRepGraph_FaceRefId theRefId) + { + return myFaceRefs.Change(theRefId); + } + + //! Returns a mutable reference to the wire reference entry at the given typed id. + BRepGraphInc::WireRef& ChangeWireRef(const BRepGraph_WireRefId theRefId) + { + return myWireRefs.Change(theRefId); + } + + //! Returns a mutable reference to the coedge reference entry at the given typed id. + BRepGraphInc::CoEdgeRef& ChangeCoEdgeRef(const BRepGraph_CoEdgeRefId theRefId) + { + return myCoEdgeRefs.Change(theRefId); + } + + //! Returns a mutable reference to the vertex reference entry at the given typed id. + BRepGraphInc::VertexRef& ChangeVertexRef(const BRepGraph_VertexRefId theRefId) + { + return myVertexRefs.Change(theRefId); + } + + //! Returns a mutable reference to the solid reference entry at the given typed id. + BRepGraphInc::SolidRef& ChangeSolidRef(const BRepGraph_SolidRefId theRefId) + { + return mySolidRefs.Change(theRefId); + } + + //! Returns a mutable reference to the child reference entry at the given typed id. + BRepGraphInc::ChildRef& ChangeChildRef(const BRepGraph_ChildRefId theRefId) + { + return myChildRefs.Change(theRefId); + } + + //! Returns a mutable reference to the occurrence reference entry at the given typed id. + BRepGraphInc::OccurrenceRef& ChangeOccurrenceRef(const BRepGraph_OccurrenceRefId theRefId) + { + return myOccurrenceRefs.Change(theRefId); + } + + //! Appends a new vertex entity and returns its typed id. + BRepGraph_VertexId AppendVertex() { return myVertices.Append(myAllocator); } + + //! Appends a new edge entity and returns its typed id. + BRepGraph_EdgeId AppendEdge() { return myEdges.Append(myAllocator); } + + //! Appends a new coedge entity and returns its typed id. + BRepGraph_CoEdgeId AppendCoEdge() { return myCoEdges.Append(myAllocator); } + + //! Appends a new wire entity and returns its typed id. + BRepGraph_WireId AppendWire() { return myWires.Append(myAllocator); } + + //! Appends a new face entity and returns its typed id. + BRepGraph_FaceId AppendFace() { return myFaces.Append(myAllocator); } + + //! Appends a new shell entity and returns its typed id. + BRepGraph_ShellId AppendShell() { return myShells.Append(myAllocator); } + + //! Appends a new solid entity and returns its typed id. + BRepGraph_SolidId AppendSolid() { return mySolids.Append(myAllocator); } + + //! Appends a new compound entity and returns its typed id. + BRepGraph_CompoundId AppendCompound() { return myCompounds.Append(myAllocator); } + + //! Appends a new compsolid entity and returns its typed id. + BRepGraph_CompSolidId AppendCompSolid() { return myCompSolids.Append(myAllocator); } + + //! Appends a new product entity and returns its typed id. + BRepGraph_ProductId AppendProduct() { return myProducts.Append(myAllocator); } + + //! Appends a new occurrence entity and returns its typed id. + BRepGraph_OccurrenceId AppendOccurrence() { return myOccurrences.Append(myAllocator); } + + //! Appends a new shell reference entry and returns its typed id. + BRepGraph_ShellRefId AppendShellRef() { return myShellRefs.Append(); } + + //! Appends a new face reference entry and returns its typed id. + BRepGraph_FaceRefId AppendFaceRef() { return myFaceRefs.Append(); } + + //! Appends a new wire reference entry and returns its typed id. + BRepGraph_WireRefId AppendWireRef() { return myWireRefs.Append(); } + + //! Appends a new coedge reference entry and returns its typed id. + BRepGraph_CoEdgeRefId AppendCoEdgeRef() { return myCoEdgeRefs.Append(); } + + //! Appends a new vertex reference entry and returns its typed id. + BRepGraph_VertexRefId AppendVertexRef() { return myVertexRefs.Append(); } + + //! Appends a new solid reference entry and returns its typed id. + BRepGraph_SolidRefId AppendSolidRef() { return mySolidRefs.Append(); } + + //! Appends a new child reference entry and returns its typed id. + BRepGraph_ChildRefId AppendChildRef() { return myChildRefs.Append(); } + + //! Appends a new occurrence reference entry and returns its typed id. + BRepGraph_OccurrenceRefId AppendOccurrenceRef() { return myOccurrenceRefs.Append(); } + + //! Return the per-kind UID vector for a given Kind. + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& UIDs( + const BRepGraph_NodeId::Kind theKind) const; + + //! Return the per-kind UID vector for a given Kind (mutable). + Standard_EXPORT NCollection_DynamicArray& ChangeUIDs( + const BRepGraph_NodeId::Kind theKind); + + //! Clear all UID vectors (reset lengths to 0). + Standard_EXPORT void ResetAllUIDs(); + + //! Return the BaseRef portion of any ref entry by generic RefId. + //! @param[in] theRefId generic reference identifier + //! @return const reference to the BaseRef base of the ref entry + [[nodiscard]] Standard_EXPORT const BRepGraphInc::BaseRef& BaseRef( + const BRepGraph_RefId theRefId) const; + + //! Return the mutable BaseRef portion of any ref entry by generic RefId. + //! @param[in] theRefId generic reference identifier + //! @return mutable reference to the BaseRef base of the ref entry + Standard_EXPORT BRepGraphInc::BaseRef& ChangeBaseRef(const BRepGraph_RefId theRefId); + + //! Return the per-kind transitional reference UID vector. + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& RefUIDs( + const BRepGraph_RefId::Kind theKind) const; + + //! Return the per-kind transitional reference UID vector (mutable). + Standard_EXPORT NCollection_DynamicArray& ChangeRefUIDs( + const BRepGraph_RefId::Kind theKind); + + //! Clear all transitional reference UID vectors. + Standard_EXPORT void ResetAllRefUIDs(); + + //! Returns the reverse index for parent-child relationship queries. + [[nodiscard]] const BRepGraphInc_ReverseIndex& ReverseIndex() const { return myReverseIdx; } + + //! Returns a mutable reference to the reverse index. + BRepGraphInc_ReverseIndex& ChangeReverseIndex() { return myReverseIdx; } + + //! Returns the node id bound to the given TShape, or nullptr if not bound. + [[nodiscard]] const BRepGraph_NodeId* FindNodeByTShape(const TopoDS_TShape* theTShape) const + { + return myTShapeToNodeId.Seek(theTShape); + } + + //! Returns true if the given TShape is bound to a node. + [[nodiscard]] bool HasTShapeBinding(const TopoDS_TShape* theTShape) const + { + return myTShapeToNodeId.IsBound(theTShape); + } + + //! Binds the given TShape to a node id. + void BindTShapeToNode(const TopoDS_TShape* theTShape, const BRepGraph_NodeId theNodeId) + { + myTShapeToNodeId.Bind(theTShape, theNodeId); + } + + //! Back-reference to the source `TopoDS_Shape` a node was built from. + //! Only populated during Build; absent bindings are a valid state. + + //! Returns the original shape for the given node id, or nullptr if not bound. + [[nodiscard]] const TopoDS_Shape* FindOriginal(const BRepGraph_NodeId theNodeId) const + { + return myOriginalShapes.Seek(theNodeId); + } + + //! Returns true if the given node id has an original shape binding. + [[nodiscard]] bool HasOriginal(const BRepGraph_NodeId theNodeId) const + { + return myOriginalShapes.IsBound(theNodeId); + } + + //! Binds the given node id to its original shape. + void BindOriginal(const BRepGraph_NodeId theNodeId, const TopoDS_Shape& theShape) + { + myOriginalShapes.Bind(theNodeId, theShape); + } + + //! Removes the original shape binding for the given node id. + void UnBindOriginal(const BRepGraph_NodeId theNodeId) { myOriginalShapes.UnBind(theNodeId); } + + //! Iterate all TShape-to-NodeId bindings, invoking theFunc(TShape*, NodeId) for each entry. + //! Used by Compact to rebuild the map after the rebuild-and-swap. + template + void ForEachTShapeBinding(FuncT&& theFunc) const + { + for (NCollection_DataMap::Iterator anIt( + myTShapeToNodeId); + anIt.More(); + anIt.Next()) + { + theFunc(anIt.Key(), anIt.Value()); + } + } + + //! Iterate all NodeId-to-OriginalShape bindings, invoking theFunc(NodeId, Shape) for each entry. + //! Used by Compact to rebuild the map after the rebuild-and-swap. + template + void ForEachOriginalBinding(FuncT&& theFunc) const + { + for (NCollection_DataMap::Iterator anIt(myOriginalShapes); + anIt.More(); + anIt.Next()) + { + theFunc(anIt.Key(), anIt.Value()); + } + } + + [[nodiscard]] bool GetIsDone() const { return myIsDone; } + + void SetIsDone(const bool theVal) { myIsDone = theVal; } + + //! Clear all storage. + Standard_EXPORT void Clear(); + + //! Build reverse indices from entity and relationship tables. + //! Call after population is complete. + Standard_EXPORT void BuildReverseIndex(); + + //! Incrementally update reverse indices for entities appended after a previous + //! BuildReverseIndex(). Only processes entities and refs from the old counts to the + //! current vector lengths - the caller must snapshot ChildRef / SolidRef counts before + //! any Append so this remains O(delta), not O(total). + Standard_EXPORT void BuildDeltaReverseIndex(const uint32_t theOldNbEdges, + const uint32_t theOldNbWires, + const uint32_t theOldNbFaces, + const uint32_t theOldNbShells, + const uint32_t theOldNbSolids, + const uint32_t theOldNbCompounds, + const uint32_t theOldNbCompSolids, + const uint32_t theOldNbChildRefs, + const uint32_t theOldNbSolidRefs); + + //! Debug: verify reverse index consistency against entity tables. + //! @return true if all forward refs have matching reverse entries + Standard_EXPORT bool ValidateReverseIndex() const; + +private: + friend class BRepGraphInc_Populate; + friend class BRepGraph; + friend class BRepGraphInc_ReverseIndex; + + //! @brief Template store for topology entity kinds. + //! Groups the entity vector, per-kind UID vector, and active count + //! into a single struct, eliminating repeated boilerplate. + template + struct DefStore + { + using TypeId = typename EntityT::TypeId; + using ValueType = EntityT; + + NCollection_DynamicArray Entities; + NCollection_DynamicArray UIDs; + uint32_t NbActive = 0; + + DefStore() = default; + + DefStore(const int theBlockSize, const occ::handle& theAlloc) + : Entities(theBlockSize, theAlloc), + UIDs(theBlockSize, theAlloc) + { + } + + uint32_t Nb() const { return static_cast(Entities.Size()); } + + const EntityT& Get(const TypeId theId) const + { + return Entities.Value(static_cast(theId.Index)); + } + + EntityT& Change(const TypeId theId) + { + return Entities.ChangeValue(static_cast(theId.Index)); + } + + //! Append a default-constructed entity and return its typed slot id. + TypeId Append(const occ::handle& theAlloc) + { + const TypeId anId(static_cast(Entities.Size())); + ++NbActive; + Entities.Appended().InitVectors(theAlloc); + return anId; + } + + void DecrementActive() + { + Standard_ASSERT_VOID(NbActive > 0u, "DefStore::DecrementActive: underflow"); + if (NbActive > 0u) + --NbActive; + } + + bool MarkRemoved(const TypeId theId) + { + if (!theId.IsValid(Nb())) + { + return false; + } + + EntityT& anEntity = Change(theId); + if (anEntity.IsRemoved) + { + return false; + } + anEntity.IsRemoved = true; + DecrementActive(); + return true; + } + + void Clear() + { + Entities.Clear(); + UIDs.Clear(); + NbActive = 0; + } + }; + + //! @brief Template store for representation entity kinds. + //! Groups the representation vector and active count into a single struct. + template + struct RepStore + { + using TypeId = typename RepT::TypeId; + using ValueType = RepT; + + NCollection_DynamicArray Entities; + uint32_t NbActive = 0; + + RepStore() = default; + + RepStore(const int theBlockSize, const occ::handle& theAlloc) + : Entities(theBlockSize, theAlloc) + { + } + + uint32_t Nb() const { return static_cast(Entities.Size()); } + + const RepT& Get(const TypeId theId) const + { + return Entities.Value(static_cast(theId.Index)); + } + + RepT& Change(const TypeId theId) + { + return Entities.ChangeValue(static_cast(theId.Index)); + } + + //! Append a default-constructed rep and return its typed slot id. + TypeId Append() + { + const TypeId anId(static_cast(Entities.Size())); + ++NbActive; + Entities.Appended(); + return anId; + } + + void DecrementActive() + { + Standard_ASSERT_VOID(NbActive > 0u, "RepStore::DecrementActive: underflow"); + if (NbActive > 0u) + --NbActive; + } + + bool MarkRemoved(const TypeId theId) + { + if (!theId.IsValid(Nb())) + { + return false; + } + + RepT& aRep = Change(theId); + if (aRep.IsRemoved) + { + return false; + } + aRep.IsRemoved = true; + DecrementActive(); + return true; + } + + void EraseLast() + { + Standard_ASSERT_VOID(NbActive > 0u, "RepStore::EraseLast: underflow"); + if (NbActive > 0u) + { + Entities.EraseLast(); + --NbActive; + } + } + + void Clear() + { + Entities.Clear(); + NbActive = 0; + } + }; + + //! @brief Template store for transitional reference entry kinds. + //! Groups reference vectors and per-kind UID vectors into a single struct. + template + struct RefStore + { + using TypeId = typename RefT::TypeId; + using ValueType = RefT; + + NCollection_DynamicArray Refs; + NCollection_DynamicArray UIDs; + uint32_t NbActive = 0; + + RefStore() = default; + + RefStore(const int theBlockSize, const occ::handle& theAlloc) + : Refs(theBlockSize, theAlloc), + UIDs(theBlockSize, theAlloc) + { + } + + uint32_t Nb() const { return static_cast(Refs.Size()); } + + const RefT& Get(const TypeId theId) const + { + return Refs.Value(static_cast(theId.Index)); + } + + RefT& Change(const TypeId theId) { return Refs.ChangeValue(static_cast(theId.Index)); } + + //! Append a default-constructed ref entry and return its typed slot id. + TypeId Append() + { + const TypeId anId(static_cast(Refs.Size())); + ++NbActive; + Refs.Appended(); + return anId; + } + + void DecrementActive() + { + Standard_ASSERT_VOID(NbActive > 0u, "RefStore::DecrementActive: underflow"); + if (NbActive > 0u) + --NbActive; + } + + bool MarkRemoved(const TypeId theId) + { + if (!theId.IsValid(Nb())) + { + return false; + } + + RefT& aRef = Change(theId); + if (aRef.IsRemoved) + { + return false; + } + aRef.IsRemoved = true; + DecrementActive(); + return true; + } + + void Clear() + { + Refs.Clear(); + UIDs.Clear(); + NbActive = 0; + } + }; + + // Topology entity stores + DefStore myVertices; + DefStore myEdges; + DefStore myCoEdges; + DefStore myWires; + DefStore myFaces; + DefStore myShells; + DefStore mySolids; + DefStore myCompounds; + DefStore myCompSolids; + DefStore myProducts; + DefStore myOccurrences; + + // Transitional reference entry stores + RefStore myShellRefs; + RefStore myFaceRefs; + RefStore myWireRefs; + RefStore myCoEdgeRefs; + RefStore myVertexRefs; + RefStore mySolidRefs; + RefStore myChildRefs; + RefStore myOccurrenceRefs; + + // Representation entity stores + RepStore mySurfaces; + RepStore myCurves3D; + RepStore myCurves2D; + RepStore myTriangulationsRep; + RepStore myPolygons3D; + RepStore myPolygons2D; + RepStore myPolygonsOnTri; + + BRepGraphInc_ReverseIndex myReverseIdx; + + NCollection_DataMap myTShapeToNodeId; + NCollection_DataMap myOriginalShapes; + + occ::handle myAllocator; + + bool myIsDone = false; +}; + +#endif // _BRepGraphInc_Storage_HeaderFile diff --git a/opencascade/BRepGraph_Builder.hxx b/opencascade/BRepGraph_Builder.hxx new file mode 100644 index 000000000..523630332 --- /dev/null +++ b/opencascade/BRepGraph_Builder.hxx @@ -0,0 +1,134 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Builder_HeaderFile +#define _BRepGraph_Builder_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +class BRepGraph; +class TopoDS_Shape; + +//! @brief Static helper that ingests a TopoDS_Shape into a BRepGraph. +class BRepGraph_Builder +{ +public: + DEFINE_STANDARD_ALLOC + + //! Build-time options. + struct Options + { + BRepGraphInc_Populate::Options Populate{}; + bool CreateAutoProduct = true; //!< wrap topology root in a Product (unparented Add only) + bool Flatten = false; //!< drop hierarchy containers, append faces as roots + bool Parallel = false; //!< run face-level construction in parallel + }; + + //! Outcome of a single Add() call. + struct Result + { + BRepGraph_NodeId TopologyRoot; + BRepGraph_ProductId Product; + BRepGraph_OccurrenceId Occurrence; + BRepGraph_RefId InsertedRef; + bool Ok = false; + }; + + //! Ingest a TopoDS_Shape as a new root subgraph, wrapping the topology root in a Product. + //! @param[in,out] theGraph graph to populate + //! @param[in] theShape shape to ingest + //! @return Result with TopologyRoot, Product and Occurrence set on success. + [[nodiscard]] static Standard_EXPORT Result Add(BRepGraph& theGraph, + const TopoDS_Shape& theShape); + + //! Ingest a TopoDS_Shape as a new root subgraph with explicit options. + //! @param[in,out] theGraph graph to populate + //! @param[in] theShape shape to ingest + //! @param[in] theOptions build-time options + //! @return Result with TopologyRoot set on success; Product/Occurrence set + //! when theOptions.CreateAutoProduct is true. + [[nodiscard]] static Standard_EXPORT Result Add(BRepGraph& theGraph, + const TopoDS_Shape& theShape, + const Options& theOptions); + + //! Ingest a TopoDS_Shape under an existing parent. + //! + //! Parent kind dispatch: + //! - Product: creates a child part-product, links via Occurrence with shape.Location(). + //! - Compound: appends topology root as a child reference. + //! - Shell: appends a Face as a FaceRef; other shapes via AddChild. + //! - Solid: appends a Shell as a ShellRef; other shapes via AddChild. + //! - CompSolid: appends a Solid as a SolidRef. + //! Other parent kinds (Wire, Edge, Vertex, Occurrence) are not supported and yield + //! an invalid Result (Result::Ok == false) without modification to the graph. + //! @param[in,out] theGraph graph to populate + //! @param[in] theShape shape to ingest + //! @param[in] theParent parent node receiving the topology + //! @return Result with TopologyRoot set, plus (Product, Occurrence, InsertedRef) for Product + //! parents or InsertedRef for topology container parents. + [[nodiscard]] static Standard_EXPORT Result Add(BRepGraph& theGraph, + const TopoDS_Shape& theShape, + const BRepGraph_NodeId theParent); + + //! Ingest a shape under an existing parent with explicit options. + //! Options::CreateAutoProduct is ignored. + [[nodiscard]] static Standard_EXPORT Result Add(BRepGraph& theGraph, + const TopoDS_Shape& theShape, + const BRepGraph_NodeId theParent, + const Options& theOptions); + +private: + static void appendImpl(BRepGraph& theGraph, + const TopoDS_Shape& theShape, + const Options& theOptions, + NCollection_DynamicArray* theOutFlatRoots = nullptr); + + static BRepGraph_NodeId detectTopologyRoot(const BRepGraph& theGraph, + const TopAbs_ShapeEnum theShapeType, + const uint32_t theOldCountOfShapeKind); + + static uint32_t snapshotCountForKind(const BRepGraph& theGraph, + const TopAbs_ShapeEnum theShapeType); + + static void populateUIDs(BRepGraph& theGraph); + + static void populateUIDsIncremental(BRepGraph& theGraph, + const int theOldVtx, + const int theOldEdge, + const int theOldCoEdge, + const int theOldWire, + const int theOldFace, + const int theOldShell, + const int theOldSolid, + const int theOldComp, + const int theOldCS, + const int theOldProduct, + const int theOldOccurrence, + const int theOldShellRef, + const int theOldFaceRef, + const int theOldWireRef, + const int theOldCoEdgeRef, + const int theOldVertexRef, + const int theOldSolidRef, + const int theOldChildRef); + + BRepGraph_Builder() = delete; +}; + +#endif // _BRepGraph_Builder_HeaderFile diff --git a/opencascade/BRepGraph_CacheKindIterator.hxx b/opencascade/BRepGraph_CacheKindIterator.hxx new file mode 100644 index 000000000..10caa2f31 --- /dev/null +++ b/opencascade/BRepGraph_CacheKindIterator.hxx @@ -0,0 +1,76 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_CacheKindIterator_HeaderFile +#define _BRepGraph_CacheKindIterator_HeaderFile + +#include +#include + +//! @brief Zero-allocation iterator over populated cache kinds on a node or reference. +//! +//! Template parameter TKeyId is either BRepGraph_NodeId or BRepGraph_RefId. +//! Supports OCCT More()/Next()/Value() pattern and STL range-for via begin()/end(). +//! +//! Constructed by BRepGraph::CacheView::CacheKindIter(). Stores populated +//! kind slot indices in a fixed-size stack buffer (no heap allocation). +//! +//! @code +//! // Range-for: +//! for (const occ::handle& aKind : aGraph.Cache().CacheKindIter(aNode)) +//! doSomething(aKind); +//! +//! // Traditional: +//! for (auto anIt = aGraph.Cache().CacheKindIter(aNode); anIt.More(); anIt.Next()) +//! doSomething(anIt.Value()); +//! @endcode +template +class BRepGraph_CacheKindIterator +{ +public: + //! True if the iterator has a current element. + [[nodiscard]] bool More() const { return myCurrent < myCount; } + + //! Advance to the next populated cache kind. + void Next() { ++myCurrent; } + + //! Return the current cache kind descriptor. + [[nodiscard]] occ::handle Value() const + { + return BRepGraph_CacheKindRegistry::FindKind(mySlots[myCurrent]); + } + + //! Return the current cache-kind slot index (for fast slot-based access). + [[nodiscard]] int KindSlot() const { return mySlots[myCurrent]; } + + //! Number of populated cache kinds found. + [[nodiscard]] int NbKinds() const { return myCount; } + + //! STL range-for support. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Sentinel marking end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + friend class BRepGraph::CacheView; + static constexpr int THE_MAX_SLOTS = BRepGraph_TransientCache::THE_DEFAULT_RESERVED_KIND_COUNT; + int mySlots[THE_MAX_SLOTS]; + int myCount = 0; + int myCurrent = 0; +}; + +#endif // _BRepGraph_CacheKindIterator_HeaderFile diff --git a/opencascade/BRepGraph_CacheView.hxx b/opencascade/BRepGraph_CacheView.hxx new file mode 100644 index 000000000..995128212 --- /dev/null +++ b/opencascade/BRepGraph_CacheView.hxx @@ -0,0 +1,168 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_CacheView_HeaderFile +#define _BRepGraph_CacheView_HeaderFile + +#include +#include + +//! @brief Non-const view for managing transient cache values on nodes. +//! +//! This view is the stable public cache API for BRepGraph callers. +//! External code should use Cache() for all cache access. +//! Low-level storage operations such as reserve or cross-graph cache transfer +//! stay internal to graph-maintenance code through the graph's private cache access. +//! +//! Cached values are keyed by BRepGraph_CacheKind descriptors (Handle-based) +//! and stored as Handle(BRepGraph_CacheValue). Each CacheKind carries a +//! Standard_GUID for stable identity and is registered in +//! BRepGraph_CacheKindRegistry which maps GUIDs to dense runtime slot +//! indices for O(1) internal storage lookup. +//! +//! Supports set, get, remove, invalidate, and kind enumeration per node. +//! Cached data is stored centrally in BRepGraph_TransientCache with +//! generation-based freshness tracking via SubtreeGen. +//! Hot-path callers may pre-resolve a cache-kind slot once through +//! BRepGraph_CacheKindRegistry::Register() and then use slot-based overloads +//! to avoid repeated registry locking. +//! Obtained via BRepGraph::Cache(). +class BRepGraph::CacheView +{ +public: + //! Attach a cached value to a node. + //! @param[in] theNode node to attach the value to + //! @param[in] theKind cache kind descriptor identifying the slot + //! @param[in] theValue cached value to store + Standard_EXPORT void Set(const BRepGraph_NodeId theNode, + const occ::handle& theKind, + const occ::handle& theValue); + + //! Attach a cached value using a pre-resolved cache-kind slot. + Standard_EXPORT void Set(const BRepGraph_NodeId theNode, + const int theKindSlot, + const occ::handle& theValue); + + //! Retrieve a cached value from a node. + //! @param[in] theNode node to query + //! @param[in] theKind cache kind descriptor identifying the slot + //! @return cached value, or null handle if not present or stale + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_NodeId theNode, + const occ::handle& theKind) const; + + //! Retrieve a cached value using a pre-resolved cache-kind slot. + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_NodeId theNode, + const int theKindSlot) const; + + //! Check if a non-stale cached value exists on a node. + //! @param[in] theNode node to query + //! @param[in] theKind cache kind descriptor identifying the slot + //! @return true if a current value exists for this node and kind + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_NodeId theNode, + const occ::handle& theKind) const; + + //! Check if a non-stale cached value exists using a pre-resolved slot. + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_NodeId theNode, + const int theKindSlot) const; + + //! Remove a cached value from a node. + //! @param[in] theNode node to remove the value from + //! @param[in] theKind cache kind descriptor identifying the slot + //! @return true if a value was actually removed + Standard_EXPORT bool Remove(const BRepGraph_NodeId theNode, + const occ::handle& theKind); + + //! Remove a cached value using a pre-resolved cache-kind slot. + Standard_EXPORT bool Remove(const BRepGraph_NodeId theNode, const int theKindSlot); + + //! Invalidate (but do not remove) a cached value on a node. + //! @param[in] theNode node whose cache entry to invalidate + //! @param[in] theKind cache kind descriptor identifying the slot + Standard_EXPORT void Invalidate(const BRepGraph_NodeId theNode, + const occ::handle& theKind); + + //! Invalidate a cached value using a pre-resolved cache-kind slot. + Standard_EXPORT void Invalidate(const BRepGraph_NodeId theNode, const int theKindSlot); + + //! Create a zero-allocation iterator over all cache kinds populated on a node. + //! @param[in] theNode node to query + Standard_EXPORT BRepGraph_CacheKindIterator CacheKindIter( + const BRepGraph_NodeId theNode) const; + + //! Create a zero-allocation iterator over all cache kinds populated on a reference. + //! @param[in] theRef reference to query + Standard_EXPORT BRepGraph_CacheKindIterator CacheKindIter( + const BRepGraph_RefId theRef) const; + + // --- Reference-level cache --- + + //! Attach a cached value to a reference. + //! @param[in] theRef reference to attach the value to + //! @param[in] theKind cache kind descriptor identifying the slot + //! @param[in] theValue cached value to store + Standard_EXPORT void Set(const BRepGraph_RefId theRef, + const occ::handle& theKind, + const occ::handle& theValue); + + //! Attach a cached value to a reference using a pre-resolved cache-kind slot. + Standard_EXPORT void Set(const BRepGraph_RefId theRef, + const int theKindSlot, + const occ::handle& theValue); + + //! Retrieve a cached value from a reference. + //! @return cached value, or null handle if not present or stale (OwnGen changed) + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_RefId theRef, + const occ::handle& theKind) const; + + //! Retrieve a cached value from a reference using a pre-resolved cache-kind slot. + [[nodiscard]] Standard_EXPORT occ::handle Get(const BRepGraph_RefId theRef, + const int theKindSlot) const; + + //! Check if a non-stale cached value exists on a reference. + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_RefId theRef, + const occ::handle& theKind) const; + + //! Check if a non-stale cached value exists on a reference using a pre-resolved slot. + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_RefId theRef, const int theKindSlot) const; + + //! Remove a cached value from a reference. + //! @return true if a value was actually removed + Standard_EXPORT bool Remove(const BRepGraph_RefId theRef, + const occ::handle& theKind); + + //! Remove a cached value from a reference using a pre-resolved cache-kind slot. + Standard_EXPORT bool Remove(const BRepGraph_RefId theRef, const int theKindSlot); + + //! Invalidate (but do not remove) a cached value on a reference. + Standard_EXPORT void Invalidate(const BRepGraph_RefId theRef, + const occ::handle& theKind); + + //! Invalidate a cached value on a reference using a pre-resolved cache-kind slot. + Standard_EXPORT void Invalidate(const BRepGraph_RefId theRef, const int theKindSlot); + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit CacheView(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; +}; + +#endif // _BRepGraph_CacheView_HeaderFile diff --git a/opencascade/BRepGraph_ChildExplorer.hxx b/opencascade/BRepGraph_ChildExplorer.hxx new file mode 100644 index 000000000..134c18781 --- /dev/null +++ b/opencascade/BRepGraph_ChildExplorer.hxx @@ -0,0 +1,330 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_ChildExplorer_HeaderFile +#define _BRepGraph_ChildExplorer_HeaderFile + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +//! @brief Stack-based lazy downward hierarchy walker for BRepGraph with inline +//! location/orientation accumulation. +//! @see BRepGraph class comment "Iterator guide" for choosing between iterator types. +//! +//! Walks the graph hierarchy from a root node down to entities of a target kind, +//! yielding one occurrence at a time via a depth-first stack. Location and +//! orientation are composed incrementally during the walk, making +//! Current().Location and Current().Orientation O(1) per call. +//! +//! The traversal follows the actual graph structure transparently - every node +//! kind is visited as a distinct entity (no hidden collapses): +//! Compound -> children, CompSolid -> Solids, Solid -> Shells, +//! Shell -> Faces, Face -> Wires (+direct Vertices), Wire -> CoEdges, +//! CoEdge -> Edge, Edge -> Vertices, +//! Product(assembly) -> Occurrences, Product(part) -> ShapeRoot, +//! Occurrence -> Product. +//! +//! Unlike flat definition traversal by typed ids, BRepGraph_ChildExplorer visits +//! each occurrence. If Edge[5] is reachable through Face[0] and Face[1], +//! it is visited twice with different accumulated transforms. +//! +//! ## Traversal modes +//! - **Recursive**: depth-first walk through the full subgraph. +//! Without target kind, all descendant nodes are emitted. +//! With target kind, only matching nodes are emitted but intermediate +//! levels are traversed to reach them. +//! - **DirectChildren**: yields only the immediate children of the root. +//! No descent into grandchildren. With target kind, only children +//! matching the kind are returned. +class BRepGraph_ChildExplorer +{ +public: + DEFINE_STANDARD_ALLOC + + //! Relationship kind between Current() and CurrentParent(). + enum class LinkKind + { + None, //!< No current incoming link (e.g. root/self match). + Reference, //!< Current() is reached through a parent-owned RefId. + Structural, //!< Current() is reached through a structural non-ref link. + }; + + //! Downward traversal strategy. + enum class TraversalMode + { + Recursive, //!< Depth-first walk through the full subgraph. + DirectChildren, //!< Yields only the immediate children of the root. + }; + + //! Consolidated configuration for the explorer. + //! + //! Prefer this struct over the historical 11-overload constructor family. The + //! overloads remain supported for existing callers but the `Config`-based + //! constructor is the stable long-term idiom: new options can be added as + //! fields without another constructor explosion. + //! + //! @code + //! BRepGraph_ChildExplorer::Config aConfig; + //! aConfig.Mode = BRepGraph_ChildExplorer::TraversalMode::DirectChildren; + //! aConfig.TargetKind = BRepGraph_NodeId::Kind::Face; + //! aConfig.StartLoc = aParentLocation; + //! aConfig.StartOri = TopAbs_REVERSED; + //! for (auto [id, loc, ori] : BRepGraph_ChildExplorer(aGraph, aRoot, aConfig)) { ... } + //! @endcode + struct Config + { + TraversalMode Mode = TraversalMode::Recursive; + std::optional + TargetKind; //!< Emit only this kind (no value = emit all). + std::optional AvoidKind; //!< Do not descend into this kind. + bool EmitAvoidKind = + false; //!< Emit matching avoid-kind nodes once before skipping their subtree. + bool AccumulateLocation = true; //!< Compose Location down the walk. + bool AccumulateOrientation = true; //!< Compose Orientation down the walk. + TopLoc_Location StartLoc; //!< Initial accumulated location. + TopAbs_Orientation StartOri = TopAbs_FORWARD; //!< Initial accumulated orientation. + }; + + //! Preferred long-term constructor: all tuning knobs in `Config`. + //! @param[in] theGraph graph to walk + //! @param[in] theRoot root node where the walk begins + //! @param[in] theConfig traversal configuration (mode, target kind, avoid kind, etc.) + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + const Config& theConfig); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + TraversalMode theMode); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + const std::optional& theAvoidKind, + bool theEmitAvoidKind, + TraversalMode theMode = TraversalMode::Recursive); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + BRepGraph_NodeId::Kind theTargetKind); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + BRepGraph_NodeId::Kind theTargetKind, + TraversalMode theMode); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + BRepGraph_NodeId::Kind theTargetKind, + const std::optional& theAvoidKind, + bool theEmitAvoidKind, + TraversalMode theMode = TraversalMode::Recursive); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_ProductId theProduct, + BRepGraph_NodeId::Kind theTargetKind); + + //! Disambiguates non-product typed ids from the ProductId-specific overload + //! family above and keeps them on the generic NodeId traversal path. + template = 0> + BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId::Typed theRoot, + BRepGraph_NodeId::Kind theTargetKind) + : BRepGraph_ChildExplorer(theGraph, BRepGraph_NodeId(theRoot), theTargetKind) + { + } + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_ProductId theProduct, + BRepGraph_NodeId::Kind theTargetKind, + TraversalMode theMode); + + //! Disambiguates non-product typed ids from the ProductId-specific overload + //! family above and keeps them on the generic NodeId traversal path. + template = 0> + BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId::Typed theRoot, + BRepGraph_NodeId::Kind theTargetKind, + TraversalMode theMode) + : BRepGraph_ChildExplorer(theGraph, BRepGraph_NodeId(theRoot), theTargetKind, theMode) + { + } + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + BRepGraph_NodeId::Kind theTargetKind, + bool theCumLoc, + bool theCumOri, + TraversalMode theMode = TraversalMode::Recursive); + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_ProductId theProduct, + BRepGraph_NodeId::Kind theTargetKind, + bool theCumLoc, + bool theCumOri, + TraversalMode theMode = TraversalMode::Recursive); + + //! Disambiguates non-product typed ids from the ProductId-specific overload + //! family above and keeps them on the generic NodeId traversal path. + template = 0> + BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId::Typed theRoot, + BRepGraph_NodeId::Kind theTargetKind, + bool theCumLoc, + bool theCumOri, + TraversalMode theMode = TraversalMode::Recursive) + : BRepGraph_ChildExplorer(theGraph, + BRepGraph_NodeId(theRoot), + theTargetKind, + theCumLoc, + theCumOri, + theMode) + { + } + + Standard_EXPORT BRepGraph_ChildExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theRoot, + BRepGraph_NodeId::Kind theTargetKind, + const TopLoc_Location& theStartLoc, + TopAbs_Orientation theStartOri, + TraversalMode theMode = TraversalMode::DirectChildren); + + //! Returns the traversal configuration this explorer was constructed with. + //! Read-only - configuration is fixed for the lifetime of the explorer. + [[nodiscard]] const Config& GetConfig() const { return myConfig; } + + [[nodiscard]] bool More() const { return myHasMore; } + + Standard_EXPORT void Next(); + + [[nodiscard]] BRepGraphInc::NodeInstance Current() const + { + return {myCurrent, myLocation, myOrientation}; + } + + //! Returns the immediate parent of Current() in the explored path. + //! Returns invalid NodeId when Current() is the root/self match. + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId CurrentParent() const; + + //! Returns how Current() is linked from CurrentParent(). + [[nodiscard]] Standard_EXPORT LinkKind CurrentLinkKind() const; + + //! Returns the exact parent-owned RefId for Current(), when the current step + //! is represented by a reference entry. Returns invalid RefId for structural + //! links without a dedicated ref entry such as CoEdge->Edge, + //! Product(part)->ShapeRoot and Occurrence->Product. + [[nodiscard]] Standard_EXPORT BRepGraph_RefId CurrentRef() const; + + [[nodiscard]] Standard_EXPORT TopLoc_Location + LocationOf(const BRepGraph_NodeId::Kind theKind) const; + + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId NodeOf(const BRepGraph_NodeId::Kind theKind) const; + + [[nodiscard]] Standard_EXPORT TopLoc_Location LocationAt(const int theLevel) const; + + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId NodeAt(const int theLevel) const; + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + struct StackFrame + { + BRepGraph_NodeId Node; + uint32_t NextChildIdx = 0; + int StepFromParent = -1; + TopLoc_Location AccLocation; + TopAbs_Orientation AccOrientation = TopAbs_FORWARD; + }; + + void advance(); + + void startTraversal(const TopLoc_Location& theStartLoc, TopAbs_Orientation theStartOri); + + static std::optional normalizeAvoidKind( + const std::optional& theAvoidKind, + const std::optional& theTargetKind); + + static bool canContainTarget(BRepGraph_NodeId::Kind theParentKind, + BRepGraph_NodeId::Kind theTargetKind); + + static bool canHaveChildren(BRepGraph_NodeId::Kind theNodeKind); + + void setCurrentFromFrame(const int theFrameIndex); + + [[nodiscard]] bool shouldDescendFromCurrent() const; + + [[nodiscard]] bool matchesTarget(const BRepGraph_NodeId theNode) const + { + return myConfig.TargetKind.has_value() && theNode.NodeKind == *myConfig.TargetKind; + } + + [[nodiscard]] bool matchesAvoid(const BRepGraph_NodeId theNode) const + { + return myConfig.AvoidKind.has_value() && theNode.NodeKind == *myConfig.AvoidKind; + } + + [[nodiscard]] bool shouldEmit(const BRepGraph_NodeId theNode) const + { + const bool isAvoid = matchesAvoid(theNode); + const bool isFind = + !myConfig.TargetKind.has_value() || theNode.NodeKind == *myConfig.TargetKind; + return myConfig.EmitAvoidKind ? (isFind || isAvoid) : (isFind && !isAvoid); + } + + void pushFrame(const StackFrame& theFrame); + + void popFrame(); + + StackFrame& topFrame() { return myStack[myStackTop]; } + + const StackFrame& topFrame() const { return myStack[myStackTop]; } + + static constexpr int THE_INLINE_STACK_SIZE = 16; + + const BRepGraph* myGraph = nullptr; + BRepGraph_NodeId myRoot; + Config myConfig; //!< Traversal configuration - single source of truth. + + NCollection_LocalArray myStack; + int myStackTop = -1; + int myCurrentFrame = -1; + + BRepGraph_NodeId myCurrent; + TopLoc_Location myLocation; + TopAbs_Orientation myOrientation = TopAbs_FORWARD; + bool myHasMore = false; +}; + +#endif // _BRepGraph_ChildExplorer_HeaderFile diff --git a/opencascade/BRepGraph_Compact.hxx b/opencascade/BRepGraph_Compact.hxx new file mode 100644 index 000000000..f87a1007e --- /dev/null +++ b/opencascade/BRepGraph_Compact.hxx @@ -0,0 +1,74 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Compact_HeaderFile +#define _BRepGraph_Compact_HeaderFile + +#include + +#include + +//! @brief Graph compaction algorithm that reclaims removed node slots. +//! +//! After deduplication or other operations that mark nodes as removed, +//! this algorithm rebuilds the graph with dense index arrays, eliminating +//! all removed nodes and reassigning indices to be contiguous. +//! +//! Strategy: rebuild-and-swap. A fresh BRepGraph is constructed from +//! non-removed nodes with remapped indices, then move-assigned into +//! the input graph. +class BRepGraph_Compact +{ +public: + DEFINE_STANDARD_ALLOC + + //! Configuration for compaction. + struct Options + { + bool HistoryMode = true; //!< Record index remapping in history. + }; + + //! Result counters for diagnostics. + struct Result + { + int NbRemovedVertices = 0; + int NbRemovedEdges = 0; + int NbRemovedWires = 0; + int NbRemovedFaces = 0; + int NbRemovedShells = 0; + int NbRemovedSolids = 0; + int NbRemovedCompounds = 0; + int NbRemovedCompSolids = 0; + int NbRemovedSurfaces = 0; + int NbRemovedCurves = 0; + int NbNodesBefore = 0; + int NbNodesAfter = 0; + }; + + //! Run compaction with default options. + //! @param[in,out] theGraph graph to compact + //! @return compaction statistics + [[nodiscard]] Standard_EXPORT static Result Perform(BRepGraph& theGraph); + + //! Run compaction with specified options. + //! @param[in,out] theGraph graph to compact + //! @param[in] theOptions compaction configuration + //! @return compaction statistics + [[nodiscard]] Standard_EXPORT static Result Perform(BRepGraph& theGraph, + const Options& theOptions); + +private: + BRepGraph_Compact() = delete; +}; + +#endif // _BRepGraph_Compact_HeaderFile diff --git a/opencascade/BRepGraph_Copy.hxx b/opencascade/BRepGraph_Copy.hxx new file mode 100644 index 000000000..edf8d5e2d --- /dev/null +++ b/opencascade/BRepGraph_Copy.hxx @@ -0,0 +1,79 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Copy_HeaderFile +#define _BRepGraph_Copy_HeaderFile + +#include +#include +#include + +#include + +//! @brief Graph-to-graph deep copy. +//! +//! Produces a new BRepGraph from an existing one in a single bottom-up pass, +//! avoiding the 5-7 traversals of BRepTools_Modifier used by BRepBuilderAPI_Copy. +//! +//! Two modes: +//! - theCopyGeom = true (deep): geometry handles are cloned, result is fully independent. +//! - theCopyGeom = false (light): geometry handles are shared, only topology is duplicated. +//! +//! @note Unlike in-place mutation algorithms (Sewing, Deduplicate) which return a +//! Result struct with diagnostics, Copy and Transform return a BRepGraph directly +//! because they produce new graphs. Check IsDone() on the returned graph for success. +//! +//! ## Typical usage +//! @code +//! BRepGraph aGraph; +//! BRepGraph_Builder::Add(aGraph, myShape); +//! BRepGraph aCopy = BRepGraph_Copy::Perform(aGraph); +//! TopoDS_Shape aShape = aCopy.Shapes().Shape(); +//! @endcode +class BRepGraph_Copy +{ +public: + DEFINE_STANDARD_ALLOC + + //! Copy the entire graph. + //! @param[in] theGraph a pre-built BRepGraph (must have IsDone() == true) + //! @param[in] theCopyGeom if true (default), geometry handles are deep-copied; + //! if false, geometry is shared (only topology is duplicated) + //! @return a new BRepGraph with IsDone() == true on success, + //! or an empty graph with IsDone() == false on failure + [[nodiscard]] Standard_EXPORT static BRepGraph Perform(const BRepGraph& theGraph, + const bool theCopyGeom = true); + + //! Copy a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex, etc.). + //! The new graph contains only the specified node and all entities it references. + //! @param[in] theGraph a pre-built BRepGraph + //! @param[in] theNodeId node identifier (any kind) + //! @param[in] theCopyGeom if true, geometry handles are deep-copied + //! @param[in] theCopyMesh if true, cached mesh entries are propagated to the result; + //! if false, mesh references are dropped on copied faces + //! @param[in] theReserveCache if true, pre-allocates transient cache + //! @return a new BRepGraph containing only the specified sub-graph + [[nodiscard]] Standard_EXPORT static BRepGraph CopyNode(const BRepGraph& theGraph, + const BRepGraph_NodeId theNodeId, + const bool theCopyGeom = true, + const bool theCopyMesh = true, + const bool theReserveCache = false); + +private: + //! Pre-allocate transient cache for lock-free parallel access. + static void reserveTransientCache(BRepGraph& theGraph); + + BRepGraph_Copy() = delete; +}; + +#endif // _BRepGraph_Copy_HeaderFile diff --git a/opencascade/BRepGraph_Data.hxx b/opencascade/BRepGraph_Data.hxx new file mode 100644 index 000000000..162a44844 --- /dev/null +++ b/opencascade/BRepGraph_Data.hxx @@ -0,0 +1,158 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Data_HeaderFile +#define _BRepGraph_Data_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +//! @brief Internal storage for BRepGraph (PIMPL). +//! +//! All topology definition data and UIDs live in myIncStorage. +//! Access via myIncStorage.Edges, myIncStorage.Faces, etc. +struct BRepGraph_Data +{ + occ::handle myAllocator; + + //! Incidence-table storage - sole source of truth for all topology data, + //! original shapes, TShape->NodeId mapping, and UIDs. + BRepGraphInc_Storage myIncStorage; + + //! UID system. + std::atomic myNextUIDCounter{ + 1}; //!< Starts at 1; counter=0 is BRepGraph_UID invalid sentinel. + std::atomic myGeneration{0}; + Standard_GUID myGraphGUID; //!< Random graph identity, generated at BRepGraph_Builder::Add(). + + //! History subsystem. + BRepGraph_History myHistoryLog; + + bool myIsDone = false; + + //! Root product identifiers: products not referenced by any active occurrence. + //! Maintained incrementally by Editor/EditorView mutations. + NCollection_DynamicArray myRootProductIds; + + //! When true, markModified() only increments OwnGen + SubtreeGen and appends to + //! myDeferredModified - no mutex acquisition and no upward propagation. + std::atomic myDeferredMode{false}; + + //! Propagation wave counter. Incremented at the start of each + //! markModified() / markRefModified() call. markParentModified() + //! compares entity.LastPropWave against this to skip already-visited + //! parents in the same propagation wave (O(1) re-visit guard). + std::atomic myPropagationWave{0}; + + //! Recursion depth of EditorView::GenOps::RemoveSubgraph. Outermost call (depth==0) + //! triggers a single reverse-index rebuild after cascade so individual cascade-prune + //! steps avoid maintaining per-kind unbinds for every removed node. + uint32_t myRemoveSubgraphDepth = 0; + + //! NodeIds accumulated during deferred mode. Processed by EndDeferredInvalidation(). + NCollection_DynamicArray myDeferredModified; + + //! RefIds accumulated during deferred mode. Processed by EndDeferredInvalidation(). + NCollection_DynamicArray myDeferredRefModified; + + //! Gen-validated shape cache entry. + struct CachedShape + { + TopoDS_Shape Shape; + uint32_t StoredSubtreeGen = 0; + }; + + //! Thread-safe cache of reconstructed shapes with SubtreeGen validation. + mutable NCollection_DataMap myCurrentShapes; + mutable std::shared_mutex myCurrentShapesMutex; + + //! Lazy reverse lookup index for entity UIDs. + mutable NCollection_DataMap myUIDToNodeId; + mutable std::shared_mutex myUIDToNodeIdMutex; + mutable uint32_t myUIDToNodeIdGeneration = 0; + mutable bool myUIDToNodeIdDirty = true; + + //! Lazy reverse lookup index for reference UIDs. + mutable NCollection_DataMap myRefUIDToRefId; + mutable std::shared_mutex myRefUIDToRefIdMutex; + mutable uint32_t myRefUIDToRefIdGeneration = 0; + mutable bool myRefUIDToRefIdDirty = true; + + //! Cached mesh data storage (algorithm-derived, non-mutating). + //! Holds triangulation/polygon rep references written by BRepGraphMesh. + //! Does NOT trigger markModified() or mutation tracking. + BRepGraph_MeshCacheStorage myMeshCache; + + using ReconstructCache = NCollection_DataMap; + + //! Cached view objects (pointers set to owning BRepGraph in its constructor). + BRepGraph::TopoView myTopoView{nullptr}; + BRepGraph::UIDsView myUIDsView{nullptr}; + BRepGraph::CacheView myCacheView{nullptr}; + BRepGraph::RefsView myRefsView{nullptr}; + BRepGraph::ShapesView myShapesView{nullptr}; + BRepGraph::EditorView myEditorView{nullptr}; + BRepGraph::MeshView myMeshView{nullptr}; + + BRepGraph_Data() + : myAllocator(new NCollection_IncAllocator), + myIncStorage(myAllocator), + myCurrentShapes(1, myAllocator), + myUIDToNodeId(1, myAllocator), + myRefUIDToRefId(1, myAllocator) + { + myHistoryLog.SetAllocator(myAllocator); + } + + explicit BRepGraph_Data(const occ::handle& theAlloc) + : myAllocator(!theAlloc.IsNull() + ? theAlloc + : occ::handle(new NCollection_IncAllocator)), + myIncStorage(myAllocator), + myCurrentShapes(1, myAllocator), + myUIDToNodeId(1, myAllocator), + myRefUIDToRefId(1, myAllocator) + { + myHistoryLog.SetAllocator(myAllocator); + } +}; + +#endif // _BRepGraph_Data_HeaderFile diff --git a/opencascade/BRepGraph_Deduplicate.hxx b/opencascade/BRepGraph_Deduplicate.hxx new file mode 100644 index 000000000..2387356bb --- /dev/null +++ b/opencascade/BRepGraph_Deduplicate.hxx @@ -0,0 +1,84 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Deduplicate_HeaderFile +#define _BRepGraph_Deduplicate_HeaderFile + +#include + +#include +#include +#include +#include + +//! @brief Deep geometry deduplication algorithm over an existing BRepGraph. +//! +//! This algorithm canonicalizes deep-equal geometry references (surfaces and +//! 3D curves) using GeomHash hashers. It updates face/edge definition links to +//! canonical geometry nodes and can record lineage in graph history. +//! +//! First implementation intentionally does not merge edge/face definitions yet. +class BRepGraph_Deduplicate +{ +public: + DEFINE_STANDARD_ALLOC + + //! Configuration for graph deduplication run. + struct Options + { + bool AnalyzeOnly = false; + bool HistoryMode = true; + bool MergeEntitiesWhenSafe = false; + double CompTolerance = Precision::Angular(); + double HashTolerance = Precision::Confusion(); + }; + + //! Result counters for diagnostics and tests. + struct Result + { + int NbCanonicalSurfaces = 0; + int NbCanonicalCurves = 0; + int NbSurfaceRewrites = 0; + int NbCurveRewrites = 0; + int NbNullifiedSurfaces = 0; + int NbNullifiedCurves = 0; + int NbHistoryRecords = 0; + bool IsEntityMergeApplied = false; + + //! Topology definition merge counters (active when MergeEntitiesWhenSafe = true). + int NbMergedVertices = 0; + int NbMergedEdges = 0; + int NbMergedWires = 0; + int NbMergedFaces = 0; + + NCollection_DynamicArray AffectedFaces; //!< Faces whose SurfNodeId changed. + NCollection_DynamicArray AffectedEdges; //!< Edges whose CurveNodeId changed. + }; + + //! Run deduplication on a built graph. + //! @param[in,out] theGraph graph to update + //! @return dedup statistics + [[nodiscard]] Standard_EXPORT static Result Perform(BRepGraph& theGraph); + + //! Run deduplication on a built graph. + //! @param[in,out] theGraph graph to update + //! @param[in] theOptions dedup configuration + //! @return dedup statistics + [[nodiscard]] Standard_EXPORT static Result Perform(BRepGraph& theGraph, + const Options& theOptions); + +private: + BRepGraph_Deduplicate() = delete; +}; + +#endif // _BRepGraph_Deduplicate_HeaderFile diff --git a/opencascade/BRepGraph_DeferredScope.hxx b/opencascade/BRepGraph_DeferredScope.hxx new file mode 100644 index 000000000..5f6a1cfc0 --- /dev/null +++ b/opencascade/BRepGraph_DeferredScope.hxx @@ -0,0 +1,79 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_DeferredScope_HeaderFile +#define _BRepGraph_DeferredScope_HeaderFile + +#include +#include + +//! @brief RAII guard for batch mutation scopes with deferred invalidation. +//! +//! Activates deferred invalidation on construction and flushes it on destruction, +//! followed by CommitMutation validation. Guarantees exception-safe cleanup: +//! when this guard owns deferred mode, it is always closed and boundary checks +//! are executed at scope exit. EndDeferredInvalidation() batch-propagates +//! SubtreeGen upward, then CommitMutation() validates reverse-index consistency +//! and active-entity counts. +//! +//! Re-entrant: if deferred mode is already active (e.g., nested guard), +//! the inner guard is a no-op. Only the outermost guard flushes and commits, +//! so nested scopes do not create separate transaction or validation boundaries. +//! +//! @warning This guard batches invalidation and propagation; it is NOT a +//! transaction and does not serialize mutation bodies. Concurrent `Mut*()` +//! usage still requires external synchronization for the whole guarded scope +//! (for example, a mutex protecting exclusive Builder() access until the guard +//! is destroyed). +//! +//! Usage: +//! @code +//! { +//! BRepGraph_DeferredScope aScope(theGraph); +//! for (int i = 0; i < N; ++i) +//! { +//! // mutations +//! } +//! } // EndDeferredInvalidation + CommitMutation called here +//! @endcode +class BRepGraph_DeferredScope +{ +public: + //! Begin deferred invalidation if not already active. + explicit BRepGraph_DeferredScope(BRepGraph& theGraph) + : myGraph(theGraph), + myOwnsScope(!theGraph.Editor().IsDeferredMode()) + { + if (myOwnsScope) + myGraph.Editor().BeginDeferredInvalidation(); + } + + //! End deferred invalidation and validate reverse index + active counts. + ~BRepGraph_DeferredScope() + { + if (myOwnsScope) + { + myGraph.Editor().EndDeferredInvalidation(); + myGraph.Editor().CommitMutation(); + } + } + + BRepGraph_DeferredScope(const BRepGraph_DeferredScope&) = delete; + BRepGraph_DeferredScope& operator=(const BRepGraph_DeferredScope&) = delete; + +private: + BRepGraph& myGraph; + bool myOwnsScope; +}; + +#endif // _BRepGraph_DeferredScope_HeaderFile diff --git a/opencascade/BRepGraph_DefsIterator.hxx b/opencascade/BRepGraph_DefsIterator.hxx new file mode 100644 index 000000000..3ea84451e --- /dev/null +++ b/opencascade/BRepGraph_DefsIterator.hxx @@ -0,0 +1,644 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_DefsIterator_HeaderFile +#define _BRepGraph_DefsIterator_HeaderFile + +#include +#include +#include + +#include + +//! @brief Single-level typed iterators over active child definitions. +//! +//! These iterators do not recurse and do not accumulate location/orientation. +//! They provide a lightweight alternative to BRepGraph_ChildExplorer when the +//! caller only needs the direct active children of one parent definition. +//! +//! The iterator skips: +//! - removed reference entries +//! - invalid child ids +//! - removed child definitions +namespace BRepGraph_DefsIterator +{ +template +struct BaseTraits +{ + using ParentId = ParentIdT; + using RefId = RefIdT; + using RefEntry = RefEntryT; + using ChildId = ChildIdT; + using ChildDef = ChildDefT; +}; + +template +inline const BRepGraphInc::BaseDef* childBaseDef(const BRepGraph& theGraph, + const ChildIdT theChildId) +{ + return theGraph.Topo().Gen().TopoEntity(BRepGraph_NodeId(theChildId)); +} + +inline const BRepGraphInc::BaseDef* childBaseDef(const BRepGraph& theGraph, + const BRepGraph_NodeId theChildId) +{ + return theGraph.Topo().Gen().TopoEntity(theChildId); +} + +struct ShellOfSolidTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Solids().Nb()) + && !theGraph.Topo().Solids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Solids().Definition(theParent).ShellRefIds; + } + + static const BRepGraphInc::ShellRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Shells().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::ShellRef& theRef) + { + return theRef.ShellDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Shells().Definition(theChildId); + } +}; + +struct FaceOfShellTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Shells().Nb()) + && !theGraph.Topo().Shells().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Shells().Definition(theParent).FaceRefIds; + } + + static const BRepGraphInc::FaceRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Faces().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::FaceRef& theRef) + { + return theRef.FaceDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Faces().Definition(theChildId); + } +}; + +struct ChildOfShellTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Shells().Nb()) + && !theGraph.Topo().Shells().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Shells().Definition(theParent).AuxChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return *theGraph.Topo().Gen().TopoEntity(theChildId); + } +}; + +struct WireOfFaceTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Faces().Nb()) + && !theGraph.Topo().Faces().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Faces().Definition(theParent).WireRefIds; + } + + static const BRepGraphInc::WireRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Wires().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::WireRef& theRef) + { + return theRef.WireDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Wires().Definition(theChildId); + } +}; + +struct VertexOfFaceTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Faces().Nb()) + && !theGraph.Topo().Faces().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Faces().Definition(theParent).VertexRefIds; + } + + static const BRepGraphInc::VertexRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Vertices().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::VertexRef& theRef) + { + return theRef.VertexDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Vertices().Definition(theChildId); + } +}; + +struct CoEdgeOfWireTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Wires().Nb()) + && !theGraph.Topo().Wires().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Wires().Definition(theParent).CoEdgeRefIds; + } + + static const BRepGraphInc::CoEdgeRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().CoEdges().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::CoEdgeRef& theRef) + { + return theRef.CoEdgeDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().CoEdges().Definition(theChildId); + } +}; + +struct EdgeOfWireTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Wires().Nb()) + && !theGraph.Topo().Wires().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Wires().Definition(theParent).CoEdgeRefIds; + } + + static const BRepGraphInc::CoEdgeRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().CoEdges().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph& theGraph, const BRepGraphInc::CoEdgeRef& theRef) + { + const BRepGraph_CoEdgeId aCoEdgeId = theRef.CoEdgeDefId; + if (!aCoEdgeId.IsValid(theGraph.Topo().CoEdges().Nb())) + { + return ChildId(); + } + + const BRepGraphInc::CoEdgeDef& aCoEdge = theGraph.Topo().CoEdges().Definition(aCoEdgeId); + if (aCoEdge.IsRemoved) + { + return ChildId(); + } + return aCoEdge.EdgeDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Edges().Definition(theChildId); + } +}; + +struct SolidOfCompSolidTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().CompSolids().Nb()) + && !theGraph.Topo().CompSolids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().CompSolids().Definition(theParent).SolidRefIds; + } + + static const BRepGraphInc::SolidRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Solids().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::SolidRef& theRef) + { + return theRef.SolidDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Solids().Definition(theChildId); + } +}; + +struct ChildOfSolidTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Solids().Nb()) + && !theGraph.Topo().Solids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Solids().Definition(theParent).AuxChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return *theGraph.Topo().Gen().TopoEntity(theChildId); + } +}; + +struct ChildOfCompoundTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Compounds().Nb()) + && !theGraph.Topo().Compounds().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Compounds().Definition(theParent).ChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return *theGraph.Topo().Gen().TopoEntity(theChildId); + } +}; + +struct OccurrenceOfProductTraits : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Products().Nb()) + && !theGraph.Topo().Products().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Products().Definition(theParent).OccurrenceRefIds; + } + + static const BRepGraphInc::OccurrenceRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Occurrences().Entry(theRefId); + } + + static ChildId ChildIdOf(const BRepGraph&, const BRepGraphInc::OccurrenceRef& theRef) + { + return theRef.OccurrenceDefId; + } + + static const ChildDef& Child(const BRepGraph& theGraph, const ChildId theChildId) + { + return theGraph.Topo().Occurrences().Definition(theChildId); + } +}; + +template +class DefsOfParent +{ +public: + using ParentId = typename TraitsT::ParentId; + using RefId = typename TraitsT::RefId; + using ChildId = typename TraitsT::ChildId; + using ChildDef = typename TraitsT::ChildDef; + + DefsOfParent(const BRepGraph& theGraph, const ParentId theParent) + : myGraph(theGraph) + { + if (!TraitsT::IsParentValid(theGraph, theParent)) + { + return; + } + + myRefIds = &TraitsT::RefIds(theGraph, theParent); + myLength = static_cast(myRefIds->Size()); + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myRefIds != nullptr && myIndex < myLength; } + + void Next() + { + ++myIndex; + skipRemoved(); + } + + [[nodiscard]] ChildId CurrentId() const + { + return TraitsT::ChildIdOf(myGraph, + TraitsT::Ref(myGraph, myRefIds->Value(static_cast(myIndex)))); + } + + [[nodiscard]] const ChildDef& Current() const { return TraitsT::Child(myGraph, CurrentId()); } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + void skipRemoved() + { + while (myRefIds != nullptr && myIndex < myLength) + { + const typename TraitsT::RefEntry& aRef = + TraitsT::Ref(myGraph, myRefIds->Value(static_cast(myIndex))); + if (!aRef.IsRemoved) + { + const BRepGraphInc::BaseDef* aChildDef = + childBaseDef(myGraph, TraitsT::ChildIdOf(myGraph, aRef)); + if (aChildDef != nullptr && !aChildDef->IsRemoved) + { + return; + } + } + ++myIndex; + } + } + + const BRepGraph& myGraph; + const NCollection_DynamicArray* myRefIds = nullptr; + uint32_t myIndex = 0; + uint32_t myLength = 0; +}; + +//! @brief Direct active vertex children of an edge. +//! +//! Iteration order is start vertex, end vertex, then internal/external vertices. +class DefsVertexOfEdge +{ +public: + using ChildId = BRepGraph_VertexId; + using ChildDef = BRepGraphInc::VertexDef; + + DefsVertexOfEdge(const BRepGraph& theGraph, const BRepGraph_EdgeId theEdgeId) + : myGraph(theGraph) + { + if (!theEdgeId.IsValid(theGraph.Topo().Edges().Nb()) + || theGraph.Topo().Edges().Definition(theEdgeId).IsRemoved) + { + return; + } + + myEdge = &theGraph.Topo().Edges().Definition(theEdgeId); + myLength = 2u + static_cast(myEdge->InternalVertexRefIds.Size()); + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myEdge != nullptr && myIndex < myLength; } + + void Next() + { + ++myIndex; + skipRemoved(); + } + + [[nodiscard]] ChildId CurrentId() const + { + return myGraph.Refs().Vertices().Entry(currentRefId()).VertexDefId; + } + + [[nodiscard]] const ChildDef& Current() const + { + return myGraph.Topo().Vertices().Definition(CurrentId()); + } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + [[nodiscard]] BRepGraph_VertexRefId refIdAt(const uint32_t theIndex) const + { + if (theIndex == 0) + { + return myEdge->StartVertexRefId; + } + if (theIndex == 1) + { + return myEdge->EndVertexRefId; + } + return myEdge->InternalVertexRefIds.Value(static_cast(theIndex - 2)); + } + + [[nodiscard]] BRepGraph_VertexRefId currentRefId() const { return refIdAt(myIndex); } + + void skipRemoved() + { + while (myEdge != nullptr && myIndex < myLength) + { + const BRepGraph_VertexRefId aRefId = refIdAt(myIndex); + if (aRefId.IsValid()) + { + const BRepGraphInc::VertexRef& aRef = myGraph.Refs().Vertices().Entry(aRefId); + if (!aRef.IsRemoved) + { + const BRepGraphInc::BaseDef* aChildDef = + myGraph.Topo().Gen().TopoEntity(BRepGraph_NodeId(aRef.VertexDefId)); + if (aChildDef != nullptr && !aChildDef->IsRemoved) + { + return; + } + } + } + ++myIndex; + } + } + + const BRepGraph& myGraph; + const BRepGraphInc::EdgeDef* myEdge = nullptr; + uint32_t myIndex = 0; + uint32_t myLength = 0; +}; + +} // namespace BRepGraph_DefsIterator + +using BRepGraph_DefsShellOfSolid = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsFaceOfShell = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsChildOfShell = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsEdgeOfWire = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsWireOfFace = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsVertexOfFace = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsCoEdgeOfWire = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsChildOfSolid = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsSolidOfCompSolid = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsChildOfCompound = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsOccurrenceOfProduct = + BRepGraph_DefsIterator::DefsOfParent; +using BRepGraph_DefsVertexOfEdge = BRepGraph_DefsIterator::DefsVertexOfEdge; + +#endif // _BRepGraph_DefsIterator_HeaderFile \ No newline at end of file diff --git a/opencascade/BRepGraph_EditorView.hxx b/opencascade/BRepGraph_EditorView.hxx new file mode 100644 index 000000000..66787020b --- /dev/null +++ b/opencascade/BRepGraph_EditorView.hxx @@ -0,0 +1,1446 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_EditorView_HeaderFile +#define _BRepGraph_EditorView_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class Geom_Surface; +class Geom_Curve; +class Geom2d_Curve; +class Poly_Triangulation; +class Poly_Polygon3D; +class Poly_Polygon2D; +class Poly_PolygonOnTriangulation; + +//! @brief Non-const view for programmatic graph construction and structural editing. +//! +//! The single mutation entry point for a BRepGraph instance. Provides: +//! - Structural creation via entity-scoped nested Ops classes (VertexOps, EdgeOps, +//! CoEdgeOps, WireOps, FaceOps, ShellOps, SolidOps, CompoundOps, CompSolidOps, +//! ProductOps, GenOps) to create topology definition nodes (vertices, edges, wires, +//! faces, shells, solids, compounds) and assembly nodes (products, occurrences) +//! without an existing TopoDS_Shape. +//! - Field-level RAII-scoped mutation via Mut*() guards (Edges().Mut, Faces().Mut, +//! Products().Mut, Occurrences().Mut, Reps().MutSurface, etc.) with automatic cache invalidation +//! and upward SubtreeGen propagation on guard destruction. +//! - Incremental shape appending, soft-deletion of nodes, and deferred invalidation +//! mode for batched structural edit loops under external serialization. +//! Obtained via BRepGraph::Editor(). +//! +//! Each Ops class is accessed via a non-const reference accessor: +//! theGraph.Editor().Vertices().Add(...) +//! theGraph.Editor().Edges().Add(...) +//! theGraph.Editor().CoEdges().SetPCurve(...) +//! theGraph.Editor().Gen().RemoveNode(...) +//! +//! Contract notes: +//! - Add* methods return BRepGraph_NodeId() on invalid inputs and do not +//! partially modify the graph; call IsValid() on the returned id to check +//! success +//! - invalid inputs include wrong kind, out-of-range ids, or removed referenced +//! nodes unless a method documents stricter accepted-input rules +//! - linking methods such as Shells().Add() and Solids().Add() +//! return an invalid typed RefId on failure and otherwise keep ownership explicit +//! in the reference layer +//! - use Mut*() guards for scoped field mutation on existing active +//! definitions, references, and representations +class BRepGraph::EditorView +{ +public: + //! Representation mutation guards (Surface, Curve3D, Curve2D, Triangulation, + //! Polygon3D, Polygon2D, PolygonOnTri). All `Mut*()` accessors raise + //! `Standard_ProgramError` for null, out-of-range, or removed typed ids. + //! Access via `BRepGraph::EditorView::Reps()`. + class RepOps + { + public: + //! Return scoped mutable surface representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutSurface( + const BRepGraph_SurfaceRepId theSurface); + //! Return scoped mutable 3D curve representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutCurve3D( + const BRepGraph_Curve3DRepId theCurve); + //! Return scoped mutable 2D curve representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutCurve2D( + const BRepGraph_Curve2DRepId theCurve); + //! Return scoped mutable triangulation representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard + MutTriangulation(const BRepGraph_TriangulationRepId theTriangulation); + //! Return scoped mutable 3D polygon representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutPolygon3D( + const BRepGraph_Polygon3DRepId thePolygon); + //! Return scoped mutable 2D polygon representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutPolygon2D( + const BRepGraph_Polygon2DRepId thePolygon); + //! Return scoped mutable polygon-on-triangulation representation guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutPolygonOnTri( + const BRepGraph_PolygonOnTriRepId thePolygon); + + //! Set the surface handle on a SurfaceRep. + Standard_EXPORT void SetSurface(const BRepGraph_SurfaceRepId theRep, + const occ::handle& theSurface); + Standard_EXPORT void SetSurface(BRepGraph_MutGuard& theMut, + const occ::handle& theSurface); + + //! Set the 3D curve handle on a Curve3DRep. + Standard_EXPORT void SetCurve3D(const BRepGraph_Curve3DRepId theRep, + const occ::handle& theCurve); + Standard_EXPORT void SetCurve3D(BRepGraph_MutGuard& theMut, + const occ::handle& theCurve); + + //! Set the 2D curve handle on a Curve2DRep. + Standard_EXPORT void SetCurve2D(const BRepGraph_Curve2DRepId theRep, + const occ::handle& theCurve); + Standard_EXPORT void SetCurve2D(BRepGraph_MutGuard& theMut, + const occ::handle& theCurve); + + //! Set the triangulation handle on a TriangulationRep. + Standard_EXPORT void SetTriangulation(const BRepGraph_TriangulationRepId theRep, + const occ::handle& theTri); + Standard_EXPORT void SetTriangulation( + BRepGraph_MutGuard& theMut, + const occ::handle& theTri); + + //! Set the polygon handle on a Polygon3DRep. + Standard_EXPORT void SetPolygon3D(const BRepGraph_Polygon3DRepId theRep, + const occ::handle& thePolygon); + Standard_EXPORT void SetPolygon3D(BRepGraph_MutGuard& theMut, + const occ::handle& thePolygon); + + //! Set the polygon handle on a Polygon2DRep. + Standard_EXPORT void SetPolygon2D(const BRepGraph_Polygon2DRepId theRep, + const occ::handle& thePolygon); + Standard_EXPORT void SetPolygon2D(BRepGraph_MutGuard& theMut, + const occ::handle& thePolygon); + + //! Set the polygon-on-triangulation handle on a PolygonOnTriRep. + Standard_EXPORT void SetPolygonOnTri( + const BRepGraph_PolygonOnTriRepId theRep, + const occ::handle& thePolygon); + Standard_EXPORT void SetPolygonOnTri( + BRepGraph_MutGuard& theMut, + const occ::handle& thePolygon); + + //! Set the triangulation rep id linked to a PolygonOnTriRep. + Standard_EXPORT void SetPolygonOnTriTriangulationId( + const BRepGraph_PolygonOnTriRepId theRep, + const BRepGraph_TriangulationRepId theTriRep); + Standard_EXPORT void SetPolygonOnTriTriangulationId( + BRepGraph_MutGuard& theMut, + const BRepGraph_TriangulationRepId theTriRep); + + private: + friend class EditorView; + + explicit RepOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Vertex creation operations. + class VertexOps + { + public: + //! Add a vertex definition to the graph. + //! @param[in] thePoint 3D coordinates + //! @param[in] theTolerance vertex tolerance + //! @return typed vertex definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_VertexId Add(const gp_Pnt& thePoint, + const double theTolerance); + + //! Return scoped mutable vertex definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_VertexId theVertex); + + //! Return scoped mutable vertex reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_VertexRefId theVertexRef); + + //! Set the 3D point of a vertex definition and fire immediate notification. + //! @param[in] theVertex typed vertex definition identifier + //! @param[in] thePoint new 3D coordinates + Standard_EXPORT void SetPoint(const BRepGraph_VertexId theVertex, const gp_Pnt& thePoint); + + //! Set the 3D point of a vertex definition inside a batched mutation scope. + //! Marks the guard dirty so the destructor fires a single notification. + //! @param[in] theMut active mutable vertex guard + //! @param[in] thePoint new 3D coordinates + Standard_EXPORT void SetPoint(BRepGraph_MutGuard& theMut, + const gp_Pnt& thePoint); + + //! Set the tolerance of a vertex definition. + Standard_EXPORT void SetTolerance(const BRepGraph_VertexId theVertex, + const double theTolerance); + + //! Set the tolerance inside a batched mutation scope. + Standard_EXPORT void SetTolerance(BRepGraph_MutGuard& theMut, + const double theTolerance); + + //! Set the orientation of a vertex reference. + Standard_EXPORT void SetRefOrientation(const BRepGraph_VertexRefId theVertexRef, + const TopAbs_Orientation theOrientation); + + //! Set the orientation inside a batched mutation scope. + Standard_EXPORT void SetRefOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Set the local location of a vertex reference and fire immediate notification. + //! @param[in] theVertexRef typed vertex reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_VertexRefId theVertexRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a vertex reference inside a batched mutation scope. + //! @param[in] theMut active mutable vertex reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Rewire a vertex reference to a different vertex def (rebinds VertexToEdges if parent is + //! Edge). + Standard_EXPORT void SetRefVertexDefId(const BRepGraph_VertexRefId theVertexRef, + const BRepGraph_VertexId theVertex); + Standard_EXPORT void SetRefVertexDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_VertexId theVertex); + + private: + friend class EditorView; + + explicit VertexOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Edge creation and editing operations. + class EdgeOps + { + public: + //! Add an edge definition to the graph. + //! @param[in] theStartVtx typed start vertex definition identifier + //! @param[in] theEndVtx typed end vertex definition identifier + //! @param[in] theCurve 3D curve (may be null for degenerate edges) + //! @param[in] theFirst first curve parameter + //! @param[in] theLast last curve parameter + //! @param[in] theTolerance edge tolerance + //! @return typed edge definition identifier, or invalid if either referenced + //! vertex id is out of range or removed + [[nodiscard]] Standard_EXPORT BRepGraph_EdgeId Add(const BRepGraph_VertexId theStartVtx, + const BRepGraph_VertexId theEndVtx, + const occ::handle& theCurve, + const double theFirst, + const double theLast, + const double theTolerance); + + //! Add an internal or external direct vertex usage to an edge definition. + //! The vertex is stored in EdgeDef.InternalVertexRefIds; boundary start/end + //! vertices remain owned by StartVertexRefId and EndVertexRefId. + //! @param[in] theEdgeEntity typed edge definition identifier + //! @param[in] theVertexEntity typed vertex definition identifier + //! @param[in] theOri orientation of the direct vertex usage on the edge + //! @return typed vertex reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_VertexRefId + AddInternalVertex(const BRepGraph_EdgeId theEdgeEntity, + const BRepGraph_VertexId theVertexEntity, + const TopAbs_Orientation theOri = TopAbs_INTERNAL); + + //! Split a single edge definition at a vertex and 3D-curve parameter. + //! Creates two new EdgeDef slots, splits all PCurve nodes at the corresponding + //! 2D parameter, and updates every wire that contained the original edge. + //! @param[in] theEdgeEntity edge to split (must not be degenerate) + //! @param[in] theSplitVertex vertex definition at the split point (already in graph) + //! @param[in] theSplitParam parameter on the 3D curve at the split point + //! @param[out] theSubA sub-edge: StartVertex -> SplitVertex + //! @param[out] theSubB sub-edge: SplitVertex -> EndVertex + Standard_EXPORT void Split(const BRepGraph_EdgeId theEdgeEntity, + const BRepGraph_VertexId theSplitVertex, + const double theSplitParam, + BRepGraph_EdgeId& theSubA, + BRepGraph_EdgeId& theSubB); + + //! Detach one exact direct vertex ref from an edge definition. + //! Supports both boundary fixed slots (StartVertexRefId / EndVertexRefId) and + //! entries stored in EdgeDef.InternalVertexRefIds. + //! @param[in] theEdgeDefId edge definition identifier + //! @param[in] theVertexRefId exact edge-owned vertex reference identifier + //! @return true if the active edge-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveVertex(const BRepGraph_EdgeId theEdgeDefId, + const BRepGraph_VertexRefId theVertexRefId); + + //! Remap one edge-owned vertex reference to point at a different vertex + //! definition, preserving the existing orientation and local location. + //! Intended for boundary-vertex substitution without a full edge rebuild + //! (e.g. stitching shared endpoints after a ShapeFix pass). + //! @param[in] theEdgeDefId edge owning the vertex reference + //! @param[in] theOldVertexRefId exact vertex reference to remap (boundary or internal) + //! @param[in] theNewVertexDefId replacement vertex definition + //! @return typed id of the newly created vertex reference, or invalid if + //! any input was inactive or the old ref did not belong to this edge + [[nodiscard]] Standard_EXPORT BRepGraph_VertexRefId + ReplaceVertex(const BRepGraph_EdgeId theEdgeDefId, + const BRepGraph_VertexRefId theOldVertexRefId, + const BRepGraph_VertexId theNewVertexDefId); + + //! Return scoped mutable edge definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_EdgeId theEdge); + + //! Returns true iff the edge appears as a seam on the given face (two CoEdges + //! of theEdge share theFace). + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace typed face definition identifier + //! @return true if the edge is a seam on the given face + [[nodiscard]] Standard_EXPORT bool IsSeamOnFace(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace) const; + + //! Set the geometric regularity (C^k) for an edge across a pair of faces in + //! BRepGraph_LayerRegularity. theFace1 == theFace2 sets the seam continuity + //! across the closed-surface seam line. Requires the layer to be registered. + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace1 first face (or seam face when theFace2 == theFace1) + //! @param[in] theFace2 second face + //! @param[in] theContinuity continuity (GeomAbs_Shape) + //! @return true if written; false if the layer is not registered + Standard_EXPORT bool SetRegularity(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2, + const GeomAbs_Shape theContinuity); + + //! Set the tolerance of an edge definition and fire immediate notification. + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theTolerance new tolerance value + Standard_EXPORT void SetTolerance(const BRepGraph_EdgeId theEdge, double theTolerance); + + //! Set the tolerance of an edge definition inside a batched mutation scope. + //! @param[in] theMut active mutable edge guard + //! @param[in] theTolerance new tolerance value + Standard_EXPORT void SetTolerance(BRepGraph_MutGuard& theMut, + double theTolerance); + + //! Set the parametric range of an edge definition. + Standard_EXPORT void SetParamRange(const BRepGraph_EdgeId theEdge, + const double theFirst, + const double theLast); + Standard_EXPORT void SetParamRange(BRepGraph_MutGuard& theMut, + const double theFirst, + const double theLast); + + //! Set the SameParameter flag of an edge definition. + Standard_EXPORT void SetSameParameter(const BRepGraph_EdgeId theEdge, + const bool theSameParameter); + Standard_EXPORT void SetSameParameter(BRepGraph_MutGuard& theMut, + const bool theSameParameter); + + //! Set the SameRange flag of an edge definition. + Standard_EXPORT void SetSameRange(const BRepGraph_EdgeId theEdge, const bool theSameRange); + Standard_EXPORT void SetSameRange(BRepGraph_MutGuard& theMut, + const bool theSameRange); + + //! Set the IsDegenerate flag of an edge definition. + Standard_EXPORT void SetDegenerate(const BRepGraph_EdgeId theEdge, const bool theIsDegenerate); + Standard_EXPORT void SetDegenerate(BRepGraph_MutGuard& theMut, + const bool theIsDegenerate); + + //! Set the Curve3DRep id bound to an edge (invalid id clears the binding). + Standard_EXPORT void SetCurve3DRepId(const BRepGraph_EdgeId theEdge, + const BRepGraph_Curve3DRepId theRep); + Standard_EXPORT void SetCurve3DRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_Curve3DRepId theRep); + + //! Set the Polygon3DRep id bound to an edge (invalid id clears the binding). + Standard_EXPORT void SetPolygon3DRepId(const BRepGraph_EdgeId theEdge, + const BRepGraph_Polygon3DRepId theRep); + Standard_EXPORT void SetPolygon3DRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_Polygon3DRepId theRep); + + //! Set the IsClosed flag (StartVertex == EndVertex topology) of an edge. + Standard_EXPORT void SetIsClosed(const BRepGraph_EdgeId theEdge, const bool theIsClosed); + Standard_EXPORT void SetIsClosed(BRepGraph_MutGuard& theMut, + const bool theIsClosed); + + //! Set the start vertex-ref id (rebinds VertexToEdges). Caller maintains reverse indices. + Standard_EXPORT void SetStartVertexRefId(const BRepGraph_EdgeId theEdge, + const BRepGraph_VertexRefId theVertexRef); + Standard_EXPORT void SetStartVertexRefId(BRepGraph_MutGuard& theMut, + const BRepGraph_VertexRefId theVertexRef); + + //! Set the end vertex-ref id (rebinds VertexToEdges). Caller maintains reverse indices. + Standard_EXPORT void SetEndVertexRefId(const BRepGraph_EdgeId theEdge, + const BRepGraph_VertexRefId theVertexRef); + Standard_EXPORT void SetEndVertexRefId(BRepGraph_MutGuard& theMut, + const BRepGraph_VertexRefId theVertexRef); + + private: + friend class EditorView; + + explicit EdgeOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief CoEdge and PCurve operations. + class CoEdgeOps + { + public: + //! Create a new Curve2DRep in storage and return its typed identifier. + //! Use this when assigning a new PCurve to an existing CoEdge entity + //! via Editor().MutCoEdge() inside a larger mutation sequence. + //! For one-shot creation and binding of a face-context PCurve, use + //! AddPCurve(). + //! @param[in] theCurve2d the 2D parametric curve handle + //! @return typed Curve2DRep identifier, or invalid if the curve is null + [[nodiscard]] Standard_EXPORT BRepGraph_Curve2DRepId + CreateCurve2DRep(const occ::handle& theCurve2d); + + //! Assign or clear the PCurve bound to an existing coedge. + //! Creates a new Curve2DRep for non-null curves and stores its id on the coedge. + //! Pass a null handle to clear the stored PCurve binding. + //! @param[in] theCoEdge typed coedge identifier to update + //! @param[in] theCurve2d new 2D curve geometry, or null to clear + Standard_EXPORT void SetPCurve(const BRepGraph_CoEdgeId theCoEdge, + const occ::handle& theCurve2d); + + //! Attach a PCurve to an edge for a given face context. + //! Creates a new CoEdge entity with Curve2DRep and updates reverse indices. + //! This always appends a new CoEdge entry for the edge-face pair; callers + //! should avoid duplicate creation unless multiple bindings are intentional + //! for the modeled topology. + //! Prefer this route when the caller needs to add a face-context PCurve in + //! one operation. For editing an already identified CoEdge inside a larger + //! mutation sequence, use CreateCurve2DRep() with Editor().MutCoEdge(). + //! @param[in] theEdgeEntity typed edge definition identifier + //! @param[in] theFaceEntity typed face definition identifier + //! @param[in] theCurve2d 2D curve geometry + //! @param[in] theFirst first curve parameter + //! @param[in] theLast last curve parameter + //! @param[in] theEdgeOrientation edge orientation on the face + Standard_EXPORT void AddPCurve(const BRepGraph_EdgeId theEdgeEntity, + const BRepGraph_FaceId theFaceEntity, + const occ::handle& theCurve2d, + const double theFirst, + const double theLast, + const TopAbs_Orientation theEdgeOrientation = TopAbs_FORWARD); + + //! Return scoped mutable coedge definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_CoEdgeId theCoEdge); + + //! Return scoped mutable coedge reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_CoEdgeRefId theCoEdgeRef); + + //! Set the parametric range of a coedge definition and fire immediate notification. + //! @param[in] theCoEdge typed coedge definition identifier + //! @param[in] theFirst new first parameter value + //! @param[in] theLast new last parameter value + Standard_EXPORT void SetParamRange(const BRepGraph_CoEdgeId theCoEdge, + double theFirst, + double theLast); + + //! Set the parametric range of a coedge definition inside a batched mutation scope. + //! @param[in] theMut active mutable coedge guard + //! @param[in] theFirst new first parameter value + //! @param[in] theLast new last parameter value + Standard_EXPORT void SetParamRange(BRepGraph_MutGuard& theMut, + double theFirst, + double theLast); + + //! Set the local location of a coedge reference and fire immediate notification. + //! @param[in] theCoEdgeRef typed coedge reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_CoEdgeRefId theCoEdgeRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a coedge reference inside a batched mutation scope. + //! @param[in] theMut active mutable coedge reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Rewire a coedge reference to a different coedge def (rebinds CoEdgeToWires + EdgeToWires). + Standard_EXPORT void SetRefCoEdgeDefId(const BRepGraph_CoEdgeRefId theCoEdgeRef, + const BRepGraph_CoEdgeId theCoEdge); + Standard_EXPORT void SetRefCoEdgeDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_CoEdgeId theCoEdge); + + //! Set the orientation of a coedge definition. + Standard_EXPORT void SetOrientation(const BRepGraph_CoEdgeId theCoEdge, + const TopAbs_Orientation theOrientation); + Standard_EXPORT void SetOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Set the UV box (UV1 = at ParamFirst, UV2 = at ParamLast) of a coedge definition. + Standard_EXPORT void SetUVBox(const BRepGraph_CoEdgeId theCoEdge, + const gp_Pnt2d& theUV1, + const gp_Pnt2d& theUV2); + Standard_EXPORT void SetUVBox(BRepGraph_MutGuard& theMut, + const gp_Pnt2d& theUV1, + const gp_Pnt2d& theUV2); + + //! Continuity is a property of (Edge, Face1, Face2) and lives in + //! BRepGraph_LayerRegularity. Use EditorView::EdgeOps::SetRegularity to write, + //! BRepGraph_Tool::Edge::Continuity to read. + + //! Set the Curve2DRep id bound to a coedge (invalid id clears the binding). + Standard_EXPORT void SetCurve2DRepId(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_Curve2DRepId theRep); + Standard_EXPORT void SetCurve2DRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_Curve2DRepId theRep); + + //! Set the Polygon2DRep id bound to a coedge. + Standard_EXPORT void SetPolygon2DRepId(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_Polygon2DRepId theRep); + Standard_EXPORT void SetPolygon2DRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_Polygon2DRepId theRep); + + //! Set the PolygonOnTriRep id bound to a coedge. + Standard_EXPORT void SetPolygonOnTriRepId(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_PolygonOnTriRepId theRep); + Standard_EXPORT void SetPolygonOnTriRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_PolygonOnTriRepId theRep); + + //! Drop face-bound parametric payload (PCurve, param range, continuity, UVs) + //! while keeping structural links - used when the owning face is removed. + Standard_EXPORT void ClearPCurveBinding(const BRepGraph_CoEdgeId theCoEdge); + Standard_EXPORT void ClearPCurveBinding(BRepGraph_MutGuard& theMut); + + //! Set the seam-pair id linking two coedges of a seam edge (invalid breaks the link). + // To establish seam-ness, ensure two CoEdges exist on the same (Edge, Face) + // with opposite orientations; the seam relation is then queryable via + // BRepGraph_Tool::CoEdge::SeamPair. + + //! Rewire a coedge to a different parent edge (rebinds EdgeToCoEdges, EdgeToWires, + //! EdgeToFaces). Caller maintains reverse indices. + Standard_EXPORT void SetEdgeDefId(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_EdgeId theEdge); + Standard_EXPORT void SetEdgeDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_EdgeId theEdge); + + //! Rewire a coedge to a different owning face (rebinds EdgeToFaces). Caller maintains reverse + //! indices. + Standard_EXPORT void SetFaceDefId(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_FaceId theFace); + Standard_EXPORT void SetFaceDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_FaceId theFace); + + private: + friend class EditorView; + + explicit CoEdgeOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Wire creation and editing operations. + class WireOps + { + public: + //! Add a wire definition to the graph. + //! Each pair is (EdgeDefId, OrientationInWire). + //! @param[in] theEdges ordered edge entries + //! @return typed wire definition identifier, or invalid if any referenced + //! edge entry is invalid + [[nodiscard]] Standard_EXPORT BRepGraph_WireId Add( + const NCollection_DynamicArray>& theEdges); + + //! Replace one edge with another in a wire definition. + //! Updates the CoEdge's EdgeIdx to point to the new edge, adjusts orientation + //! if theReversed, and incrementally updates reverse indices. + //! @param[in] theWireDefId wire definition identifier + //! @param[in] theOldEdgeEntity edge to replace + //! @param[in] theNewEdgeEntity replacement edge + //! @param[in] theReversed if true, reverse the orientation of the replacement + Standard_EXPORT void ReplaceEdge(const BRepGraph_WireId theWireDefId, + const BRepGraph_EdgeId theOldEdgeEntity, + const BRepGraph_EdgeId theNewEdgeEntity, + const bool theReversed); + + //! Detach one exact coedge ref from a wire definition. + //! Use BRepGraph_RefsCoEdgeOfWire::CurrentId() when removing from a wire + //! iterator. The method removes the exact CoEdgeRef entry, erases it from + //! the wire's ordered ref sequence, updates reverse indices, and prunes the + //! CoEdge node when it has no other active usages. + //! @param[in] theWireDefId wire definition identifier + //! @param[in] theCoEdgeRefId exact wire-owned coedge reference identifier + //! @return true if the active wire-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveCoEdge(const BRepGraph_WireId theWireDefId, + const BRepGraph_CoEdgeRefId theCoEdgeRefId); + + //! Return scoped mutable wire definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_WireId theWire); + + //! Return scoped mutable wire reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_WireRefId theWireRef); + + //! Set the IsClosed flag of a wire definition and fire immediate notification. + //! @param[in] theWire typed wire definition identifier + //! @param[in] theIsClosed new closed state + Standard_EXPORT void SetIsClosed(const BRepGraph_WireId theWire, bool theIsClosed); + + //! Set the IsClosed flag of a wire definition inside a batched mutation scope. + //! @param[in] theMut active mutable wire guard + //! @param[in] theIsClosed new closed state + Standard_EXPORT void SetIsClosed(BRepGraph_MutGuard& theMut, + bool theIsClosed); + + //! Set the local location of a wire reference and fire immediate notification. + //! @param[in] theWireRef typed wire reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_WireRefId theWireRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a wire reference inside a batched mutation scope. + //! @param[in] theMut active mutable wire reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Set the IsOuter flag on a wire reference. + Standard_EXPORT void SetRefIsOuter(const BRepGraph_WireRefId theWireRef, const bool theIsOuter); + Standard_EXPORT void SetRefIsOuter(BRepGraph_MutGuard& theMut, + const bool theIsOuter); + + //! Set the orientation of a wire reference. + Standard_EXPORT void SetRefOrientation(const BRepGraph_WireRefId theWireRef, + const TopAbs_Orientation theOrientation); + Standard_EXPORT void SetRefOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Rewire a wire reference to a different wire def (rebinds WireToFaces if parent is Face). + Standard_EXPORT void SetRefWireDefId(const BRepGraph_WireRefId theWireRef, + const BRepGraph_WireId theWire); + Standard_EXPORT void SetRefWireDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_WireId theWire); + + private: + friend class EditorView; + + explicit WireOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Face creation and editing operations. + class FaceOps + { + public: + //! Add a face definition to the graph. + //! @param[in] theSurface surface geometry + //! @param[in] theOuterWire typed outer wire definition identifier + //! @param[in] theInnerWires typed inner wire definition identifiers + //! @param[in] theTolerance face tolerance + //! @return typed face definition identifier, or invalid if any referenced + //! wire id is out of range or removed + [[nodiscard]] Standard_EXPORT BRepGraph_FaceId + Add(const occ::handle& theSurface, + const BRepGraph_WireId theOuterWire, + const NCollection_DynamicArray& theInnerWires, + const double theTolerance); + + //! Add a direct INTERNAL/EXTERNAL vertex usage to a face definition. + //! @param[in] theFaceEntity typed face definition identifier + //! @param[in] theVertexEntity typed vertex definition identifier + //! @param[in] theOri orientation of the direct vertex usage on the face + //! @return typed vertex reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_VertexRefId + AddVertex(const BRepGraph_FaceId theFaceEntity, + const BRepGraph_VertexId theVertexEntity, + const TopAbs_Orientation theOri = TopAbs_INTERNAL); + + //! Detach one exact direct vertex ref from a face definition. + //! Use BRepGraph_RefsVertexOfFace::CurrentId() when removing from a face + //! direct-vertex iterator. + //! @param[in] theFaceDefId face definition identifier + //! @param[in] theVertexRefId exact face-owned vertex reference identifier + //! @return true if the active face-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveVertex(const BRepGraph_FaceId theFaceDefId, + const BRepGraph_VertexRefId theVertexRefId); + + //! Detach one exact wire ref from a face definition. + //! Use BRepGraph_RefsWireOfFace::CurrentId() when removing from a face + //! iterator. The method removes the exact WireRef entry, erases it from + //! the face's ordered ref sequence, rebuilds reverse indices, and prunes the + //! Wire subtree when it has no other active usages. + //! @param[in] theFaceDefId face definition identifier + //! @param[in] theWireRefId exact face-owned wire reference identifier + //! @return true if the active face-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveWire(const BRepGraph_FaceId theFaceDefId, + const BRepGraph_WireRefId theWireRefId); + + //! Return scoped mutable face definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_FaceId theFace); + + //! Return scoped mutable face reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_FaceRefId theFaceRef); + + //! Set the tolerance of a face definition and fire immediate notification. + //! @param[in] theFace typed face definition identifier + //! @param[in] theTolerance new tolerance value + Standard_EXPORT void SetTolerance(const BRepGraph_FaceId theFace, double theTolerance); + + //! Set the tolerance of a face definition inside a batched mutation scope. + //! @param[in] theMut active mutable face guard + //! @param[in] theTolerance new tolerance value + Standard_EXPORT void SetTolerance(BRepGraph_MutGuard& theMut, + double theTolerance); + + //! Set the NaturalRestriction flag of a face definition and fire immediate notification. + //! @param[in] theFace typed face definition identifier + //! @param[in] theNaturalRestriction new flag value + Standard_EXPORT void SetNaturalRestriction(const BRepGraph_FaceId theFace, + bool theNaturalRestriction); + + //! Set the NaturalRestriction flag inside a batched mutation scope. + //! @param[in] theMut active mutable face guard + //! @param[in] theNaturalRestriction new flag value + Standard_EXPORT void SetNaturalRestriction(BRepGraph_MutGuard& theMut, + bool theNaturalRestriction); + + //! Set the triangulation representation id and fire immediate notification. + //! Pass an invalid id to clear the triangulation binding. + //! @param[in] theFace typed face definition identifier + //! @param[in] theRep new triangulation rep identifier (may be invalid to clear) + Standard_EXPORT void SetTriangulationRep(const BRepGraph_FaceId theFace, + const BRepGraph_TriangulationRepId theRep); + + Standard_EXPORT void SetTriangulationRep(BRepGraph_MutGuard& theMut, + const BRepGraph_TriangulationRepId theRep); + + //! Set the SurfaceRep id bound to a face (invalid id clears the binding). + Standard_EXPORT void SetSurfaceRepId(const BRepGraph_FaceId theFace, + const BRepGraph_SurfaceRepId theRep); + Standard_EXPORT void SetSurfaceRepId(BRepGraph_MutGuard& theMut, + const BRepGraph_SurfaceRepId theRep); + + //! Set the orientation of a face reference and fire immediate notification. + //! @param[in] theFaceRef typed face reference identifier + //! @param[in] theOrientation new orientation value + Standard_EXPORT void SetRefOrientation(const BRepGraph_FaceRefId theFaceRef, + TopAbs_Orientation theOrientation); + + //! Set the orientation of a face reference inside a batched mutation scope. + //! @param[in] theMut active mutable face reference guard + //! @param[in] theOrientation new orientation value + Standard_EXPORT void SetRefOrientation(BRepGraph_MutGuard& theMut, + TopAbs_Orientation theOrientation); + + //! Set the local location of a face reference and fire immediate notification. + //! @param[in] theFaceRef typed face reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_FaceRefId theFaceRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a face reference inside a batched mutation scope. + //! @param[in] theMut active mutable face reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Rewire a face reference to a different face def (rebinds FaceToShells if parent is Shell). + Standard_EXPORT void SetRefFaceDefId(const BRepGraph_FaceRefId theFaceRef, + const BRepGraph_FaceId theFace); + Standard_EXPORT void SetRefFaceDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_FaceId theFace); + + private: + friend class EditorView; + + explicit FaceOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Shell creation and editing operations. + class ShellOps + { + public: + //! Add an empty shell definition to the graph. + //! @return typed shell definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_ShellId Add(); + + //! Link a face to a shell. + //! Appends FaceRef and stores its FaceRefId in shell FaceRefIds. + //! @param[in] theShellEntity typed shell definition identifier + //! @param[in] theFaceEntity typed face definition identifier + //! @param[in] theOri orientation of the face in the shell + //! @return typed face reference identifier, or invalid if inputs are not active + Standard_EXPORT BRepGraph_FaceRefId AddFace(const BRepGraph_ShellId theShellEntity, + const BRepGraph_FaceId theFaceEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Link an auxiliary non-face child to a shell. + //! Supported child kinds are Wire and Edge. + //! @param[in] theShellEntity typed shell definition identifier + //! @param[in] theChildEntity typed child definition identifier + //! @param[in] theOri orientation of the child in the shell + //! @return typed child reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_ChildRefId + AddChild(const BRepGraph_ShellId theShellEntity, + const BRepGraph_NodeId theChildEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Detach one exact face ref from a shell definition. + //! Use BRepGraph_RefsFaceOfShell::CurrentId() when removing from a shell + //! iterator. The method removes the exact FaceRef entry, erases it from the + //! shell's ordered ref sequence, rebuilds reverse indices, and prunes the + //! Face subtree when it has no other active usages. + //! @param[in] theShellDefId shell definition identifier + //! @param[in] theFaceRefId exact shell-owned face reference identifier + //! @return true if the active shell-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveFace(const BRepGraph_ShellId theShellDefId, + const BRepGraph_FaceRefId theFaceRefId); + + //! Detach one exact child ref from a shell auxiliary-child sequence. + //! Use BRepGraph_RefsChildOfShell::CurrentId() when removing from a shell + //! aux-child iterator. + //! @param[in] theShellDefId shell definition identifier + //! @param[in] theChildRefId exact shell-owned child reference identifier + //! @return true if the active shell-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveChild(const BRepGraph_ShellId theShellDefId, + const BRepGraph_ChildRefId theChildRefId); + + //! Return scoped mutable shell definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_ShellId theShell); + + //! Return scoped mutable shell reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_ShellRefId theShellRef); + + //! Set the local location of a shell reference and fire immediate notification. + //! @param[in] theShellRef typed shell reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_ShellRefId theShellRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a shell reference inside a batched mutation scope. + //! @param[in] theMut active mutable shell reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Set the orientation of a shell reference. + Standard_EXPORT void SetRefOrientation(const BRepGraph_ShellRefId theShellRef, + const TopAbs_Orientation theOrientation); + + //! Set the orientation inside a batched mutation scope. + Standard_EXPORT void SetRefOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Rewire a shell reference to a different shell def (rebinds ShellToSolids if parent is + //! Solid). + Standard_EXPORT void SetRefShellDefId(const BRepGraph_ShellRefId theShellRef, + const BRepGraph_ShellId theShell); + Standard_EXPORT void SetRefShellDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_ShellId theShell); + + //! Set the IsClosed flag of a shell definition. + Standard_EXPORT void SetIsClosed(const BRepGraph_ShellId theShell, const bool theIsClosed); + + //! Set the IsClosed flag inside a batched mutation scope. + Standard_EXPORT void SetIsClosed(BRepGraph_MutGuard& theMut, + const bool theIsClosed); + + private: + friend class EditorView; + + explicit ShellOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Solid creation and editing operations. + class SolidOps + { + public: + //! Add an empty solid definition to the graph. + //! @return typed solid definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_SolidId Add(); + + //! Link a shell to a solid. + //! Appends ShellRef and stores its ShellRefId in solid ShellRefIds. + //! @param[in] theSolidEntity typed solid definition identifier + //! @param[in] theShellEntity typed shell definition identifier + //! @param[in] theOri orientation of the shell in the solid + //! @return typed shell reference identifier, or invalid if inputs are not active + Standard_EXPORT BRepGraph_ShellRefId AddShell(const BRepGraph_SolidId theSolidEntity, + const BRepGraph_ShellId theShellEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Link an auxiliary non-shell child to a solid. + //! Supported child kinds are Edge and Vertex. + //! @param[in] theSolidEntity typed solid definition identifier + //! @param[in] theChildEntity typed child definition identifier + //! @param[in] theOri orientation of the child in the solid + //! @return typed child reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_ChildRefId + AddChild(const BRepGraph_SolidId theSolidEntity, + const BRepGraph_NodeId theChildEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Detach one exact shell ref from a solid definition. + //! Use BRepGraph_RefsShellOfSolid::CurrentId() when removing from a solid + //! iterator. The method removes the exact ShellRef entry, erases it from the + //! solid's ordered ref sequence, rebuilds reverse indices, and prunes the + //! Shell subtree when it has no other active usages. + //! @param[in] theSolidDefId solid definition identifier + //! @param[in] theShellRefId exact solid-owned shell reference identifier + //! @return true if the active solid-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveShell(const BRepGraph_SolidId theSolidDefId, + const BRepGraph_ShellRefId theShellRefId); + + //! Detach one exact child ref from a solid auxiliary-child sequence. + //! Use BRepGraph_RefsChildOfSolid::CurrentId() when removing from a solid + //! aux-child iterator. + //! @param[in] theSolidDefId solid definition identifier + //! @param[in] theChildRefId exact solid-owned child reference identifier + //! @return true if the active solid-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveChild(const BRepGraph_SolidId theSolidDefId, + const BRepGraph_ChildRefId theChildRefId); + + //! Return scoped mutable solid definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_SolidId theSolid); + + //! Return scoped mutable solid reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_SolidRefId theSolidRef); + + //! Set the local location of a solid reference and fire immediate notification. + //! @param[in] theSolidRef typed solid reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_SolidRefId theSolidRef, + const TopLoc_Location& theLoc); + + //! Set the local location of a solid reference inside a batched mutation scope. + //! @param[in] theMut active mutable solid reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Set the orientation of a solid reference. + Standard_EXPORT void SetRefOrientation(const BRepGraph_SolidRefId theSolidRef, + const TopAbs_Orientation theOrientation); + + //! Set the orientation inside a batched mutation scope. + Standard_EXPORT void SetRefOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Rewire a solid reference to a different solid def (rebinds SolidToCompSolid if parent is + //! CompSolid). + Standard_EXPORT void SetRefSolidDefId(const BRepGraph_SolidRefId theSolidRef, + const BRepGraph_SolidId theSolid); + Standard_EXPORT void SetRefSolidDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_SolidId theSolid); + + private: + friend class EditorView; + + explicit SolidOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Compound creation and editing operations. + class CompoundOps + { + public: + //! Add a compound definition with child definitions. + //! @param[in] theChildEntities child definition NodeIds + //! @return typed compound definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_CompoundId + Add(const NCollection_DynamicArray& theChildEntities); + + //! Append a single child to an existing compound definition. + //! @param[in] theCompoundEntity typed compound definition identifier + //! @param[in] theChildEntity typed child topology definition identifier + //! @param[in] theOri orientation of the child in the compound + //! @return typed child reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_ChildRefId + AddChild(const BRepGraph_CompoundId theCompoundEntity, + const BRepGraph_NodeId theChildEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Detach one exact child ref from a compound definition. + //! Use BRepGraph_RefsChildOfParent::CurrentId() when removing from a compound + //! iterator. The method removes the exact ChildRef entry, erases it from the + //! compound's ordered ref sequence, rebuilds reverse indices, and prunes the + //! child subtree when it has no other active usages. + //! @param[in] theCompoundDefId compound definition identifier + //! @param[in] theChildRefId exact compound-owned child reference identifier + //! @return true if the active compound-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveChild(const BRepGraph_CompoundId theCompoundDefId, + const BRepGraph_ChildRefId theChildRefId); + + //! Return scoped mutable compound definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_CompoundId theCompound); + + private: + friend class EditorView; + + explicit CompoundOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief CompSolid creation and editing operations. + class CompSolidOps + { + public: + //! Add a compsolid definition with child solid definitions. + //! @param[in] theSolidEntities typed child solid definition identifiers + //! @return typed compsolid definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_CompSolidId + Add(const NCollection_DynamicArray& theSolidEntities); + + //! Append a single solid to an existing compsolid definition. + //! @param[in] theCompSolidEntity typed compsolid definition identifier + //! @param[in] theSolidEntity typed solid definition identifier + //! @param[in] theOri orientation of the solid in the compsolid + //! @return typed solid reference identifier, or invalid if inputs are not active + [[nodiscard]] Standard_EXPORT BRepGraph_SolidRefId + AddSolid(const BRepGraph_CompSolidId theCompSolidEntity, + const BRepGraph_SolidId theSolidEntity, + const TopAbs_Orientation theOri = TopAbs_FORWARD); + + //! Detach one exact solid ref from a compsolid definition. + //! Use BRepGraph_RefsSolidOfCompSolid::CurrentId() when removing from a + //! compsolid iterator. The method removes the exact SolidRef entry, erases it + //! from the compsolid's ordered ref sequence, rebuilds reverse indices, and + //! prunes the Solid subtree when it has no other active usages. + //! @param[in] theCompSolidDefId compsolid definition identifier + //! @param[in] theSolidRefId exact compsolid-owned solid reference identifier + //! @return true if the active compsolid-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveSolid(const BRepGraph_CompSolidId theCompSolidDefId, + const BRepGraph_SolidRefId theSolidRefId); + + //! Return scoped mutable comp-solid definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_CompSolidId theCompSolid); + + private: + friend class EditorView; + + explicit CompSolidOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Product and assembly low-level reconstruction primitives. + //! Wire two existing entities together; for shape ingestion use BRepGraph_Builder::Add(). + class ProductOps + { + public: + //! Create a Product wrapping an existing topology root via an Occurrence. + //! @param[in] theShapeRoot root topology NodeId for the part + //! @param[in] thePlacement local placement stored on the root OccurrenceRef + //! @return typed product definition identifier, or invalid if the root is + //! not an active topology definition node + [[nodiscard]] Standard_EXPORT BRepGraph_ProductId + LinkProductToTopology(const BRepGraph_NodeId theShapeRoot, + const TopLoc_Location& thePlacement = TopLoc_Location()); + + //! Create a Product with no direct shape root; can later own child occurrences. + //! @return typed product definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_ProductId CreateEmptyProduct(); + + //! Link two existing Products via a fresh Occurrence. + //! @param[in] theParentProduct typed parent product identifier + //! @param[in] theReferencedProduct typed child product identifier being instantiated + //! @param[in] thePlacement local placement relative to parent + //! @param[in] theParentOccurrence optional placing occurrence (nested assembly chains) + //! @param[out] theOutOccurrenceRefId optional out: typed ref id of the inserted OccurrenceRef + //! @return typed occurrence definition identifier, or invalid if the chain is not active + [[nodiscard]] Standard_EXPORT BRepGraph_OccurrenceId + LinkProducts(const BRepGraph_ProductId theParentProduct, + const BRepGraph_ProductId theReferencedProduct, + const TopLoc_Location& thePlacement, + const BRepGraph_OccurrenceId theParentOccurrence = BRepGraph_OccurrenceId(), + BRepGraph_OccurrenceRefId* theOutOccurrenceRefId = nullptr); + + //! Detach one exact occurrence ref from a product definition. + //! Use BRepGraph_RefsOccurrenceOfProduct::CurrentId() when removing from a + //! product iterator. The method removes the exact OccurrenceRef entry, erases + //! it from the product's ordered ref sequence, rebuilds reverse indices, and + //! prunes the occurrence subtree when it has no other active usages. + //! @param[in] theProductDefId product definition identifier + //! @param[in] theOccurrenceRefId exact product-owned occurrence reference identifier + //! @return true if the active product-owned usage was removed + [[nodiscard]] Standard_EXPORT bool RemoveOccurrence( + const BRepGraph_ProductId theProductDefId, + const BRepGraph_OccurrenceRefId theOccurrenceRefId); + + //! Detach the scalar shape-root ownership from a product definition. + //! If no other active product owns the same topology root afterward, the root + //! subgraph is pruned as orphaned. The product loses its direct shape root; + //! it is no longer a part, and it only remains an assembly if it still owns + //! active child occurrences. + //! @param[in] theProductDefId product definition identifier + //! @return true if an active shape root was detached + [[nodiscard]] Standard_EXPORT bool RemoveShapeRoot(const BRepGraph_ProductId theProductDefId); + + //! Return scoped mutable product definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_ProductId theProduct); + + private: + friend class EditorView; + + explicit ProductOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Occurrence mutation operations. + class OccurrenceOps + { + public: + //! Return scoped mutable occurrence definition guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard Mut( + const BRepGraph_OccurrenceId theOccurrence); + + //! Return scoped mutable occurrence reference guard. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutRef( + const BRepGraph_OccurrenceRefId theOccurrenceRef); + + //! Set the local location of an occurrence reference and fire immediate notification. + //! @param[in] theOccurrenceRef typed occurrence reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation(const BRepGraph_OccurrenceRefId theOccurrenceRef, + const TopLoc_Location& theLoc); + + //! Set the local location of an occurrence reference inside a batched mutation scope. + //! @param[in] theMut active mutable occurrence reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetRefLocalLocation( + BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Set the child node referenced by an occurrence definition. + //! The child kind must be a topology root or a Product - invalid kinds are + //! accepted but the resulting graph will fail Validate. + Standard_EXPORT void SetChildDefId(const BRepGraph_OccurrenceId theOccurrence, + const BRepGraph_NodeId theChildDefId); + + //! Set the child node id inside a batched mutation scope. + Standard_EXPORT void SetChildDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_NodeId theChildDefId); + + //! Rewire an occurrence reference to a different occurrence def (rebinds ProductToOccurrences). + Standard_EXPORT void SetRefOccurrenceDefId(const BRepGraph_OccurrenceRefId theOccurrenceRef, + const BRepGraph_OccurrenceId theOccurrence); + Standard_EXPORT void SetRefOccurrenceDefId( + BRepGraph_MutGuard& theMut, + const BRepGraph_OccurrenceId theOccurrence); + + private: + friend class EditorView; + + explicit OccurrenceOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + BRepGraph* myGraph; + }; + + //! @brief Generic node, reference, and representation removal operations. + class GenOps + { + public: + //! Mark a node as removed (soft deletion). + //! @param[in] theNode node to remove + Standard_EXPORT void RemoveNode(const BRepGraph_NodeId theNode); + + //! Mark a node as removed with a known replacement (sewing/deduplicate). + //! For Edge nodes: all CoEdges referencing the removed edge are reparented to + //! the replacement edge (EdgeIdx updated, reverse index rebound). This prevents + //! orphaned CoEdges that would disappear from CoEdgesOfEdge() queries. + //! Layers are notified with both old and replacement NodeIds for data migration. + //! @param[in] theNode node to remove + //! @param[in] theReplacement node that replaces theNode + Standard_EXPORT void RemoveNode(const BRepGraph_NodeId theNode, + const BRepGraph_NodeId theReplacement); + + //! Mark a node and all its descendants as removed (cascading soft deletion). + //! @param[in] theNode root node to remove + Standard_EXPORT void RemoveSubgraph(const BRepGraph_NodeId theNode); + + //! Mark a reference entry as removed (soft deletion). + //! This is the builder-level API for detaching a child usage from its parent + //! without removing the referenced definition itself. + //! Invalid or already-removed ids are ignored. + //! @param[in] theRef reference entry to remove + //! @return true if the reference transitioned from active to removed + Standard_EXPORT bool RemoveRef(const BRepGraph_RefId theRef); + + //! Mark an exact parent-owned reference entry as removed (soft deletion). + //! This overload validates that the reference really belongs to the supplied + //! parent and can optionally prune the child subtree when the removed usage + //! was the last active parent usage of that child definition. + //! Use this overload for UI/path-driven detach operations where the parent + //! context is part of the user's selection. + //! @param[in] theParent expected owning parent of the reference usage + //! @param[in] theRef reference entry to remove + //! @param[in] theToPruneOrphanedChild if true, remove the referenced child + //! subtree when no active parent usages remain after detachment + //! @return true if the reference transitioned from active to removed + Standard_EXPORT bool RemoveRef(const BRepGraph_NodeId theParent, + const BRepGraph_RefId theRef, + const bool theToPruneOrphanedChild); + + //! Mark a representation entry as removed (soft deletion). + //! Invalid or already-removed ids are ignored. + //! Owning topology entities are marked modified so generation-based caches + //! and read helpers observe the representation as absent. + //! @param[in] theRep representation to remove + Standard_EXPORT void RemoveRep(const BRepGraph_RepId theRep); + + //! Return scoped mutable child reference guard. ChildRef is generic (the + //! child node can be of any kind), so its Mut accessor lives on the + //! cross-kind Gen() rather than on a per-kind Ops. + [[nodiscard]] Standard_EXPORT BRepGraph_MutGuard MutChildRef( + const BRepGraph_ChildRefId theChildRef); + + //! Set the local location of a child reference and fire immediate notification. + //! @param[in] theChildRef typed child reference identifier + //! @param[in] theLoc new local location + Standard_EXPORT void SetChildRefLocalLocation(const BRepGraph_ChildRefId theChildRef, + const TopLoc_Location& theLoc); + + //! Set the orientation of a child reference. + Standard_EXPORT void SetChildRefOrientation(const BRepGraph_ChildRefId theChildRef, + const TopAbs_Orientation theOrientation); + + //! Set the orientation inside a batched mutation scope. + Standard_EXPORT void SetChildRefOrientation(BRepGraph_MutGuard& theMut, + const TopAbs_Orientation theOrientation); + + //! Rewire a child reference to a different child def (rebinds CompoundsOf). + Standard_EXPORT void SetChildRefChildDefId(const BRepGraph_ChildRefId theChildRef, + const BRepGraph_NodeId theChild); + Standard_EXPORT void SetChildRefChildDefId(BRepGraph_MutGuard& theMut, + const BRepGraph_NodeId theChild); + + //! Set the local location of a child reference inside a batched mutation scope. + //! @param[in] theMut active mutable child reference guard + //! @param[in] theLoc new local location + Standard_EXPORT void SetChildRefLocalLocation( + BRepGraph_MutGuard& theMut, + const TopLoc_Location& theLoc); + + //! Apply a modification operation and record history. + //! @param[in] theTarget node to modify + //! @param[in] theModifier callback that performs the modification and returns replacements + //! @param[in] theOpLabel human-readable operation label for history + template + void ApplyModification(const BRepGraph_NodeId theTarget, + ModifierT&& theModifier, + const TCollection_AsciiString& theOpLabel) + { + NCollection_DynamicArray aReplacements = + std::forward(theModifier)(*myGraph, theTarget); + applyModificationImpl(theTarget, std::move(aReplacements), theOpLabel); + } + + private: + friend class EditorView; + + explicit GenOps(BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + Standard_EXPORT void applyModificationImpl( + const BRepGraph_NodeId theTarget, + NCollection_DynamicArray&& theReplacements, + const TCollection_AsciiString& theOpLabel); + + BRepGraph* myGraph; + }; + +public: + //! Return vertex creation operations. + [[nodiscard]] VertexOps& Vertices() { return myVertexOps; } + + //! Return edge creation and editing operations. + [[nodiscard]] EdgeOps& Edges() { return myEdgeOps; } + + //! Return coedge and PCurve operations. + [[nodiscard]] CoEdgeOps& CoEdges() { return myCoEdgeOps; } + + //! Return wire creation and editing operations. + [[nodiscard]] WireOps& Wires() { return myWireOps; } + + //! Return face creation and editing operations. + [[nodiscard]] FaceOps& Faces() { return myFaceOps; } + + //! Return shell creation and editing operations. + [[nodiscard]] ShellOps& Shells() { return myShellOps; } + + //! Return solid creation and editing operations. + [[nodiscard]] SolidOps& Solids() { return mySolidOps; } + + //! Return compound creation and editing operations. + [[nodiscard]] CompoundOps& Compounds() { return myCompoundOps; } + + //! Return compsolid creation and editing operations. + [[nodiscard]] CompSolidOps& CompSolids() { return myCompSolidOps; } + + //! Return product and assembly creation and editing operations. + [[nodiscard]] ProductOps& Products() { return myProductOps; } + + //! Return occurrence mutation operations. + [[nodiscard]] OccurrenceOps& Occurrences() { return myOccurrenceOps; } + + //! Return generic node, reference, and representation removal operations. + [[nodiscard]] GenOps& Gen() { return myGenOps; } + + //! Return representation (surface, curve, triangulation, polygon) mutation operations. + [[nodiscard]] RepOps& Reps() { return myRepOps; } + + //! Begin deferred invalidation mode. + //! While active, markModified() only increments OwnGen + SubtreeGen and + //! appends to the deferred list - without acquiring the shape-cache mutex + //! or propagating upward. + //! Call EndDeferredInvalidation() to batch-flush all accumulated changes. + //! Intended for batch mutation loops (SameParameter, Sewing) where many + //! entities are modified sequentially and upward propagation should be + //! deferred until all mutations are complete. + //! Prefer BRepGraph_DeferredScope RAII guard. + //! @warning Deferred mode batches invalidation only; it does NOT serialize + //! the mutation body. Callers must guarantee exclusive Editor() structural + //! edit access for the whole deferred scope; concurrent Editor().Mut*() + //! usage still requires external synchronization around the surrounding batch. + Standard_EXPORT void BeginDeferredInvalidation(); + + //! End deferred invalidation mode and batch-flush: + //! propagates SubtreeGen upward for all modified entities from the deferred + //! list. Shape cache entries are validated lazily via SubtreeGen comparison. + Standard_EXPORT void EndDeferredInvalidation() noexcept; + + //! Check if deferred invalidation mode is currently active. + //! @note This is a state flag only. It does not imply mutation ownership + //! or synchronization guarantees. + [[nodiscard]] Standard_EXPORT bool IsDeferredMode() const; + + //! A single boundary invariant issue detected by ValidateMutationBoundary(). + struct BoundaryIssue + { + BRepGraph_NodeId NodeId; + TCollection_AsciiString Description; + }; + + //! Finalize a batch of mutations. + //! Validates reverse-index consistency and asserts active entity counts + //! match actual entity state. + //! Call this after manual batch mutation loops, or rely on + //! BRepGraph_DeferredScope to call it automatically at scope exit. + Standard_EXPORT void CommitMutation() noexcept; + + //! Validate lightweight mutation-boundary invariants. + //! @param[out] theIssues optional destination for detailed issues + //! @return true if no issues were found + [[nodiscard]] Standard_EXPORT bool ValidateMutationBoundary( + NCollection_DynamicArray* const theIssues = nullptr) const; + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit EditorView(BRepGraph* theGraph) + : myGraph(theGraph), + myVertexOps(theGraph), + myEdgeOps(theGraph), + myCoEdgeOps(theGraph), + myWireOps(theGraph), + myFaceOps(theGraph), + myShellOps(theGraph), + mySolidOps(theGraph), + myCompoundOps(theGraph), + myCompSolidOps(theGraph), + myProductOps(theGraph), + myOccurrenceOps(theGraph), + myGenOps(theGraph), + myRepOps(theGraph) + { + } + + BRepGraph* myGraph; + VertexOps myVertexOps; + EdgeOps myEdgeOps; + CoEdgeOps myCoEdgeOps; + WireOps myWireOps; + FaceOps myFaceOps; + ShellOps myShellOps; + SolidOps mySolidOps; + CompoundOps myCompoundOps; + CompSolidOps myCompSolidOps; + ProductOps myProductOps; + OccurrenceOps myOccurrenceOps; + GenOps myGenOps; + RepOps myRepOps; +}; + +#endif // _BRepGraph_EditorView_HeaderFile diff --git a/opencascade/BRepGraph_History.hxx b/opencascade/BRepGraph_History.hxx new file mode 100644 index 000000000..931992fbb --- /dev/null +++ b/opencascade/BRepGraph_History.hxx @@ -0,0 +1,116 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_History_HeaderFile +#define _BRepGraph_History_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +class BRepGraph; + +//! Extracted history subsystem for BRepGraph. +//! +//! BRepGraph_History maintains an append-only log of modification events +//! and bidirectional lookup maps (original <-> derived) for efficient +//! history queries. Recording can be toggled on/off at runtime. +class BRepGraph_History +{ + friend class BRepGraph; + +public: + DEFINE_STANDARD_ALLOC + + //! Record a modification: theOriginal was replaced by theReplacements. + //! @param[in] theOpLabel human-readable operation name + //! @param[in] theOriginal node id before the operation + //! @param[in] theReplacements node ids after the operation + Standard_EXPORT void Record(const TCollection_AsciiString& theOpLabel, + const BRepGraph_NodeId theOriginal, + const NCollection_DynamicArray& theReplacements); + + //! Record a batch of 1-to-1 modifications in a single history event. + //! theOriginals[i] was replaced by theReplacements[i]. + //! More efficient than calling Record() in a loop: creates one HistoryRecord + //! and updates the bidirectional maps with minimal overhead. + //! @param[in] theOpLabel human-readable operation name + //! @param[in] theOriginals node ids before the operation + //! @param[in] theReplacements node ids after the operation (same length) + //! @param[in] theExtraInfo optional diagnostic info stored on the record + Standard_EXPORT void RecordBatch( + const TCollection_AsciiString& theOpLabel, + const NCollection_DynamicArray& theOriginals, + const NCollection_DynamicArray& theReplacements, + const TCollection_AsciiString& theExtraInfo = TCollection_AsciiString()); + + //! Walk backwards from a modified node to its original. + //! Follows the reverse map recursively until a root is reached. + //! @param[in] theModified node id to trace back + //! @return the root original node id, or theModified itself if not found + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId + FindOriginal(const BRepGraph_NodeId theModified) const; + + //! Walk forwards from an original node to all derived nodes. + //! Follows the forward map recursively, collecting all leaves. + //! @param[in] theOriginal node id to trace forward + //! @return all transitively derived node ids + [[nodiscard]] Standard_EXPORT NCollection_DynamicArray FindDerived( + const BRepGraph_NodeId theOriginal) const; + + //! Number of recorded history events. + //! @return record count + [[nodiscard]] Standard_EXPORT size_t NbRecords() const; + + //! Access a record by index (0-based). + //! @param[in] theRecordIdx zero-based index into the records vector + //! @return the history record at the given index + [[nodiscard]] Standard_EXPORT const BRepGraph_HistoryRecord& Record( + const size_t theRecordIdx) const; + + //! Enable or disable history recording. + //! @param[in] theVal true to enable, false to disable + Standard_EXPORT void SetEnabled(const bool theVal); + + //! Query whether history recording is enabled. + //! @return true if recording is active + [[nodiscard]] Standard_EXPORT bool IsEnabled() const; + + //! Clear all records and lookup maps. + Standard_EXPORT void Clear(); + + //! Set the allocator for internal containers. + //! Must be called before any Record/RecordBatch calls. + //! @param[in] theAlloc allocator to use for internal maps + Standard_EXPORT void SetAllocator(const occ::handle& theAlloc); + +private: + occ::handle myAllocator; + + NCollection_DynamicArray myRecords; + + //! Reverse map: derived node -> original node. + NCollection_DataMap myDerivedToOriginal; + + //! Forward map: original node -> vector of derived nodes. + NCollection_DataMap> + myOriginalToDerived; + + bool myEnabled = true; +}; + +#endif // _BRepGraph_History_HeaderFile diff --git a/opencascade/BRepGraph_HistoryRecord.hxx b/opencascade/BRepGraph_HistoryRecord.hxx new file mode 100644 index 000000000..3724eab98 --- /dev/null +++ b/opencascade/BRepGraph_HistoryRecord.hxx @@ -0,0 +1,49 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_HistoryRecord_HeaderFile +#define _BRepGraph_HistoryRecord_HeaderFile + +#include + +#include +#include +#include + +//! One atomic modification event recorded in the graph's history log. +//! +//! A HistoryRecord captures what happened during a single call to +//! BRepGraph::ApplyModification(): +//! - OperationName identifies the algorithm ("Sewing", "FilletEdge", ...). +//! - SequenceNumber provides total ordering of events. +//! - Mapping records the topological fate of each affected node: +//! original -> [replacement1, replacement2, ...] (split) +//! original -> [same_node] (modified in place) +//! original -> [] (deleted) +//! +//! The history log is append-only within a graph's lifetime. +struct BRepGraph_HistoryRecord +{ + TCollection_AsciiString OperationName; + size_t SequenceNumber = 0; + + //! Key: original node id before the operation. + //! Value: sequence of replacement node ids after the operation. + NCollection_DataMap> Mapping; + + //! Optional extra info for diagnostic/debugging purposes. + //! E.g., merge tolerance, canonical source index. + TCollection_AsciiString ExtraInfo; +}; + +#endif // _BRepGraph_HistoryRecord_HeaderFile diff --git a/opencascade/BRepGraph_Iterator.hxx b/opencascade/BRepGraph_Iterator.hxx new file mode 100644 index 000000000..c356dd90e --- /dev/null +++ b/opencascade/BRepGraph_Iterator.hxx @@ -0,0 +1,333 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Iterator_HeaderFile +#define _BRepGraph_Iterator_HeaderFile + +#include +#include + +#include + +#include +#include + +//! @brief Type-safe, allocation-free iterator over BRepGraph definition nodes. +//! @see BRepGraph class comment "Iterator guide" for choosing between iterator types. +//! +//! Provides sequential read-only access to definitions stored in BRepGraph. +//! By default nodes with IsRemoved flag are skipped; set TheFullTraverse +//! to true to include them (types without IsRemoved are unaffected). +//! +//! ## Usage +//! @code +//! for (BRepGraph_Iterator anIt(aGraph); +//! anIt.More(); anIt.Next()) +//! { +//! const BRepGraphInc::FaceDef& aFace = anIt.Current(); +//! } +//! @endcode +namespace BRepGraph_IteratorDetail +{ +//! SFINAE helper: detect whether NodeType has an IsRemoved member (BaseDef types do). +template +struct HasIsRemoved : std::false_type +{ +}; + +template +struct HasIsRemoved().IsRemoved)>> : std::true_type +{ +}; + +//! Compile-time traits mapping from definition type to typed NodeId, +//! count accessor, and definition accessor. +template +struct NodeTraits; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_SolidId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Solids().Nb(); } + + static const BRepGraphInc::SolidDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Solids().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_ShellId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Shells().Nb(); } + + static const BRepGraphInc::ShellDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Shells().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_FaceId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Faces().Nb(); } + + static const BRepGraphInc::FaceDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Faces().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_WireId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Wires().Nb(); } + + static const BRepGraphInc::WireDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Wires().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_EdgeId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Edges().Nb(); } + + static const BRepGraphInc::EdgeDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Edges().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_VertexId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Vertices().Nb(); } + + static const BRepGraphInc::VertexDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Vertices().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_ProductId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Products().Nb(); } + + static const BRepGraphInc::ProductDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Products().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_OccurrenceId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Occurrences().Nb(); } + + static const BRepGraphInc::OccurrenceDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Occurrences().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_CoEdgeId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().CoEdges().Nb(); } + + static const BRepGraphInc::CoEdgeDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().CoEdges().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_CompoundId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().Compounds().Nb(); } + + static const BRepGraphInc::CompoundDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().Compounds().Definition(theId); + } +}; + +template <> +struct NodeTraits +{ + using TypedId = BRepGraph_CompSolidId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Topo().CompSolids().Nb(); } + + static const BRepGraphInc::CompSolidDef& Get(const BRepGraph& theGraph, const TypedId theId) + { + return theGraph.Topo().CompSolids().Definition(theId); + } +}; +} // namespace BRepGraph_IteratorDetail + +//! @brief Type-safe, allocation-free iterator over BRepGraph definition nodes. +//! +//! @tparam NodeType Definition struct type (e.g. BRepGraphInc::FaceDef). +//! @tparam TheFullTraverse When true, removed nodes are NOT skipped (for special cases). +template +class BRepGraph_Iterator +{ +public: + using Traits = BRepGraph_IteratorDetail::NodeTraits; + using TypedId = typename Traits::TypedId; + + BRepGraph_Iterator(const BRepGraph& theGraph) + : myGraph(theGraph), + myLength(TypedId(Traits::Count(theGraph))) + { + skipRemoved(); + } + + BRepGraph_Iterator(const BRepGraph& theGraph, const TypedId theStartId) + : myGraph(theGraph), + myCurrent(theStartId), + myLength(TypedId(Traits::Count(theGraph))) + { + if (myCurrent < TypedId::Start()) + { + myCurrent = TypedId::Start(); + } + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myCurrent < myLength; } + + void Next() + { + ++myCurrent; + skipRemoved(); + } + + [[nodiscard]] const NodeType& Current() const { return Traits::Get(myGraph, myCurrent); } + + //! Current definition index as a typed NodeId. + [[nodiscard]] TypedId CurrentId() const { return myCurrent; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + //! Advance past any nodes marked as removed. + void skipRemoved() + { + if constexpr (!TheFullTraverse && BRepGraph_IteratorDetail::HasIsRemoved::value) + { + while (myCurrent < myLength && Current().IsRemoved) + ++myCurrent; + } + } + + const BRepGraph& myGraph; + TypedId myCurrent = TypedId::Start(); + TypedId myLength; +}; + +// --------------------------------------------------------------------------- +// Convenience type aliases (skip removed nodes default) +// --------------------------------------------------------------------------- + +using BRepGraph_SolidIterator = BRepGraph_Iterator; +using BRepGraph_ShellIterator = BRepGraph_Iterator; +using BRepGraph_FaceIterator = BRepGraph_Iterator; +using BRepGraph_WireIterator = BRepGraph_Iterator; +using BRepGraph_EdgeIterator = BRepGraph_Iterator; +using BRepGraph_VertexIterator = BRepGraph_Iterator; +using BRepGraph_CoEdgeIterator = BRepGraph_Iterator; +using BRepGraph_CompoundIterator = BRepGraph_Iterator; +using BRepGraph_CompSolidIterator = BRepGraph_Iterator; +using BRepGraph_ProductIterator = BRepGraph_Iterator; +using BRepGraph_OccurrenceIterator = BRepGraph_Iterator; + +// --------------------------------------------------------------------------- +// Full-traverse aliases (include removed/invalidated nodes use only +// in special cases such as compaction, validation, or debugging) +// --------------------------------------------------------------------------- + +using BRepGraph_FullSolidIterator = BRepGraph_Iterator; +using BRepGraph_FullShellIterator = BRepGraph_Iterator; +using BRepGraph_FullFaceIterator = BRepGraph_Iterator; +using BRepGraph_FullWireIterator = BRepGraph_Iterator; +using BRepGraph_FullEdgeIterator = BRepGraph_Iterator; +using BRepGraph_FullVertexIterator = BRepGraph_Iterator; +using BRepGraph_FullCoEdgeIterator = BRepGraph_Iterator; +using BRepGraph_FullCompoundIterator = BRepGraph_Iterator; +using BRepGraph_FullCompSolidIterator = BRepGraph_Iterator; +using BRepGraph_FullProductIterator = BRepGraph_Iterator; +using BRepGraph_FullOccurrenceIterator = BRepGraph_Iterator; + +//! @brief Allocation-free iterator over root product identifiers. +//! +//! Iterates directly over BRepGraph::RootProductIds() - products not +//! referenced by any active occurrence. +class BRepGraph_RootProductIterator +{ +public: + explicit BRepGraph_RootProductIterator(const BRepGraph& theGraph) + : myRoots(theGraph.RootProductIds()) + { + } + + [[nodiscard]] bool More() const { return myIndex < myRoots.Length(); } + + void Next() { ++myIndex; } + + [[nodiscard]] const BRepGraph_ProductId& Current() const { return myRoots.Value(myIndex); } + + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + const NCollection_DynamicArray& myRoots; + int myIndex = 0; +}; + +#endif // _BRepGraph_Iterator_HeaderFile diff --git a/opencascade/BRepGraph_Layer.hxx b/opencascade/BRepGraph_Layer.hxx new file mode 100644 index 000000000..e5db1c5aa --- /dev/null +++ b/opencascade/BRepGraph_Layer.hxx @@ -0,0 +1,199 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Layer_HeaderFile +#define _BRepGraph_Layer_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +#include + +class BRepGraph; +class BRepGraph_LayerRegistry; + +//! @brief Abstract base class for named attribute layers. +//! +//! A layer groups per-node and per-reference metadata under a unique name with +//! lifecycle callbacks. Layers are registered on BRepGraph and automatically +//! notified when nodes or references are removed, remapped (compact), or modified. +//! +//! Derived layers store domain-specific data (names, colors, materials, etc.) +//! in internal maps keyed by BRepGraph_NodeId or BRepGraph_RefId. The lifecycle +//! callbacks ensure data consistency across all graph mutations. +//! +//! ## Node Modification Events +//! Layers subscribe to node modification events by overriding SubscribedKinds() +//! to return a non-zero bitmask of Kind values. When a subscribed node kind is +//! modified, OnNodeModified() (immediate mode) or OnNodesModified() (deferred +//! batch mode) is called. Layers with SubscribedKinds() == 0 (default) incur +//! zero dispatch overhead. +//! +//! ## Reference Modification Events +//! Layers subscribe to reference modification events by overriding +//! SubscribedRefKinds() to return a non-zero bitmask of BRepGraph_RefId::Kind +//! values. When a subscribed ref kind is mutated, OnRefModified() (immediate +//! mode) or OnRefsModified() (deferred batch mode) is called. Removal is always +//! dispatched via OnRefRemoved() regardless of subscription. +//! +//! ## Thread safety +//! Callback dispatch is single-threaded (called from mutation paths). +//! Layers that only provide read access can skip internal locking. +//! +//! @warning All lifecycle callbacks are declared noexcept. Derived +//! implementations that throw will cause std::terminate. This is enforced +//! by C++ language semantics for noexcept virtual overrides. +class BRepGraph_Layer : public Standard_Transient +{ +public: + //! Layer type identity (unique within a graph). + [[nodiscard]] virtual const Standard_GUID& ID() const = 0; + + //! Layer identity (unique within a graph). + [[nodiscard]] virtual const TCollection_AsciiString& Name() const = 0; + + //! Called when a node is soft-removed. + //! @param[in] theNode the removed node + //! @param[in] theReplacement if valid, the node that replaces theNode + //! (e.g., sewing edge merge, deduplicate). If invalid, pure deletion. + //! Layers should migrate data from theNode to theReplacement when valid, + //! otherwise discard or archive removed-node data. + //! Implementations must validate theReplacement before dereferencing + //! graph data through it. + //! @warning Layer callbacks must not throw. They are called from noexcept + //! notification paths (MutGuard destructors, deferred invalidation flush). + virtual void OnNodeRemoved(const BRepGraph_NodeId theNode, + const BRepGraph_NodeId theReplacement) noexcept = 0; + + //! Called after Compact with a unified old->new remap map. + //! Layer must remap all internal NodeId references using this map. + //! The map covers all node kinds (Vertex through CompSolid and future extensions). + //! Nodes absent from the map were removed during compaction - layers should + //! drop data associated with those nodes. + //! @param[in] theRemapMap maps old NodeId to new NodeId for all surviving nodes + virtual void OnCompact( + const NCollection_DataMap& theRemapMap) noexcept = 0; + + //! Mark all cached values dirty (bulk invalidation). + virtual void InvalidateAll() noexcept = 0; + + //! Clear all stored data. + virtual void Clear() noexcept = 0; + + // --- Modification event subscription --- + + //! Return a bitmask of BRepGraph_NodeId::Kind values this layer subscribes to. + //! Only modification events matching subscribed kinds are dispatched. + //! Default: 0 (no subscription - no modification events received). + //! Override to receive OnNodeModified/OnNodesModified callbacks. + //! The returned value must be constant for the lifetime of the layer. + [[nodiscard]] Standard_EXPORT virtual int SubscribedKinds() const; + + //! Called in immediate (non-deferred) mode after a single node is modified. + //! Only dispatched if the node's kind matches SubscribedKinds(). + //! Default: no-op. + //! @param[in] theNode the modified node + Standard_EXPORT virtual void OnNodeModified(const BRepGraph_NodeId theNode) noexcept; + + //! Called after EndDeferredInvalidation() with all nodes modified during + //! the deferred scope. Only dispatched if at least one modified node's kind + //! matches SubscribedKinds(). The vector may contain nodes of kinds not + //! subscribed to - layers should filter internally if needed. + //! Default: no-op. + //! @param[in] theModifiedNodes all modified, non-removed nodes + Standard_EXPORT virtual void OnNodesModified( + const NCollection_DynamicArray& theModifiedNodes) noexcept; + + //! Convenience: return bitmask bit for a given Kind. + static int KindBit(const BRepGraph_NodeId::Kind theKind) + { + return 1 << static_cast(theKind); + } + + // --- Reference modification event subscription --- + + //! Return a bitmask of BRepGraph_RefId::Kind values this layer subscribes to. + //! Only modification events matching subscribed ref kinds are dispatched. + //! Default: 0 (no subscription). Must be constant for the layer's lifetime. + [[nodiscard]] Standard_EXPORT virtual int SubscribedRefKinds() const; + + //! Called when a reference is soft-deleted via RemoveRef(). + //! No replacement concept - refs are simply removed (unlike nodes which can have + //! a replacement during sewing or deduplication). Dispatched to all layers + //! regardless of SubscribedRefKinds(). + //! Default: no-op. + //! @param[in] theRef the removed reference + Standard_EXPORT virtual void OnRefRemoved(const BRepGraph_RefId theRef) noexcept; + + //! Called in immediate (non-deferred) mode after a single ref is mutated. + //! Only dispatched if the ref's kind matches SubscribedRefKinds(). + //! Default: no-op. + //! @param[in] theRef the modified reference + Standard_EXPORT virtual void OnRefModified(const BRepGraph_RefId theRef) noexcept; + + //! Called after EndDeferredInvalidation() with all refs modified during + //! the deferred scope. Only dispatched if at least one modified ref's kind + //! matches SubscribedRefKinds(). The vector may contain refs of kinds not + //! subscribed to - layers should filter internally if needed. + //! Default: no-op. + //! @param[in] theModifiedRefs all modified, non-removed refs + //! @param[in] theModifiedRefKindsMask bitwise OR of all modified ref kinds + Standard_EXPORT virtual void OnRefsModified( + const NCollection_DynamicArray& theModifiedRefs, + const int theModifiedRefKindsMask) noexcept; + + //! Convenience: return bitmask bit for a given RefId::Kind. + static int RefKindBit(const BRepGraph_RefId::Kind theKind) + { + return 1 << static_cast(theKind); + } + + // --- Revision + owning-graph access --- + + //! Monotonic revision counter incremented by touch() on every observable + //! state change. Consumers compare stored revisions to detect staleness in O(1). + //! Derived layers MUST call touch() from their mutators. + [[nodiscard]] uint64_t Revision() const noexcept { return myRevision; } + + //! Owning graph, set by the registry on RegisterLayer() and cleared on Unregister(). + //! Nullptr before registration or after unregistration. + [[nodiscard]] const BRepGraph* OwningGraph() const noexcept { return myOwningGraph; } + + //! Mutable accessor for layers that drive graph mutations (e.g. meshing). + [[nodiscard]] BRepGraph* OwningMutableGraph() const noexcept + { + return const_cast(myOwningGraph); + } + +protected: + //! Bump the revision counter. + void touch() noexcept { ++myRevision; } + +private: + friend class ::BRepGraph_LayerRegistry; + + void setOwningGraph(const BRepGraph* theGraph) noexcept { myOwningGraph = theGraph; } + + const BRepGraph* myOwningGraph = nullptr; + uint64_t myRevision = 0; + +public: + DEFINE_STANDARD_RTTIEXT(BRepGraph_Layer, Standard_Transient) +}; + +#endif // _BRepGraph_Layer_HeaderFile diff --git a/opencascade/BRepGraph_LayerIterator.hxx b/opencascade/BRepGraph_LayerIterator.hxx new file mode 100644 index 000000000..eeac605c9 --- /dev/null +++ b/opencascade/BRepGraph_LayerIterator.hxx @@ -0,0 +1,79 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_LayerIterator_HeaderFile +#define _BRepGraph_LayerIterator_HeaderFile + +#include +#include + +//! @brief Iterator over registered layers in a BRepGraph_LayerRegistry. +//! +//! Provides zero-allocation iteration with OCCT More()/Next()/Value() pattern +//! and STL range-for via begin()/end(). +//! +//! @code +//! // Range-for: +//! for (const occ::handle& aLayer : +//! BRepGraph_LayerIterator(aGraph.LayerRegistry())) +//! doSomething(aLayer); +//! +//! // Traditional: +//! for (BRepGraph_LayerIterator anIt(aGraph.LayerRegistry()); anIt.More(); anIt.Next()) +//! doSomething(anIt.Value()); +//! @endcode +class BRepGraph_LayerIterator +{ +public: + //! Construct an iterator over all layers in the registry. + explicit BRepGraph_LayerIterator(const BRepGraph_LayerRegistry& theRegistry) + : myRegistry(&theRegistry), + myCount(theRegistry.NbLayers()), + myCurrent(0) + { + } + + //! True if the iterator has a current element. + [[nodiscard]] bool More() const { return myCurrent < myCount; } + + //! Advance to the next layer. + void Next() { ++myCurrent; } + + //! Return the current layer handle. + [[nodiscard]] const occ::handle& Value() const + { + return myRegistry->Layer(myCurrent); + } + + //! Return the current slot index in the registry. + [[nodiscard]] int Slot() const { return myCurrent; } + + //! Number of layers in the registry. + [[nodiscard]] int NbLayers() const { return myCount; } + + //! STL range-for support. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Sentinel marking end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + const BRepGraph_LayerRegistry* myRegistry; + int myCount; + int myCurrent; +}; + +#endif // _BRepGraph_LayerIterator_HeaderFile diff --git a/opencascade/BRepGraph_LayerParam.hxx b/opencascade/BRepGraph_LayerParam.hxx new file mode 100644 index 000000000..6afa5467c --- /dev/null +++ b/opencascade/BRepGraph_LayerParam.hxx @@ -0,0 +1,167 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_LayerParam_HeaderFile +#define _BRepGraph_LayerParam_HeaderFile + +#include + +#include +#include +#include + +//! @brief Persistent vertex point-representation store: point-on-curve, +//! point-on-surface, and point-on-PCurve parameters per vertex. +//! +//! Mirrors classical BRep_PointRepresentation entries on TVertex: each vertex +//! may carry parameters identifying its location on incident edges, faces, or +//! coedges (PCurves). The layer is the single source of truth for these +//! parameters in BRepGraph. +//! +//! ## Lifetime policy +//! The layer is **persistent metadata**: stored values survive arbitrary +//! mutations to the referenced vertices, edges, faces, and coedges. Only the +//! following events discard data: +//! - OnNodeRemoved - the referenced node is gone; entries naming it are +//! dropped (or migrated when a replacement is provided). +//! - OnCompact - ids are remapped; entries pointing to removed nodes drop. +//! - InvalidateAll() / Clear() - explicit caller request. +//! The layer does NOT subscribe to OnNodeModified: a tolerance bump, parameter +//! range adjustment, or NaturalRestriction toggle on a referenced node leaves +//! point-representation data intact. Callers that change geometry are +//! responsible for refreshing affected entries. +class BRepGraph_LayerParam : public BRepGraph_Layer +{ +public: + //! Return fixed layer type GUID. + [[nodiscard]] Standard_EXPORT static const Standard_GUID& GetID(); + + //! Return this layer type GUID. + [[nodiscard]] Standard_EXPORT const Standard_GUID& ID() const override; + + struct PointOnCurveEntry + { + double Parameter = 0.0; + BRepGraph_EdgeId EdgeDefId; + }; + + struct PointOnSurfaceEntry + { + double ParameterU = 0.0; + double ParameterV = 0.0; + BRepGraph_FaceId FaceDefId; + }; + + struct PointOnPCurveEntry + { + double Parameter = 0.0; + BRepGraph_CoEdgeId CoEdgeDefId; + }; + + struct VertexParams + { + NCollection_DynamicArray PointsOnCurve; + NCollection_DynamicArray PointsOnSurface; + NCollection_DynamicArray PointsOnPCurve; + + [[nodiscard]] bool IsEmpty() const + { + return PointsOnCurve.IsEmpty() && PointsOnSurface.IsEmpty() && PointsOnPCurve.IsEmpty(); + } + }; + + Standard_EXPORT const VertexParams* FindVertexParams(const BRepGraph_VertexId theVertex) const; + + Standard_EXPORT bool FindPointOnCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_EdgeId theEdge, + double* const theParameter = nullptr) const; + + Standard_EXPORT bool FindPointOnSurface(const BRepGraph_VertexId theVertex, + const BRepGraph_FaceId theFace, + gp_Pnt2d* const theUV = nullptr) const; + + Standard_EXPORT bool FindPointOnPCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_CoEdgeId theCoEdge, + double* const theParameter = nullptr) const; + + Standard_EXPORT uint32_t NbPointsOnCurve(const BRepGraph_VertexId theVertex) const; + Standard_EXPORT uint32_t NbPointsOnSurface(const BRepGraph_VertexId theVertex) const; + Standard_EXPORT uint32_t NbPointsOnPCurve(const BRepGraph_VertexId theVertex) const; + + [[nodiscard]] bool HasBindings() const { return myVertexParams.Extent() != 0; } + + Standard_EXPORT void SetPointOnCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_EdgeId theEdge, + const double theParameter); + + Standard_EXPORT void SetPointOnSurface(const BRepGraph_VertexId theVertex, + const BRepGraph_FaceId theFace, + const double theParameterU, + const double theParameterV); + + Standard_EXPORT void SetPointOnPCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_CoEdgeId theCoEdge, + const double theParameter); + + Standard_EXPORT const TCollection_AsciiString& Name() const override; + Standard_EXPORT void OnNodeRemoved(const BRepGraph_NodeId theNode, + const BRepGraph_NodeId theReplacement) noexcept override; + Standard_EXPORT void OnCompact( + const NCollection_DataMap& theRemapMap) noexcept override; + Standard_EXPORT void InvalidateAll() noexcept override; + Standard_EXPORT void Clear() noexcept override; + + DEFINE_STANDARD_RTTIEXT(BRepGraph_LayerParam, BRepGraph_Layer) + +private: + void removeVertexBindings(const BRepGraph_VertexId theVertex) noexcept; + void invalidateEdgeBindings(const BRepGraph_EdgeId theEdge) noexcept; + void invalidateFaceBindings(const BRepGraph_FaceId theFace) noexcept; + void invalidateCoEdgeBindings(const BRepGraph_CoEdgeId theCoEdge) noexcept; + void migrateVertexBindings(const BRepGraph_VertexId theOldVertex, + const BRepGraph_VertexId theNewVertex) noexcept; + void migrateEdgeBindings(const BRepGraph_EdgeId theOldEdge, + const BRepGraph_EdgeId theNewEdge) noexcept; + void migrateFaceBindings(const BRepGraph_FaceId theOldFace, + const BRepGraph_FaceId theNewFace) noexcept; + void migrateCoEdgeBindings(const BRepGraph_CoEdgeId theOldCoEdge, + const BRepGraph_CoEdgeId theNewCoEdge) noexcept; + + VertexParams& changeVertexParams(const BRepGraph_VertexId theVertex); + void bindEdgeToVertex(const BRepGraph_EdgeId theEdge, const BRepGraph_VertexId theVertex); + void bindFaceToVertex(const BRepGraph_FaceId theFace, const BRepGraph_VertexId theVertex); + void bindCoEdgeToVertex(const BRepGraph_CoEdgeId theCoEdge, const BRepGraph_VertexId theVertex); + void unbindEdgeFromVertex(const BRepGraph_EdgeId theEdge, + const BRepGraph_VertexId theVertex) noexcept; + void unbindFaceFromVertex(const BRepGraph_FaceId theFace, + const BRepGraph_VertexId theVertex) noexcept; + void unbindCoEdgeFromVertex(const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_VertexId theVertex) noexcept; + void removePointOnCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_EdgeId theEdge) noexcept; + void removePointOnSurface(const BRepGraph_VertexId theVertex, + const BRepGraph_FaceId theFace) noexcept; + void removePointOnPCurve(const BRepGraph_VertexId theVertex, + const BRepGraph_CoEdgeId theCoEdge) noexcept; + +private: + NCollection_DataMap myVertexParams; + NCollection_DataMap> + myEdgeToVertices; + NCollection_DataMap> + myFaceToVertices; + NCollection_DataMap> + myCoEdgeToVertices; +}; + +#endif // _BRepGraph_LayerParam_HeaderFile diff --git a/opencascade/BRepGraph_LayerRegistry.hxx b/opencascade/BRepGraph_LayerRegistry.hxx new file mode 100644 index 000000000..8b02b2a84 --- /dev/null +++ b/opencascade/BRepGraph_LayerRegistry.hxx @@ -0,0 +1,133 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_LayerRegistry_HeaderFile +#define _BRepGraph_LayerRegistry_HeaderFile + +#include +#include + +#include +#include +#include +#include + +//! @brief Dense GUID-keyed runtime registry of graph layers. +//! +//! Stores registered layers in a compact vector for O(1) slot access and a +//! GUID-to-slot map for O(1) lookup by stable public identity. +class BRepGraph_LayerRegistry +{ +public: + DEFINE_STANDARD_ALLOC + + BRepGraph_LayerRegistry() = default; + + BRepGraph_LayerRegistry(const BRepGraph_LayerRegistry&) = delete; + BRepGraph_LayerRegistry& operator=(const BRepGraph_LayerRegistry&) = delete; + + BRepGraph_LayerRegistry(BRepGraph_LayerRegistry&&) noexcept = default; + BRepGraph_LayerRegistry& operator=(BRepGraph_LayerRegistry&&) noexcept = default; + + //! Bind the owning graph. Propagates to every registered layer. + Standard_EXPORT void SetOwningGraph(BRepGraph* theGraph) noexcept; + + //! Owning graph bound via SetOwningGraph(), or nullptr. + [[nodiscard]] BRepGraph* OwningGraph() const noexcept { return myOwningGraph; } + + //! Register a layer. Replaces an existing layer with the same GUID. + //! @return slot index in the internal dense vector, or -1 for null input. + Standard_EXPORT int RegisterLayer(const occ::handle& theLayer); + + //! Remove a layer by GUID. + Standard_EXPORT void UnregisterLayer(const Standard_GUID& theGUID); + + //! Find a layer by GUID. Returns null handle if not found. + [[nodiscard]] Standard_EXPORT occ::handle FindLayer( + const Standard_GUID& theGUID) const; + + //! Typed convenience lookup by layer GUID. + template + [[nodiscard]] occ::handle FindLayer() const + { + return occ::down_cast(FindLayer(T::GetID())); + } + + //! Return current slot for a GUID, or -1 if not registered. + [[nodiscard]] Standard_EXPORT int FindSlot(const Standard_GUID& theGUID) const; + + //! Return layer by slot index. + [[nodiscard]] Standard_EXPORT const occ::handle& Layer(const int theSlot) const; + + //! Number of registered layers. + [[nodiscard]] int NbLayers() const { return myLayers.Length(); } + + //! True if any registered layer subscribes to node modification events. + [[nodiscard]] bool HasModificationSubscribers() const { return mySubscribedKindsMask != 0; } + + //! Bitwise OR of all registered layer node subscription masks. + [[nodiscard]] int SubscribedKindsMask() const { return mySubscribedKindsMask; } + + //! Dispatch OnNodeRemoved to all registered layers. + Standard_EXPORT void DispatchOnNodeRemoved(const BRepGraph_NodeId theNode, + const BRepGraph_NodeId theReplacement) noexcept; + + //! Dispatch OnNodeModified to subscribed layers. + Standard_EXPORT void DispatchNodeModified(const BRepGraph_NodeId theNode) noexcept; + + //! Dispatch OnNodesModified to subscribed layers. + Standard_EXPORT void DispatchNodesModified( + const NCollection_DynamicArray& theModifiedNodes, + const int theModifiedKindsMask) noexcept; + + //! Dispatch OnCompact to all registered layers. + Standard_EXPORT void DispatchOnCompact( + const NCollection_DataMap& theRemapMap) noexcept; + + // --- Reference dispatch --- + + //! True if any registered layer subscribes to reference modification events. + [[nodiscard]] bool HasRefModificationSubscribers() const { return mySubscribedRefKindsMask != 0; } + + //! Bitwise OR of all registered layer reference subscription masks. + [[nodiscard]] int SubscribedRefKindsMask() const { return mySubscribedRefKindsMask; } + + //! Dispatch OnRefRemoved to all registered layers (unconditional - not filtered). + Standard_EXPORT void DispatchOnRefRemoved(const BRepGraph_RefId theRef) noexcept; + + //! Dispatch OnRefModified to subscribed layers (immediate mode). + Standard_EXPORT void DispatchRefModified(const BRepGraph_RefId theRef) noexcept; + + //! Dispatch OnRefsModified to subscribed layers (deferred/batch mode). + Standard_EXPORT void DispatchRefsModified( + const NCollection_DynamicArray& theModifiedRefs, + const int theModifiedRefKindsMask) noexcept; + + //! Clear all registered layer payloads without unregistering them. + Standard_EXPORT void ClearAll() noexcept; + + //! Invalidate all registered layer payloads. + Standard_EXPORT void InvalidateAll() noexcept; + +private: + Standard_EXPORT void recomputeSubscribedKindsMask(); + +private: + NCollection_DynamicArray> myLayers; + NCollection_DataMap myGuidToSlot; + uint32_t mySubscribedKindsMask = 0; + uint32_t mySubscribedRefKindsMask = 0; + BRepGraph* myOwningGraph = nullptr; +}; + +#endif // _BRepGraph_LayerRegistry_HeaderFile diff --git a/opencascade/BRepGraph_LayerRegularity.hxx b/opencascade/BRepGraph_LayerRegularity.hxx new file mode 100644 index 000000000..0b420f97f --- /dev/null +++ b/opencascade/BRepGraph_LayerRegularity.hxx @@ -0,0 +1,120 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_LayerRegularity_HeaderFile +#define _BRepGraph_LayerRegularity_HeaderFile + +#include + +#include +#include +#include + +//! @brief Persistent edge-continuity store, keyed by (edge, F1, F2). +//! +//! Each entry holds the geometric continuity (C^k / G^k) across the face pair +//! at a given edge. F1 == F2 represents seam continuity across a closed +//! surface's seam line; F1 != F2 represents inter-face regularity. The schema +//! mirrors classical BRep_Tool::Continuity(edge, F1, F2). +//! +//! ## Lifetime policy +//! The layer is **persistent metadata**: stored values survive arbitrary +//! mutations to the referenced edges and faces. Only the following events +//! discard data: +//! - OnNodeRemoved(edge|face) - the referenced node is gone; entries naming +//! it are dropped (or migrated when a replacement is provided). +//! - OnCompact - ids are remapped; entries pointing to removed nodes drop. +//! - InvalidateAll() / Clear() - explicit caller request. +//! In particular, this layer does NOT subscribe to OnNodeModified: a tolerance +//! bump or NaturalRestriction toggle leaves stored continuity intact. Callers +//! that change the underlying geometry are responsible for refreshing affected +//! entries (typically via SetRegularity, removeRegularity, or InvalidateAll). +class BRepGraph_LayerRegularity : public BRepGraph_Layer +{ +public: + //! Return fixed layer type GUID. + [[nodiscard]] Standard_EXPORT static const Standard_GUID& GetID(); + + //! Return this layer type GUID. + [[nodiscard]] Standard_EXPORT const Standard_GUID& ID() const override; + + struct RegularityEntry + { + BRepGraph_FaceId FaceEntity1; + BRepGraph_FaceId FaceEntity2; + GeomAbs_Shape Continuity = GeomAbs_C0; + }; + + struct EdgeRegularities + { + NCollection_DynamicArray Entries; + + [[nodiscard]] bool IsEmpty() const { return Entries.IsEmpty(); } + }; + + Standard_EXPORT const EdgeRegularities* FindEdgeRegularities( + const BRepGraph_EdgeId theEdge) const; + + Standard_EXPORT bool FindContinuity(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2, + GeomAbs_Shape* const theContinuity = nullptr) const; + + Standard_EXPORT uint32_t NbRegularities(const BRepGraph_EdgeId theEdge) const; + Standard_EXPORT GeomAbs_Shape MaxContinuity(const BRepGraph_EdgeId theEdge) const; + + [[nodiscard]] bool HasBindings() const { return myEdgeRegularities.Extent() != 0; } + + Standard_EXPORT void SetRegularity(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2, + const GeomAbs_Shape theContinuity); + + //! Copy all regularity entries from one edge to another. + Standard_EXPORT void CopyRegularities(const BRepGraph_EdgeId theSourceEdge, + const BRepGraph_EdgeId theTargetEdge); + + //! Remove all regularity entries bound to the edge. + Standard_EXPORT void RemoveRegularities(const BRepGraph_EdgeId theEdge) noexcept; + + Standard_EXPORT const TCollection_AsciiString& Name() const override; + Standard_EXPORT void OnNodeRemoved(const BRepGraph_NodeId theNode, + const BRepGraph_NodeId theReplacement) noexcept override; + Standard_EXPORT void OnCompact( + const NCollection_DataMap& theRemapMap) noexcept override; + Standard_EXPORT void InvalidateAll() noexcept override; + Standard_EXPORT void Clear() noexcept override; + + DEFINE_STANDARD_RTTIEXT(BRepGraph_LayerRegularity, BRepGraph_Layer) + +private: + void normalizeFacePair(BRepGraph_FaceId& theFace1, BRepGraph_FaceId& theFace2) const noexcept; + EdgeRegularities& changeEdgeRegularities(const BRepGraph_EdgeId theEdge); + void bindFaceToEdge(const BRepGraph_FaceId theFace, const BRepGraph_EdgeId theEdge); + void unbindFaceFromEdge(const BRepGraph_FaceId theFace, const BRepGraph_EdgeId theEdge) noexcept; + void removeRegularity(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2) noexcept; + void removeEdgeBindings(const BRepGraph_EdgeId theEdge) noexcept; + void invalidateFaceBindings(const BRepGraph_FaceId theFace) noexcept; + void migrateEdgeBindings(const BRepGraph_EdgeId theOldEdge, + const BRepGraph_EdgeId theNewEdge) noexcept; + void migrateFaceBindings(const BRepGraph_FaceId theOldFace, + const BRepGraph_FaceId theNewFace) noexcept; + +private: + NCollection_DataMap myEdgeRegularities; + NCollection_DataMap> myFaceToEdges; +}; + +#endif // _BRepGraph_LayerRegularity_HeaderFile diff --git a/opencascade/BRepGraph_MeshCache.hxx b/opencascade/BRepGraph_MeshCache.hxx new file mode 100644 index 000000000..95f8c2131 --- /dev/null +++ b/opencascade/BRepGraph_MeshCache.hxx @@ -0,0 +1,188 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_MeshCache_HeaderFile +#define _BRepGraph_MeshCache_HeaderFile + +#include +#include + +#include +#include + +//! @brief Cached mesh data storage for BRepGraph. +//! +//! Stores mesh RepId references (triangulations for faces, polygons for edges +//! and coedges) separately from topology definitions. This cache holds +//! algorithm-derived mesh data written by BRepGraphMesh, as opposed to +//! persistent mesh data stored in definition structs (imported from STEP, etc.). +//! +//! Priority rule: cached mesh takes precedence over persistent mesh in +//! definitions. Persistent mesh is the fallback when no fresh cache exists. +//! +//! Freshness is validated by comparing StoredOwnGen against the entity's +//! current OwnGen. A mismatch means the geometry changed since meshing, +//! so the cached mesh is stale. +//! +//! Writing to the cache does NOT trigger markModified() or mutation tracking. +//! +//! ### Invalidation contract +//! The cache relies on the following invariants upheld by BRepGraph mutations: +//! 1. Any `Editor().Faces().Mut(FaceId)` guard bumps `FaceDef.OwnGen` on scope +//! exit, invalidating cached face mesh entries. +//! 2. `markRepModified(SurfaceRepId | TriangulationRepId)` iterates every Face +//! referencing the rep and calls `markModified(FaceId)`, so geometry edits +//! through `Editor().Reps().MutSurface/MutTriangulation()` also invalidate +//! cached face meshes. +//! 3. `markRepModified(TriangulationRepId)` additionally scans the cache itself +//! (not just persistent `FaceDef.TriangulationRepId`) so that cached-only +//! triangulations are bumped along with their owning Face's `OwnGen`. +//! Edge/CoEdge caches follow the analogous pattern for `EdgeDef`/`CoEdgeDef` +//! and the corresponding `Polygon3D`/`Polygon2D`/`PolygonOnTri` reps. +namespace BRepGraph_MeshCache +{ + +//! Cached mesh entry for a face: triangulation rep references. +struct FaceMeshEntry +{ + NCollection_DynamicArray TriangulationRepIds; + int ActiveTriangulationIndex = -1; + uint32_t StoredOwnGen = 0; //!< OwnGen of FaceDef at write time + + //! True if this entry contains mesh data. + [[nodiscard]] bool IsPresent() const { return !TriangulationRepIds.IsEmpty(); } + + //! Convenience: active triangulation rep id, or invalid. + [[nodiscard]] BRepGraph_TriangulationRepId ActiveTriangulationRepId() const + { + if (ActiveTriangulationIndex >= 0 && ActiveTriangulationIndex < TriangulationRepIds.Length()) + return TriangulationRepIds.Value(ActiveTriangulationIndex); + return BRepGraph_TriangulationRepId(); + } + + //! Reset all fields to default (absent) state. + void Reset() + { + TriangulationRepIds.Clear(); + ActiveTriangulationIndex = -1; + StoredOwnGen = 0; + } +}; + +//! Cached mesh entry for a coedge: polygon-on-triangulation and polygon-2D rep references. +struct CoEdgeMeshEntry +{ + BRepGraph_Polygon2DRepId Polygon2DRepId; + NCollection_DynamicArray PolygonOnTriRepIds; + uint32_t StoredOwnGen = 0; //!< OwnGen of CoEdgeDef at write time + + //! True if this entry contains mesh data. + [[nodiscard]] bool IsPresent() const + { + return Polygon2DRepId.IsValid() || !PolygonOnTriRepIds.IsEmpty(); + } + + //! Reset all fields to default (absent) state. + void Reset() + { + Polygon2DRepId = BRepGraph_Polygon2DRepId(); + PolygonOnTriRepIds.Clear(); + StoredOwnGen = 0; + } +}; + +//! Cached mesh entry for an edge: polygon-3D rep reference. +struct EdgeMeshEntry +{ + BRepGraph_Polygon3DRepId Polygon3DRepId; + uint32_t StoredOwnGen = 0; //!< OwnGen of EdgeDef at write time + + //! True if this entry contains mesh data. + [[nodiscard]] bool IsPresent() const { return Polygon3DRepId.IsValid(); } + + //! Reset all fields to default (absent) state. + void Reset() + { + Polygon3DRepId = BRepGraph_Polygon3DRepId(); + StoredOwnGen = 0; + } +}; + +} // namespace BRepGraph_MeshCache + +//! @brief Storage backend for cached mesh data. +//! +//! Dense vectors indexed by per-kind entity index (same pattern as DefStore). +//! Entries with StoredOwnGen == 0 are absent (no cached mesh data). +//! Thread safety: parallel writes to different indices are safe (no contention). +class BRepGraph_MeshCacheStorage +{ +public: + //! Check if a face has a cached mesh entry (StoredOwnGen != 0). + [[nodiscard]] bool HasFaceMesh(const BRepGraph_FaceId theFace) const; + + //! Find face mesh entry, or nullptr if absent. + [[nodiscard]] const BRepGraph_MeshCache::FaceMeshEntry* FindFaceMesh( + const BRepGraph_FaceId theFace) const; + + //! Get or create a face mesh entry. Creates with default values if absent. + [[nodiscard]] BRepGraph_MeshCache::FaceMeshEntry& ChangeFaceMesh(const BRepGraph_FaceId theFace); + + //! Clear the face mesh entry (reset to absent). + void ClearFaceMesh(const BRepGraph_FaceId theFace); + + //! Check if a coedge has a cached mesh entry. + [[nodiscard]] bool HasCoEdgeMesh(const BRepGraph_CoEdgeId theCoEdge) const; + + //! Find coedge mesh entry, or nullptr if absent. + [[nodiscard]] const BRepGraph_MeshCache::CoEdgeMeshEntry* FindCoEdgeMesh( + const BRepGraph_CoEdgeId theCoEdge) const; + + //! Get or create a coedge mesh entry. + [[nodiscard]] BRepGraph_MeshCache::CoEdgeMeshEntry& ChangeCoEdgeMesh( + const BRepGraph_CoEdgeId theCoEdge); + + //! Clear the coedge mesh entry. + void ClearCoEdgeMesh(const BRepGraph_CoEdgeId theCoEdge); + + //! Check if an edge has a cached mesh entry. + [[nodiscard]] bool HasEdgeMesh(const BRepGraph_EdgeId theEdge) const; + + //! Find edge mesh entry, or nullptr if absent. + [[nodiscard]] const BRepGraph_MeshCache::EdgeMeshEntry* FindEdgeMesh( + const BRepGraph_EdgeId theEdge) const; + + //! Get or create an edge mesh entry. + [[nodiscard]] BRepGraph_MeshCache::EdgeMeshEntry& ChangeEdgeMesh(const BRepGraph_EdgeId theEdge); + + //! Clear the edge mesh entry. + void ClearEdgeMesh(const BRepGraph_EdgeId theEdge); + + //! Clear all cached mesh data. + void Clear(); + + //! Remap cache entries after compaction. + //! @param[in] theNodeRemapMap old NodeId -> new NodeId mapping + void OnCompact(const NCollection_DataMap& theNodeRemapMap); + +private: + //! Ensure vector has at least theIndex+1 elements. + template + static void ensureSize(NCollection_DynamicArray& theVec, const size_t theIndex); + + NCollection_DynamicArray myFaceMeshes; + NCollection_DynamicArray myCoEdgeMeshes; + NCollection_DynamicArray myEdgeMeshes; +}; + +#endif // _BRepGraph_MeshCache_HeaderFile diff --git a/opencascade/BRepGraph_MeshView.hxx b/opencascade/BRepGraph_MeshView.hxx new file mode 100644 index 000000000..c7961a4b5 --- /dev/null +++ b/opencascade/BRepGraph_MeshView.hxx @@ -0,0 +1,196 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_MeshView_HeaderFile +#define _BRepGraph_MeshView_HeaderFile + +#include +#include +#include + +namespace BRepGraph_MeshCache +{ +struct FaceMeshEntry; +struct CoEdgeMeshEntry; +struct EdgeMeshEntry; +} // namespace BRepGraph_MeshCache + +namespace BRepGraphInc +{ +struct TriangulationRep; +struct Polygon3DRep; +struct Polygon2DRep; +struct PolygonOnTriRep; +} // namespace BRepGraphInc + +//! @brief Read-only view over mesh data with cache-first, persistent-fallback priority. +//! +//! Provides mesh queries that check the mesh cache (algorithm-derived mesh +//! from BRepGraphMesh) first, falling back to persistent mesh stored in +//! topology definitions (imported from STEP, etc.). +//! +//! For mesh cache writes and rep creation, use BRepGraph_Tool::Mesh. +//! +//! Obtained via BRepGraph::Mesh(). +class BRepGraph::MeshView +{ +public: + //! @brief Face mesh queries (cache-first, persistent fallback). + class FaceOps + { + public: + //! Check if face has any mesh data (cached or persistent). + [[nodiscard]] Standard_EXPORT bool HasTriangulation(const BRepGraph_FaceId theFace) const; + + //! Active triangulation rep id (cached if fresh, else persistent). + //! @return valid TriangulationRepId, or invalid if no mesh available + [[nodiscard]] Standard_EXPORT BRepGraph_TriangulationRepId + ActiveTriangulationRepId(const BRepGraph_FaceId theFace) const; + + //! Direct access to cached face mesh entry (null if absent or stale). + [[nodiscard]] Standard_EXPORT const BRepGraph_MeshCache::FaceMeshEntry* CachedMesh( + const BRepGraph_FaceId theFace) const; + + private: + friend class MeshView; + + explicit FaceOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + [[nodiscard]] bool isFresh(const BRepGraph_FaceId theFace, const uint32_t theStoredGen) const; + + const BRepGraph* myGraph; + }; + + //! @brief Edge mesh queries (cache-first, persistent fallback). + class EdgeOps + { + public: + //! Check if edge has polygon-3D mesh data (cached or persistent). + [[nodiscard]] Standard_EXPORT bool HasPolygon3D(const BRepGraph_EdgeId theEdge) const; + + //! Polygon3D rep id (cached if fresh, else persistent). + [[nodiscard]] Standard_EXPORT BRepGraph_Polygon3DRepId + Polygon3DRepId(const BRepGraph_EdgeId theEdge) const; + + //! Direct access to cached edge mesh entry (null if absent or stale). + [[nodiscard]] Standard_EXPORT const BRepGraph_MeshCache::EdgeMeshEntry* CachedMesh( + const BRepGraph_EdgeId theEdge) const; + + private: + friend class MeshView; + + explicit EdgeOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + [[nodiscard]] bool isFresh(const BRepGraph_EdgeId theEdge, const uint32_t theStoredGen) const; + + const BRepGraph* myGraph; + }; + + //! @brief CoEdge mesh queries (cache-first, persistent fallback). + class CoEdgeOps + { + public: + //! Check if coedge has cached mesh data (polygon-on-tri or polygon-2D). + [[nodiscard]] Standard_EXPORT bool HasMesh(const BRepGraph_CoEdgeId theCoEdge) const; + + //! Direct access to cached coedge mesh entry (null if absent or stale). + [[nodiscard]] Standard_EXPORT const BRepGraph_MeshCache::CoEdgeMeshEntry* CachedMesh( + const BRepGraph_CoEdgeId theCoEdge) const; + + private: + friend class MeshView; + + explicit CoEdgeOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + [[nodiscard]] bool isFresh(const BRepGraph_CoEdgeId theCoEdge, + const uint32_t theStoredGen) const; + + const BRepGraph* myGraph; + }; + + //! @brief Polygonal and triangulation representation queries. + class PolyOps + { + public: + [[nodiscard]] Standard_EXPORT int NbTriangulations() const; + [[nodiscard]] Standard_EXPORT int NbPolygons3D() const; + [[nodiscard]] Standard_EXPORT int NbPolygons2D() const; + [[nodiscard]] Standard_EXPORT int NbPolygonsOnTri() const; + + [[nodiscard]] Standard_EXPORT int NbActiveTriangulations() const; + [[nodiscard]] Standard_EXPORT int NbActivePolygons3D() const; + [[nodiscard]] Standard_EXPORT int NbActivePolygons2D() const; + [[nodiscard]] Standard_EXPORT int NbActivePolygonsOnTri() const; + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::TriangulationRep& TriangulationRep( + const BRepGraph_TriangulationRepId theRep) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::Polygon3DRep& Polygon3DRep( + const BRepGraph_Polygon3DRepId theRep) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::Polygon2DRep& Polygon2DRep( + const BRepGraph_Polygon2DRepId theRep) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::PolygonOnTriRep& PolygonOnTriRep( + const BRepGraph_PolygonOnTriRepId theRep) const; + + private: + friend class MeshView; + + explicit PolyOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! Grouped face mesh queries. + [[nodiscard]] const FaceOps& Faces() const { return myFaces; } + + //! Grouped edge mesh queries. + [[nodiscard]] const EdgeOps& Edges() const { return myEdges; } + + //! Grouped coedge mesh queries. + [[nodiscard]] const CoEdgeOps& CoEdges() const { return myCoEdges; } + + //! Grouped polygonal representation queries. + [[nodiscard]] const PolyOps& Poly() const { return myPoly; } + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit MeshView(const BRepGraph* theGraph) + : myGraph(theGraph), + myFaces(theGraph), + myEdges(theGraph), + myCoEdges(theGraph), + myPoly(theGraph) + { + } + + const BRepGraph* myGraph; + FaceOps myFaces; + EdgeOps myEdges; + CoEdgeOps myCoEdges; + PolyOps myPoly; +}; + +#endif // _BRepGraph_MeshView_HeaderFile diff --git a/opencascade/BRepGraph_MutGuard.hxx b/opencascade/BRepGraph_MutGuard.hxx new file mode 100644 index 000000000..8857bddf8 --- /dev/null +++ b/opencascade/BRepGraph_MutGuard.hxx @@ -0,0 +1,182 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_MutGuard_HeaderFile +#define _BRepGraph_MutGuard_HeaderFile + +#include +#include +#include +#include + +#include + +class BRepGraph; + +//! @brief RAII scope token batching mutation notifications for a single entity. +//! +//! Obtained via BRepGraph::Editor().().Mut() / MutRef() / MutSurface() etc. +//! Reads via `operator->()` / `operator*()`; writes via Editor's typed setters +//! (or `Internal()` for in-tree structural remaps). Any call to `Internal()` +//! flags the guard dirty and the destructor fires `markModified` / +//! `markRefModified` / `markRepModified` once on scope exit. +//! +//! Move-only; non-copyable. After a move, the source guard becomes inert. +//! +//! Compile-time dispatch selects the ID type and notification method: +//! - For types derived from BRepGraphInc::BaseDef: BRepGraph_NodeId + markModified() +//! - For types derived from BRepGraphInc::BaseRef: BRepGraph_RefId + markRefModified() +//! - For types derived from BRepGraphInc::BaseRep: BRepGraph_RepId + markRepModified() +//! +//! @code +//! { +//! BRepGraph_MutGuard anEdge = +//! theGraph.Editor().Edges().Mut(BRepGraph_EdgeId(42)); +//! theGraph.Editor().Edges().SetTolerance (anEdge, 0.5); +//! theGraph.Editor().Edges().SetSameParameter (anEdge, true); +//! } // markModified called once here +//! @endcode +template +class BRepGraph_MutGuard +{ + static_assert(std::is_base_of_v + || std::is_base_of_v + || std::is_base_of_v, + "BRepGraph_MutGuard: T must derive from BaseDef, BaseRef, or BaseRep"); + + //! Entity-provided identifier alias. + using TypeId = typename T::TypeId; + + //! Call the appropriate notification method on the graph. + void notify() noexcept + { + try + { + if constexpr (std::is_base_of_v) + myGraph->markModified(myId, *myEntity); + else if constexpr (std::is_base_of_v) + myGraph->markRefModified(myId, *myEntity); + else + myGraph->markRepModified(myId); + } + catch (...) + { + } + } + +public: + //! Construct a guard over a mutable entity. + //! @param[in] theGraph owning graph (used for notification on destruction) + //! @param[in] theEntity pointer to the mutable entity + //! @param[in] theId identity for notification + BRepGraph_MutGuard(BRepGraph* theGraph, T* theEntity, const TypeId theId) + : myGraph(theGraph), + myEntity(theEntity), + myId(theId), + myDirty(false) + { + } + + //! Destructor: notifies the graph if the guard owns an entity AND + //! at least one setter (or `MarkDirty`) flagged it modified. + ~BRepGraph_MutGuard() + { + if (myGraph != nullptr && myDirty) + { + notify(); + } + } + + BRepGraph_MutGuard(BRepGraph_MutGuard&& theOther) noexcept + : myGraph(theOther.myGraph), + myEntity(theOther.myEntity), + myId(theOther.myId), + myDirty(theOther.myDirty) + { + theOther.myGraph = nullptr; + theOther.myEntity = nullptr; + theOther.myDirty = false; + } + + BRepGraph_MutGuard& operator=(BRepGraph_MutGuard&& theOther) noexcept + { + if (this != &theOther) + { + if (myGraph != nullptr && myDirty) + notify(); + myGraph = theOther.myGraph; + myEntity = theOther.myEntity; + myId = theOther.myId; + myDirty = theOther.myDirty; + theOther.myGraph = nullptr; + theOther.myEntity = nullptr; + theOther.myDirty = false; + } + return *this; + } + + BRepGraph_MutGuard(const BRepGraph_MutGuard&) = delete; + BRepGraph_MutGuard& operator=(const BRepGraph_MutGuard&) = delete; + + //! True when the guard still owns an entity; false after a move or when + //! constructed in an inert state. + [[nodiscard]] explicit operator bool() const noexcept { return myEntity != nullptr; } + + //! Read-only access via pointer syntax. Field writes go through the + //! Editor's typed setters. + [[nodiscard]] const T* operator->() const + { + Standard_ProgramError_Raise_if( + myEntity == nullptr, + "BRepGraph_MutGuard::operator->(): guard is empty or moved-from"); + return myEntity; + } + + //! Read-only dereference. + [[nodiscard]] const T& operator*() const + { + Standard_ProgramError_Raise_if(myEntity == nullptr, + "BRepGraph_MutGuard::operator*(): guard is empty or moved-from"); + return *myEntity; + } + + //! Identity for notification. + [[nodiscard]] TypeId Id() const noexcept { return myId; } + + //! Owning graph pointer (nullptr after move). + [[nodiscard]] BRepGraph* Graph() const noexcept { return myGraph; } + + //! Flag the guarded entity as modified without writing through `Internal()`. + //! Use when an external mutation (e.g. in-place geometry transform on a shared + //! Geom handle) is not visible to the guard. + void MarkDirty() noexcept { myDirty = true; } + + //! True if `Internal()` or `MarkDirty()` flagged the entity modified. + [[nodiscard]] bool IsDirty() const noexcept { return myDirty; } + + //! INTERNAL USE ONLY. Mutable accessor; auto-flags dirty. External code MUST go + //! through Editor's typed setters. Use `operator->()` / `operator*()` for reads. + [[nodiscard]] T& Internal() noexcept + { + myDirty = true; + return *myEntity; + } + +private: + BRepGraph* myGraph; //!< Owning graph (nullptr after move). + T* myEntity; //!< Mutable entity pointer; access via Editor setters. + TypeId myId; //!< Identity for notification. + bool myDirty; //!< True once a setter has modified the entity in this scope. +}; + +#endif // _BRepGraph_MutGuard_HeaderFile diff --git a/opencascade/BRepGraph_NodeId.hxx b/opencascade/BRepGraph_NodeId.hxx new file mode 100644 index 000000000..acc73de38 --- /dev/null +++ b/opencascade/BRepGraph_NodeId.hxx @@ -0,0 +1,381 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_NodeId_HeaderFile +#define _BRepGraph_NodeId_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include + +//! Lightweight typed index into a per-kind node vector inside BRepGraph. +//! +//! The pair (NodeKind, Index) forms a unique node identifier within one graph +//! instance. Default-constructed NodeId has Index = UINT32_MAX (invalid). +//! +//! NodeId is a value type: cheap to copy, compare, hash. It carries no +//! pointer back to the owning graph; the caller is responsible for using +//! it with the correct BRepGraph instance. +struct BRepGraph_NodeId +{ + //! Enumeration of node kinds within a BRepGraph. + //! + //! Topology kinds 0-5 cover core hierarchy; Compound(6)/CompSolid(7) + //! are container kinds. Note: ordering does NOT match TopAbs_ShapeEnum. + //! Geometry kinds start at 10, leaving room for future topology extensions. + enum class Kind : int + { + Solid = 0, + Shell = 1, + Face = 2, + Wire = 3, + Edge = 4, + Vertex = 5, + Compound = 6, //!< TopoDS_Compound container + CompSolid = 7, //!< TopoDS_CompSolid container + CoEdge = 8, //!< Use of an edge on a face (owns PCurve data) + // Value 9 reserved for future topology kind extension. + Product = 10, //!< Reusable shape definition (part or assembly) + Occurrence = 11 //!< Placed instance of a product within a parent product + }; + + //! @brief Compile-time typed wrapper around BRepGraph_NodeId. + //! + //! Provides compile-time kind safety: a Typed + //! cannot be accidentally used where a Typed is expected. + //! Implicitly converts to BRepGraph_NodeId for backward compatibility. + //! + //! @tparam TheKind the BRepGraph_NodeId::Kind this typed id represents + template + struct Typed + { + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + uint32_t Index; + + //! Default: invalid (Index = UINT32_MAX). + Typed() + : Index(THE_INVALID_INDEX) + { + } + + //! Construct from index. + explicit Typed(const uint32_t theIdx) + : Index(theIdx) + { + } + + //! Construct from an untyped node id of the same kind. + explicit Typed(const BRepGraph_NodeId theId) + : Typed(FromNodeId(theId)) + { + } + + template = 0> + Typed(const Typed&) = delete; + + //! First valid id in a dense per-kind sequence. + [[nodiscard]] static Typed Start() { return Typed(THE_START_INDEX); } + + //! Invalid sentinel id. + [[nodiscard]] static Typed Invalid() { return Typed(); } + + //! True if this id points to an allocated node slot. + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + //! True if this id is within the dense range exposed by a provider with Nb(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + //! True if this id is within the dense range exposed by a provider with Size(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + //! Implicit conversion to untyped NodeId. + operator BRepGraph_NodeId() const { return BRepGraph_NodeId(TheKind, Index); } + + //! Explicit conversion from untyped NodeId. + //! Asserts that the Kind matches in debug builds. + //! @param[in] theId untyped NodeId to convert + static Typed FromNodeId(const BRepGraph_NodeId theId) + { + Standard_ASSERT_VOID(theId.NodeKind == TheKind, "NodeId kind mismatch"); + return Typed(theId.Index); + } + + bool operator==(const Typed& theOther) const { return Index == theOther.Index; } + + bool operator!=(const Typed& theOther) const { return Index != theOther.Index; } + + bool operator<(const Typed& theOther) const { return Index < theOther.Index; } + + bool operator<=(const Typed& theOther) const { return Index <= theOther.Index; } + + bool operator>(const Typed& theOther) const { return Index > theOther.Index; } + + bool operator>=(const Typed& theOther) const { return Index >= theOther.Index; } + + //! Pre-increment (++id). + Typed& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + Typed operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + Typed aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] Typed operator+(const uint32_t theOffset) const + { + return Typed(Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] Typed operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return Typed(Index - theOffset); + } + + //! Comparison with untyped NodeId (checks both Kind and Index). + bool operator==(const BRepGraph_NodeId& theOther) const + { + return theOther.NodeKind == TheKind && theOther.Index == Index; + } + + bool operator!=(const BRepGraph_NodeId& theOther) const { return !(*this == theOther); } + + //! Allow reversed comparison: NodeId == Typed. + friend bool operator==(const BRepGraph_NodeId& theLhs, const Typed& theRhs) + { + return theRhs == theLhs; + } + + friend bool operator!=(const BRepGraph_NodeId& theLhs, const Typed& theRhs) + { + return theRhs != theLhs; + } + }; + + //! True if the kind is a core topology kind (Solid..CoEdge). + static bool IsTopologyKind(const Kind theKind) { return static_cast(theKind) <= 8; } + + //! True if the kind is an assembly kind (Product or Occurrence). + static bool IsAssemblyKind(const Kind theKind) + { + return theKind == Kind::Product || theKind == Kind::Occurrence; + } + + //! Total number of dense kind slots used by per-kind arrays. + //! Includes the reserved gap at enum value 9. + static constexpr int THE_KIND_COUNT = static_cast(Kind::Occurrence) + 1; + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + Kind NodeKind; + uint32_t Index; + + //! Default: invalid NodeId (Index = UINT32_MAX). + //! NodeKind is set to Kind::Solid but is meaningless when !IsValid(). + BRepGraph_NodeId() + : NodeKind(Kind::Solid), + Index(THE_INVALID_INDEX) + { + } + + BRepGraph_NodeId(const Kind theKind, const uint32_t theIdx) + : NodeKind(theKind), + Index(theIdx) + { + } + + //! First valid id in a dense sequence for the specified kind. + [[nodiscard]] static BRepGraph_NodeId Start(const Kind theKind) + { + return BRepGraph_NodeId(theKind, THE_START_INDEX); + } + + //! Invalid sentinel id for the specified kind. + [[nodiscard]] static BRepGraph_NodeId Invalid(const Kind theKind = Kind::Solid) + { + return BRepGraph_NodeId(theKind, THE_INVALID_INDEX); + } + + //! True if this id points to an allocated node slot. + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + //! True if this id is within the dense range exposed by a provider with Nb(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + //! True if this id is within the dense range exposed by a provider with Size(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + bool operator==(const BRepGraph_NodeId& theOther) const + { + return NodeKind == theOther.NodeKind && Index == theOther.Index; + } + + bool operator!=(const BRepGraph_NodeId& theOther) const { return !(*this == theOther); } + + bool operator<(const BRepGraph_NodeId& theOther) const + { + if (NodeKind != theOther.NodeKind) + return static_cast(NodeKind) < static_cast(theOther.NodeKind); + return Index < theOther.Index; + } + + //! Pre-increment (++id). + BRepGraph_NodeId& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + BRepGraph_NodeId operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + BRepGraph_NodeId aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] BRepGraph_NodeId operator+(const uint32_t theOffset) const + { + return BRepGraph_NodeId(NodeKind, Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] BRepGraph_NodeId operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return BRepGraph_NodeId(NodeKind, Index - theOffset); + } + + //! Dispatch a generic node id to a callable taking the matching typed node id. + template + static auto Visit(const BRepGraph_NodeId theNodeId, FuncT&& theFunc) + -> decltype(std::forward(theFunc)(Typed())) + { + switch (theNodeId.NodeKind) + { + case Kind::Vertex: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Edge: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::CoEdge: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Wire: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Face: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Shell: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Solid: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Compound: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::CompSolid: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Product: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + case Kind::Occurrence: + return std::forward(theFunc)(Typed::FromNodeId(theNodeId)); + } + + Standard_ASSERT_VOID(false, "BRepGraph_NodeId::Visit: unhandled Kind"); + return std::forward(theFunc)(Typed()); + } +}; + +// Convenience type aliases for typed NodeIds. +using BRepGraph_SolidId = BRepGraph_NodeId::Typed; +using BRepGraph_ShellId = BRepGraph_NodeId::Typed; +using BRepGraph_FaceId = BRepGraph_NodeId::Typed; +using BRepGraph_WireId = BRepGraph_NodeId::Typed; +using BRepGraph_EdgeId = BRepGraph_NodeId::Typed; +using BRepGraph_VertexId = BRepGraph_NodeId::Typed; +using BRepGraph_CompoundId = BRepGraph_NodeId::Typed; +using BRepGraph_CompSolidId = BRepGraph_NodeId::Typed; +using BRepGraph_CoEdgeId = BRepGraph_NodeId::Typed; +using BRepGraph_ProductId = BRepGraph_NodeId::Typed; +using BRepGraph_OccurrenceId = BRepGraph_NodeId::Typed; + +//! std::hash specialization for BRepGraph_NodeId. +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_NodeId& theId) const noexcept + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(static_cast(theId.NodeKind)); + aCombination[1] = opencascade::hash(theId.Index); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; + +//! std::hash specialization for BRepGraph_NodeId::Typed. +template +struct std::hash> +{ + size_t operator()(const BRepGraph_NodeId::Typed& theId) const noexcept + { + return std::hash{}(static_cast(theId)); + } +}; + +#endif // _BRepGraph_NodeId_HeaderFile diff --git a/opencascade/BRepGraph_ParallelPolicy.hxx b/opencascade/BRepGraph_ParallelPolicy.hxx new file mode 100644 index 000000000..1523f4fbf --- /dev/null +++ b/opencascade/BRepGraph_ParallelPolicy.hxx @@ -0,0 +1,90 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_ParallelPolicy_HeaderFile +#define _BRepGraph_ParallelPolicy_HeaderFile + +#include + +#include +#include + +//! Lightweight workload-aware policy for deciding whether an internal phase +//! should actually launch parallel work when parallel mode is allowed. +//! +//! The goal is to avoid forcing every short-lived loop onto the thread pool. +//! Decisions are based on available worker capacity and on the amount of work +//! already visible to the phase, instead of on buried per-loop split sizes. +class BRepGraph_ParallelPolicy +{ +public: + //! Simple workload estimate for an execution phase. + struct Workload + { + int PrimaryItems = 0; //!< Main loop range. + int AuxiliaryItems = 0; //!< Additional independent items participating in the phase. + int InteractionCount = 0; //!< Pairwise or adjacency work discovered for the phase. + }; + + //! Return the effective logical worker count reported by OSD_Parallel. + [[nodiscard]] static int WorkerCount() + { + static const int THE_WORKER_COUNT = std::max(1, OSD_Parallel::NbLogicalProcessors()); + return THE_WORKER_COUNT; + } + + //! Check whether parallel execution is allowed and meaningful at all. + [[nodiscard]] static bool IsParallelAllowed(const bool theAllowParallel) + { + return theAllowParallel && WorkerCount() > 1; + } + + //! Decide whether the estimated workload is large enough to amortize + //! thread-pool launch and synchronization overhead. + [[nodiscard]] static bool ShouldRun(const bool theAllowParallel, + const int theWorkers, + const Workload& theWorkload) + { + if (!theAllowParallel || theWorkers <= 1) + { + return false; + } + + const int aPrimaryItems = std::max(theWorkload.PrimaryItems, 0); + if (aPrimaryItems <= 1) + { + return false; + } + + if (aPrimaryItems <= theWorkers) + { + return false; + } + + const int64_t aTotalWorkUnits = + static_cast(aPrimaryItems) + + static_cast(std::max(theWorkload.AuxiliaryItems, 0)) + + static_cast(std::max(theWorkload.InteractionCount, 0)); + const int64_t aRequiredWorkUnits = + static_cast(theWorkers) * static_cast(theWorkers); + return aTotalWorkUnits > aRequiredWorkUnits; + } + + //! Overload that queries the active worker count lazily. + [[nodiscard]] static bool ShouldRun(const bool theAllowParallel, const Workload& theWorkload) + { + return ShouldRun(theAllowParallel, WorkerCount(), theWorkload); + } +}; + +#endif // _BRepGraph_ParallelPolicy_HeaderFile diff --git a/opencascade/BRepGraph_ParentExplorer.hxx b/opencascade/BRepGraph_ParentExplorer.hxx new file mode 100644 index 000000000..c356806b2 --- /dev/null +++ b/opencascade/BRepGraph_ParentExplorer.hxx @@ -0,0 +1,291 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_ParentExplorer_HeaderFile +#define _BRepGraph_ParentExplorer_HeaderFile + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +//! @brief Upward occurrence-aware parent traversal for BRepGraph. +//! @see BRepGraph class comment "Iterator guide" for choosing between iterator types. +//! +//! Enumerates all ancestor nodes reachable from a starting node. +//! Traversal is path-aware: when the same definition is reached through multiple +//! occurrence paths, each path contributes its own parent sequence with its own +//! accumulated location and orientation. +//! +//! The traversal follows the actual graph structure transparently - every node +//! kind is visited as a distinct entity (no hidden collapses): +//! Vertex -> Edge, Edge -> CoEdge, CoEdge -> Wire, Wire -> Face, +//! Face -> Shell, Shell -> Solid, Solid -> CompSolid/Compound, +//! Product -> Occurrence, Occurrence -> Product (parent assembly). +//! +//! ## Traversal modes +//! - **Recursive**: walks the full ancestor chain to the graph roots. +//! Without target kind, all ancestors are emitted. +//! With target kind, only matching ancestors are emitted but intermediate +//! levels are traversed to reach them. +//! - **DirectParents**: yields only the immediate parents of the starting node. +//! No ascent into grandparents. With target kind, only parents +//! matching the kind are returned. +class BRepGraph_ParentExplorer +{ +public: + DEFINE_STANDARD_ALLOC + + //! Relationship kind between Current() and CurrentChild(). + enum class LinkKind + { + None, //!< No current branch step. + Reference, //!< Current() owns CurrentChild() through a RefId. + Structural, //!< Current() reaches CurrentChild() through a structural non-ref link. + }; + + //! Upward traversal strategy. + enum class TraversalMode + { + Recursive, //!< Walk the full ancestor chain to the graph roots. + DirectParents, //!< Yields only the immediate parents of the starting node. + }; + + //! Consolidated configuration for the explorer. + //! + //! Prefer this struct over the historical constructor family. The overloads + //! remain supported but the `Config`-based constructor is the long-term + //! idiom: new options can be added as fields without another ctor overload. + //! + //! @code + //! BRepGraph_ParentExplorer::Config aConfig; + //! aConfig.Mode = BRepGraph_ParentExplorer::TraversalMode::DirectParents; + //! aConfig.TargetKind = BRepGraph_NodeId::Kind::Shell; + //! for (auto [id, loc, ori] : BRepGraph_ParentExplorer(aGraph, aNode, aConfig)) { ... } + //! @endcode + struct Config + { + TraversalMode Mode = TraversalMode::Recursive; + std::optional + TargetKind; //!< Emit only this kind (no value = emit all). + std::optional AvoidKind; //!< Do not ascend through this kind. + bool EmitAvoidKind = false; //!< Emit matching avoid-kind ancestors once. + }; + + //! Preferred long-term constructor: all tuning knobs in `Config`. + //! @param[in] theGraph graph to walk + //! @param[in] theNode starting node whose ancestors are explored + //! @param[in] theConfig traversal configuration + Standard_EXPORT BRepGraph_ParentExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + const Config& theConfig); + + //! Explore all parents of the starting node. + Standard_EXPORT BRepGraph_ParentExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theNode); + + //! Explore parents of the starting node using the given traversal mode. + Standard_EXPORT BRepGraph_ParentExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + TraversalMode theMode); + + //! Explore all parents while pruning branches at the avoid kind. + Standard_EXPORT BRepGraph_ParentExplorer( + const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + const std::optional& theAvoidKind, + bool theEmitAvoidKind, + TraversalMode theMode = TraversalMode::Recursive); + + //! Explore only parents of the given kind. + Standard_EXPORT BRepGraph_ParentExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + BRepGraph_NodeId::Kind theTargetKind); + + //! Explore only parents of the given kind using the given traversal mode. + Standard_EXPORT BRepGraph_ParentExplorer(const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + BRepGraph_NodeId::Kind theTargetKind, + TraversalMode theMode); + + //! Explore parents of the given kind while pruning branches at the avoid kind. + Standard_EXPORT BRepGraph_ParentExplorer( + const BRepGraph& theGraph, + const BRepGraph_NodeId theNode, + BRepGraph_NodeId::Kind theTargetKind, + const std::optional& theAvoidKind, + bool theEmitAvoidKind, + TraversalMode theMode = TraversalMode::Recursive); + + //! Returns the traversal configuration this explorer was constructed with. + //! Read-only - configuration is fixed for the lifetime of the explorer. + [[nodiscard]] const Config& GetConfig() const { return myConfig; } + + //! True if another matching parent is available. + [[nodiscard]] bool More() const { return myHasMore; } + + //! Advance to the next matching parent. + Standard_EXPORT void Next(); + + //! Current matching ancestor node with accumulated location and orientation. + [[nodiscard]] BRepGraphInc::NodeInstance Current() const + { + if (myHasMore) + { + return {myCurrent, myLocation, myOrientation}; + } + return {}; + } + + //! Returns the immediate child of Current() on the currently emitted branch. + //! Returns invalid NodeId when no current ancestor is available. + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId CurrentChild() const; + + //! Returns how Current() is linked to CurrentChild(). + [[nodiscard]] Standard_EXPORT LinkKind CurrentLinkKind() const; + + //! Returns the exact parent-owned RefId linking Current() to CurrentChild(), + //! when that branch step is represented by a reference entry. + //! + //! Some upward steps are structural and therefore have no parent-owned ref + //! entry even though the parent itself is still emitted by the explorer. + //! In those cases this method returns an invalid RefId, for example for + //! CoEdge->Edge, Product(part)->ShapeRoot and Occurrence->Product. + [[nodiscard]] Standard_EXPORT BRepGraph_RefId CurrentRef() const; + + //! Accumulated location at the starting node of the current branch. + [[nodiscard]] Standard_EXPORT const TopLoc_Location& LeafLocation() const; + + //! Accumulated orientation at the starting node of the current branch. + [[nodiscard]] Standard_EXPORT TopAbs_Orientation LeafOrientation() const; + + //! True if Current() is the explicit root node of the current branch. + [[nodiscard]] Standard_EXPORT bool IsCurrentBranchRoot() const; + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + struct StackFrame + { + BRepGraph_NodeId Node; + uint32_t NextParentIdx = 0; + int StepToChild = -1; + TopLoc_Location AccLocation; + TopAbs_Orientation AccOrientation = TopAbs_FORWARD; + }; + + Standard_EXPORT void startTraversal(); + Standard_EXPORT void advance(); + Standard_EXPORT bool emitNextFromCurrentBranch(); + Standard_EXPORT void backtrackAfterBranchEmission(); + Standard_EXPORT bool nextParentFrame(StackFrame& theChild, StackFrame& theParent) const; + Standard_EXPORT void prepareCurrentBranch(); + Standard_EXPORT void applyTransition(const BRepGraph_NodeId theParent, + const BRepGraph_NodeId theChild, + const int theStepToChild, + TopLoc_Location& theLocation, + TopAbs_Orientation& theOrientation) const; + + [[nodiscard]] Standard_EXPORT int branchRootFrame() const; + + Standard_EXPORT bool findNthProductWrapper(const BRepGraph_NodeId theNode, + const uint32_t theOrdinal, + BRepGraph_ProductId& theProduct) const; + + Standard_EXPORT bool findParentProduct(const BRepGraph_OccurrenceId theOccurrence, + BRepGraph_ProductId& theProduct) const; + Standard_EXPORT int findOccurrenceStep(const BRepGraph_ProductId theParentProduct, + const BRepGraph_OccurrenceId theOccurrence) const; + Standard_EXPORT int findCompoundChildStep(const BRepGraph_CompoundId theParent, + const BRepGraph_NodeId theChild) const; + Standard_EXPORT int findCompSolidSolidStep(const BRepGraph_CompSolidId theParent, + const BRepGraph_SolidId theChild) const; + Standard_EXPORT int findSolidChildStep(const BRepGraph_SolidId theParent, + const BRepGraph_NodeId theChild) const; + Standard_EXPORT int findShellChildStep(const BRepGraph_ShellId theParent, + const BRepGraph_NodeId theChild) const; + Standard_EXPORT int findFaceChildStep(const BRepGraph_FaceId theParent, + const BRepGraph_NodeId theChild) const; + Standard_EXPORT int findWireCoEdgeStep(const BRepGraph_WireId theParent, + const BRepGraph_CoEdgeId theChild) const; + Standard_EXPORT int findEdgeVertexStep(const BRepGraph_EdgeId theParent, + const BRepGraph_VertexId theChild) const; + + static std::optional normalizeAvoidKind( + const BRepGraph_NodeId theNode, + const std::optional& theTargetKind, + const std::optional& theAvoidKind); + + static bool canContainTarget(BRepGraph_NodeId::Kind theParentKind, + BRepGraph_NodeId::Kind theTargetKind); + + Standard_EXPORT void pushFrame(const StackFrame& theFrame); + Standard_EXPORT void popFrame(); + + [[nodiscard]] bool matchesAvoid(const BRepGraph_NodeId theNode) const + { + return myConfig.AvoidKind.has_value() && theNode.NodeKind == *myConfig.AvoidKind; + } + + [[nodiscard]] bool shouldEmit(const BRepGraph_NodeId theNode) const + { + const bool isAvoid = matchesAvoid(theNode); + const bool isFind = + !myConfig.TargetKind.has_value() || theNode.NodeKind == *myConfig.TargetKind; + return myConfig.EmitAvoidKind ? (isFind || isAvoid) : (isFind && !isAvoid); + } + + StackFrame& topFrame() { return myStack[myStackTop]; } + + const StackFrame& topFrame() const { return myStack[myStackTop]; } + + Standard_EXPORT TopLoc_Location stepLocation(const BRepGraph_NodeId theParent, + const int theRefIdx) const; + Standard_EXPORT TopAbs_Orientation stepOrientation(const BRepGraph_NodeId theParent, + const int theRefIdx) const; + +private: + static constexpr int THE_INLINE_STACK_SIZE = 16; + + const BRepGraph* myGraph = nullptr; + BRepGraph_NodeId myNode; + Config myConfig; //!< Traversal configuration - single source of truth. + + NCollection_LocalArray myStack; + int myStackTop = -1; + int myEmitIndex = -1; + int myCurrentFrame = -1; + + BRepGraph_NodeId myCurrent; + TopLoc_Location myLocation; + TopAbs_Orientation myOrientation = TopAbs_FORWARD; + bool myHasMore = false; +}; + +#endif // _BRepGraph_ParentExplorer_HeaderFile \ No newline at end of file diff --git a/opencascade/BRepGraph_RefId.hxx b/opencascade/BRepGraph_RefId.hxx new file mode 100644 index 000000000..3c7c34f55 --- /dev/null +++ b/opencascade/BRepGraph_RefId.hxx @@ -0,0 +1,331 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RefId_HeaderFile +#define _BRepGraph_RefId_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include + +//! Lightweight typed index into a per-kind reference vector inside BRepGraph. +//! +//! The pair (Kind, Index) forms a unique reference identifier within one graph +//! instance. Default-constructed RefId has Index = UINT32_MAX (invalid). +struct BRepGraph_RefId +{ + //! Enumeration of supported topology reference kinds. + enum class Kind : int + { + Shell = 0, //!< Shell reference entries (usage of shell definitions) + Face = 1, //!< Face reference entries (usage of face definitions) + Wire = 2, //!< Wire reference entries (usage of wire definitions) + CoEdge = 3, //!< CoEdge reference entries (usage of coedge definitions) + Vertex = 4, //!< Vertex reference entries (usage of vertex definitions) + Solid = 5, //!< Solid reference entries (usage of solid definitions) + Child = 6, //!< Generic child references (usage of mixed node definitions) + Occurrence = 7 //!< Occurrence references (usage of occurrence definitions) + }; + + //! @brief Compile-time typed wrapper around BRepGraph_RefId. + //! + //! Provides compile-time kind safety similarly to BRepGraph_NodeId::Typed. + template + struct Typed + { + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + uint32_t Index; + + Typed() + : Index(THE_INVALID_INDEX) + { + } + + explicit Typed(const uint32_t theIdx) + : Index(theIdx) + { + } + + //! Construct from an untyped reference id of the same kind. + explicit Typed(const BRepGraph_RefId theRefId) + : Typed(FromRefId(theRefId)) + { + } + + template = 0> + Typed(const Typed&) = delete; + + //! First valid id in a dense per-kind sequence. + [[nodiscard]] static Typed Start() { return Typed(THE_START_INDEX); } + + //! Invalid sentinel id. + [[nodiscard]] static Typed Invalid() { return Typed(); } + + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + operator BRepGraph_RefId() const { return BRepGraph_RefId(TheKind, Index); } + + static Typed FromRefId(const BRepGraph_RefId theRefId) + { + Standard_ASSERT_VOID(theRefId.RefKind == TheKind, "RefId kind mismatch"); + return Typed(theRefId.Index); + } + + bool operator==(const Typed& theOther) const { return Index == theOther.Index; } + + bool operator!=(const Typed& theOther) const { return Index != theOther.Index; } + + bool operator<(const Typed& theOther) const { return Index < theOther.Index; } + + bool operator<=(const Typed& theOther) const { return Index <= theOther.Index; } + + bool operator>(const Typed& theOther) const { return Index > theOther.Index; } + + bool operator>=(const Typed& theOther) const { return Index >= theOther.Index; } + + //! Pre-increment (++id). + Typed& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + Typed operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + Typed aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] Typed operator+(const uint32_t theOffset) const + { + return Typed(Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] Typed operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return Typed(Index - theOffset); + } + + bool operator==(const BRepGraph_RefId& theOther) const + { + return theOther.RefKind == TheKind && theOther.Index == Index; + } + + bool operator!=(const BRepGraph_RefId& theOther) const { return !(*this == theOther); } + + friend bool operator==(const BRepGraph_RefId& theLhs, const Typed& theRhs) + { + return theRhs == theLhs; + } + + friend bool operator!=(const BRepGraph_RefId& theLhs, const Typed& theRhs) + { + return theRhs != theLhs; + } + }; + + static bool IsTopologyRefKind(const Kind theKind) + { + return static_cast(theKind) >= static_cast(Kind::Shell) + && static_cast(theKind) <= static_cast(Kind::Child); + } + + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + Kind RefKind; + uint32_t Index; + + BRepGraph_RefId() + : RefKind(Kind::Shell), + Index(THE_INVALID_INDEX) + { + } + + BRepGraph_RefId(const Kind theKind, const uint32_t theIdx) + : RefKind(theKind), + Index(theIdx) + { + } + + //! First valid id in a dense sequence for the specified kind. + [[nodiscard]] static BRepGraph_RefId Start(const Kind theKind) + { + return BRepGraph_RefId(theKind, THE_START_INDEX); + } + + //! Invalid sentinel id for the specified kind. + [[nodiscard]] static BRepGraph_RefId Invalid(const Kind theKind = Kind::Shell) + { + return BRepGraph_RefId(theKind, THE_INVALID_INDEX); + } + + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + bool operator==(const BRepGraph_RefId& theOther) const + { + return RefKind == theOther.RefKind && Index == theOther.Index; + } + + bool operator!=(const BRepGraph_RefId& theOther) const { return !(*this == theOther); } + + bool operator<(const BRepGraph_RefId& theOther) const + { + if (RefKind != theOther.RefKind) + return static_cast(RefKind) < static_cast(theOther.RefKind); + return Index < theOther.Index; + } + + //! Pre-increment (++id). + BRepGraph_RefId& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + BRepGraph_RefId operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + BRepGraph_RefId aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] BRepGraph_RefId operator+(const uint32_t theOffset) const + { + return BRepGraph_RefId(RefKind, Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] BRepGraph_RefId operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return BRepGraph_RefId(RefKind, Index - theOffset); + } + + //! Dispatch a generic ref id to a callable taking the matching typed ref id. + template + static auto Visit(const BRepGraph_RefId theRefId, FuncT&& theFunc) + -> decltype(std::forward(theFunc)(Typed())) + { + switch (theRefId.RefKind) + { + case Kind::Shell: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Face: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Wire: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::CoEdge: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Vertex: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Solid: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Child: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + case Kind::Occurrence: + return std::forward(theFunc)(Typed::FromRefId(theRefId)); + } + + Standard_ASSERT_VOID(false, "BRepGraph_RefId::Visit: unhandled Kind"); + return std::forward(theFunc)(Typed()); + } +}; + +using BRepGraph_ShellRefId = BRepGraph_RefId::Typed; +using BRepGraph_FaceRefId = BRepGraph_RefId::Typed; +using BRepGraph_WireRefId = BRepGraph_RefId::Typed; +using BRepGraph_CoEdgeRefId = BRepGraph_RefId::Typed; +using BRepGraph_VertexRefId = BRepGraph_RefId::Typed; +using BRepGraph_SolidRefId = BRepGraph_RefId::Typed; +using BRepGraph_ChildRefId = BRepGraph_RefId::Typed; +using BRepGraph_OccurrenceRefId = BRepGraph_RefId::Typed; + +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_RefId& theId) const noexcept + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(static_cast(theId.RefKind)); + aCombination[1] = opencascade::hash(theId.Index); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; + +template +struct std::hash> +{ + size_t operator()(const BRepGraph_RefId::Typed& theId) const noexcept + { + return std::hash{}(static_cast(theId)); + } +}; + +#endif // _BRepGraph_RefId_HeaderFile diff --git a/opencascade/BRepGraph_RefTransientCache.hxx b/opencascade/BRepGraph_RefTransientCache.hxx new file mode 100644 index 000000000..d88728106 --- /dev/null +++ b/opencascade/BRepGraph_RefTransientCache.hxx @@ -0,0 +1,177 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RefTransientCache_HeaderFile +#define _BRepGraph_RefTransientCache_HeaderFile + +#include +#include + +#include + +#include +#include + +//! @brief Centralized transient cache for algorithm-computed per-reference values. +//! +//! Symmetric counterpart of BRepGraph_TransientCache, keyed by BRepGraph_RefId +//! instead of BRepGraph_NodeId. Freshness is tracked via BaseRef::OwnGen rather +//! than BaseDef::SubtreeGen, because references do not own subtrees. +//! +//! Shares the same BRepGraph_CacheKind descriptors and BRepGraph_CacheKindRegistry +//! as the node cache; the same kind GUID can address values in both caches. +//! +//! ## OwnGen-based freshness +//! Each stored slot records OwnGen at write time. On read, if the stored OwnGen +//! differs from the reference's current OwnGen the cached value is considered stale. +//! +//! ## Lifecycle +//! NOT a Layer. Cleared on BRepGraph_Builder::Add() and Compact(). No explicit removal callback +//! - stale data is auto-detected by OwnGen mismatch. +//! +//! ## Thread safety +//! After Reserve(), Get() and Set() for in-range indices bypass the mutex entirely. +//! Out-of-range access falls back to mutex-protected vector growth. +class BRepGraph_RefTransientCache +{ +public: + //! Number of BRepGraph_RefId::Kind enum values (Shell..Occurrence = 0..7). + static constexpr int THE_REF_KIND_COUNT = 8; + + //! Default number of cache-kind slots reserved after BRepGraph_Builder::Add(). + static constexpr int THE_DEFAULT_RESERVED_KIND_COUNT = 16; + + //! Per-slot storage: cached value handle + OwnGen stamp. + struct CacheSlot + { + occ::handle Value; + uint32_t StoredOwnGen = 0; + }; + + //! Store a cached value for a reference and cache kind. + //! @pre Reserve() must have been called for lock-free parallel access + //! on in-range entity indices; out-of-range access falls back to mutex. + Standard_EXPORT void Set(const BRepGraph_RefId theRef, + const occ::handle& theKind, + const occ::handle& theValue, + const uint32_t theCurrentOwnGen); + + //! Store a cached value using a pre-resolved kind slot index. + //! Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths. + //! @param[in] theKindSlot slot from BRepGraph_CacheKindRegistry::Register() + Standard_EXPORT void Set(const BRepGraph_RefId theRef, + const int theKindSlot, + const occ::handle& theValue, + const uint32_t theCurrentOwnGen); + + //! Retrieve a cached value for a reference and cache kind. + //! Returns null handle if no value is stored or if OwnGen has changed. + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_RefId theRef, + const occ::handle& theKind, + const uint32_t theCurrentOwnGen) const; + + //! Retrieve a cached value using a pre-resolved kind slot index. + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_RefId theRef, + const int theKindSlot, + const uint32_t theCurrentOwnGen) const; + + //! Remove a cached value for a reference and cache kind. + [[nodiscard]] Standard_EXPORT bool Remove(const BRepGraph_RefId theRef, + const occ::handle& theKind); + + //! Remove a cached value using a pre-resolved cache-kind slot. + [[nodiscard]] Standard_EXPORT bool Remove(const BRepGraph_RefId theRef, const int theKindSlot); + + //! Collect fresh cache-kind slot indices for a reference (zero heap allocation). + //! Used internally by CacheView::CacheKindIterator. + //! @param[in] theRef reference to query + //! @param[in] theCurrentOwnGen freshness stamp to match + //! @param[out] theSlots output array (caller-allocated, must hold + //! THE_DEFAULT_RESERVED_KIND_COUNT) + //! @return number of populated slots written to theSlots + Standard_EXPORT int CollectCacheKindSlots(const BRepGraph_RefId theRef, + const uint32_t theCurrentOwnGen, + int theSlots[]) const; + + //! Pre-allocate storage for lock-free parallel access. + Standard_EXPORT void Reserve(const int theKindCount, const int theCounts[THE_REF_KIND_COUNT]); + + //! True if Reserve() has been called and storage is pre-allocated. + [[nodiscard]] bool IsReserved() const noexcept + { + return myIsReserved.load(std::memory_order_acquire); + } + + //! Clear all cached data. Called on BRepGraph_Builder::Add() and Compact(). + Standard_EXPORT void Clear() noexcept; + + //! Move constructor: transfers data, creates fresh mutex. + BRepGraph_RefTransientCache(BRepGraph_RefTransientCache&& theOther) noexcept + : myKinds(std::move(theOther.myKinds)), + myIsReserved(theOther.myIsReserved.load(std::memory_order_relaxed)) + { + theOther.myIsReserved.store(false, std::memory_order_relaxed); + } + + //! Move assignment: transfers data, mutex stays local. + BRepGraph_RefTransientCache& operator=(BRepGraph_RefTransientCache&& theOther) noexcept + { + if (this != &theOther) + { + myKinds = std::move(theOther.myKinds); + myIsReserved.store(theOther.myIsReserved.load(std::memory_order_relaxed), + std::memory_order_relaxed); + theOther.myIsReserved.store(false, std::memory_order_relaxed); + } + return *this; + } + + BRepGraph_RefTransientCache() = default; + BRepGraph_RefTransientCache(const BRepGraph_RefTransientCache&) = delete; + BRepGraph_RefTransientCache& operator=(const BRepGraph_RefTransientCache&) = delete; + +private: + //! Per-ref-kind dense vector of cache slots. + struct RefKindStore + { + NCollection_DynamicArray mySlots; + }; + + //! Per-cache-kind storage: one ref-kind store per reference kind. + struct CacheKindSlot + { + RefKindStore myRefKinds[THE_REF_KIND_COUNT]; + }; + + //! Ensure myKinds has capacity for the given cache-kind slot. + void ensureKind(const int theKindSlot); + + //! Access slot (mutable) - grows vector if needed. + CacheSlot& changeSlot(const BRepGraph_RefId theRef, const int theKindSlot); + + //! Access slot (const) - returns nullptr if out of range. + const CacheSlot* seekSlot(const BRepGraph_RefId theRef, const int theKindSlot) const; + + //! Outer vector indexed by cache-kind slot. + NCollection_DynamicArray myKinds; + + //! True after Reserve() - enables lock-free access for in-range slots. + std::atomic myIsReserved{false}; + + //! Protects structural modifications (vector growth) during concurrent access. + mutable std::shared_mutex myMutex; +}; + +#endif // _BRepGraph_RefTransientCache_HeaderFile diff --git a/opencascade/BRepGraph_RefUID.hxx b/opencascade/BRepGraph_RefUID.hxx new file mode 100644 index 000000000..c19c57631 --- /dev/null +++ b/opencascade/BRepGraph_RefUID.hxx @@ -0,0 +1,105 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RefUID_HeaderFile +#define _BRepGraph_RefUID_HeaderFile + +#include + +#include +#include +#include + +//! Unique reference identifier within a BRepGraph. +//! +//! Identity = (RefKind, Counter). Generation is excluded from equality/hash. +//! Counter 0 is an invalid sentinel. +//! +//! ## Serialization Contract +//! +//! Entity UIDs (BRepGraph_UID) and reference UIDs (BRepGraph_RefUID) share +//! a single monotonic counter (BRepGraph_Data::myNextUIDCounter). +//! To persist a BRepGraph across sessions: +//! 1. Write: for each reference entry, serialize (RefKind, Counter, OwnGen). +//! 2. Read: reconstruct reference entries, populate RefUID vectors with +//! deserialized (RefKind, Counter) values, set myNextUIDCounter to +//! max(all_entity_counters, all_ref_counters) + 1. +//! 3. myGeneration resets to 0 on load (session-scoped). +//! 4. VersionStamps from a previous session will correctly detect staleness +//! via Generation mismatch. +struct BRepGraph_RefUID +{ + BRepGraph_RefUID() + : myCounter(0), + myKind(BRepGraph_RefId::Kind::Shell), + myGeneration(0) + { + } + + BRepGraph_RefUID(const BRepGraph_RefId::Kind theKind, + const size_t theCounter, + const uint32_t theGeneration) + : myCounter(theCounter), + myKind(theKind), + myGeneration(theGeneration) + { + Standard_ASSERT_VOID(theCounter > 0, "BRepGraph_RefUID: counter must be > 0 for valid UIDs"); + } + + static BRepGraph_RefUID Invalid() { return BRepGraph_RefUID(); } + + [[nodiscard]] bool IsValid() const { return myCounter > 0; } + + [[nodiscard]] BRepGraph_RefId::Kind Kind() const { return myKind; } + + [[nodiscard]] size_t Counter() const { return myCounter; } + + [[nodiscard]] uint32_t Generation() const { return myGeneration; } + + bool operator==(const BRepGraph_RefUID& theOther) const + { + if (myCounter == 0 || theOther.myCounter == 0) + return (myCounter == 0) == (theOther.myCounter == 0); + return myKind == theOther.myKind && myCounter == theOther.myCounter; + } + + bool operator!=(const BRepGraph_RefUID& theOther) const { return !(*this == theOther); } + + bool operator<(const BRepGraph_RefUID& theOther) const + { + if (myKind != theOther.myKind) + return static_cast(myKind) < static_cast(theOther.myKind); + return myCounter < theOther.myCounter; + } + + [[nodiscard]] size_t HashValue() const + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(static_cast(myKind)); + aCombination[1] = opencascade::hash(myCounter); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } + +private: + size_t myCounter; + BRepGraph_RefId::Kind myKind; + uint32_t myGeneration; +}; + +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_RefUID& theUID) const noexcept { return theUID.HashValue(); } +}; + +#endif // _BRepGraph_RefUID_HeaderFile diff --git a/opencascade/BRepGraph_RefsIterator.hxx b/opencascade/BRepGraph_RefsIterator.hxx new file mode 100644 index 000000000..e259343ab --- /dev/null +++ b/opencascade/BRepGraph_RefsIterator.hxx @@ -0,0 +1,687 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RefsIterator_HeaderFile +#define _BRepGraph_RefsIterator_HeaderFile + +#include +#include +#include + +#include + +//! @brief Single-level typed iterators over active child reference ids. +//! +//! These iterators provide the direct active child RefIds owned by one parent. +//! They skip removed refs, invalid targets, and refs pointing to removed child +//! definitions. +namespace BRepGraph_RefsIterator +{ +namespace Detail +{ +template +struct RefTraits; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_ShellRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Shells().Nb(); } + + static const BRepGraphInc::ShellRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Shells().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_FaceRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Faces().Nb(); } + + static const BRepGraphInc::FaceRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Faces().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_WireRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Wires().Nb(); } + + static const BRepGraphInc::WireRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Wires().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_CoEdgeRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().CoEdges().Nb(); } + + static const BRepGraphInc::CoEdgeRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().CoEdges().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_VertexRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Vertices().Nb(); } + + static const BRepGraphInc::VertexRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Vertices().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_SolidRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Solids().Nb(); } + + static const BRepGraphInc::SolidRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Solids().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_ChildRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Children().Nb(); } + + static const BRepGraphInc::ChildRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } +}; + +template <> +struct RefTraits +{ + using RefId = BRepGraph_OccurrenceRefId; + + static int Count(const BRepGraph& theGraph) { return theGraph.Refs().Occurrences().Nb(); } + + static const BRepGraphInc::OccurrenceRef& Get(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Occurrences().Entry(theRefId); + } +}; +} // namespace Detail + +template +class RefIterator +{ +public: + using Traits = Detail::RefTraits; + using RefId = typename Traits::RefId; + + RefIterator(const BRepGraph& theGraph) + : myGraph(theGraph), + myLength(RefId(Traits::Count(theGraph))) + { + skipRemoved(); + } + + RefIterator(const BRepGraph& theGraph, const RefId theStartId) + : myGraph(theGraph), + myCurrent(theStartId), + myLength(RefId(Traits::Count(theGraph))) + { + if (myCurrent < RefId::Start()) + { + myCurrent = RefId::Start(); + } + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myCurrent < myLength; } + + void Next() + { + ++myCurrent; + skipRemoved(); + } + + [[nodiscard]] const RefType& Current() const { return Traits::Get(myGraph, myCurrent); } + + [[nodiscard]] RefId CurrentId() const { return myCurrent; } + + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + void skipRemoved() + { + if constexpr (!TheFullTraverse) + { + while (myCurrent < myLength && Current().IsRemoved) + { + ++myCurrent; + } + } + } + + const BRepGraph& myGraph; + RefId myCurrent = RefId::Start(); + RefId myLength; +}; + +template +struct BaseTraits +{ + using ParentId = ParentIdT; + using RefId = RefIdT; + using RefEntry = RefEntryT; +}; + +template +inline const BRepGraphInc::BaseDef* childBaseDef(const BRepGraph& theGraph, + const ChildIdT theChildId) +{ + return theGraph.Topo().Gen().TopoEntity(BRepGraph_NodeId(theChildId)); +} + +inline const BRepGraphInc::BaseDef* childBaseDef(const BRepGraph& theGraph, + const BRepGraph_NodeId theChildId) +{ + return theGraph.Topo().Gen().TopoEntity(theChildId); +} + +struct ShellOfSolidTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Solids().Nb()) + && !theGraph.Topo().Solids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Solids().Definition(theParent).ShellRefIds; + } + + static const BRepGraphInc::ShellRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Shells().Entry(theRefId); + } + + static BRepGraph_ShellId ChildIdOf(const BRepGraph&, const BRepGraphInc::ShellRef& theRef) + { + return theRef.ShellDefId; + } +}; + +struct FaceOfShellTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Shells().Nb()) + && !theGraph.Topo().Shells().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Shells().Definition(theParent).FaceRefIds; + } + + static const BRepGraphInc::FaceRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Faces().Entry(theRefId); + } + + static BRepGraph_FaceId ChildIdOf(const BRepGraph&, const BRepGraphInc::FaceRef& theRef) + { + return theRef.FaceDefId; + } +}; + +struct ChildOfShellTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Shells().Nb()) + && !theGraph.Topo().Shells().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Shells().Definition(theParent).AuxChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static BRepGraph_NodeId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } +}; + +struct WireOfFaceTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Faces().Nb()) + && !theGraph.Topo().Faces().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Faces().Definition(theParent).WireRefIds; + } + + static const BRepGraphInc::WireRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Wires().Entry(theRefId); + } + + static BRepGraph_WireId ChildIdOf(const BRepGraph&, const BRepGraphInc::WireRef& theRef) + { + return theRef.WireDefId; + } +}; + +struct VertexOfFaceTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Faces().Nb()) + && !theGraph.Topo().Faces().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Faces().Definition(theParent).VertexRefIds; + } + + static const BRepGraphInc::VertexRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Vertices().Entry(theRefId); + } + + static BRepGraph_VertexId ChildIdOf(const BRepGraph&, const BRepGraphInc::VertexRef& theRef) + { + return theRef.VertexDefId; + } +}; + +struct CoEdgeOfWireTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Wires().Nb()) + && !theGraph.Topo().Wires().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Wires().Definition(theParent).CoEdgeRefIds; + } + + static const BRepGraphInc::CoEdgeRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().CoEdges().Entry(theRefId); + } + + static BRepGraph_CoEdgeId ChildIdOf(const BRepGraph&, const BRepGraphInc::CoEdgeRef& theRef) + { + return theRef.CoEdgeDefId; + } +}; + +struct SolidOfCompSolidTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().CompSolids().Nb()) + && !theGraph.Topo().CompSolids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().CompSolids().Definition(theParent).SolidRefIds; + } + + static const BRepGraphInc::SolidRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Solids().Entry(theRefId); + } + + static BRepGraph_SolidId ChildIdOf(const BRepGraph&, const BRepGraphInc::SolidRef& theRef) + { + return theRef.SolidDefId; + } +}; + +struct ChildOfSolidTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Solids().Nb()) + && !theGraph.Topo().Solids().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Solids().Definition(theParent).AuxChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static BRepGraph_NodeId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } +}; + +struct ChildOfCompoundTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Compounds().Nb()) + && !theGraph.Topo().Compounds().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Compounds().Definition(theParent).ChildRefIds; + } + + static const BRepGraphInc::ChildRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Children().Entry(theRefId); + } + + static BRepGraph_NodeId ChildIdOf(const BRepGraph&, const BRepGraphInc::ChildRef& theRef) + { + return theRef.ChildDefId; + } +}; + +struct OccurrenceOfProductTraits + : public BaseTraits +{ + static bool IsParentValid(const BRepGraph& theGraph, const ParentId theParent) + { + return theParent.IsValid(theGraph.Topo().Products().Nb()) + && !theGraph.Topo().Products().Definition(theParent).IsRemoved; + } + + static const NCollection_DynamicArray& RefIds(const BRepGraph& theGraph, + const ParentId theParent) + { + return theGraph.Topo().Products().Definition(theParent).OccurrenceRefIds; + } + + static const BRepGraphInc::OccurrenceRef& Ref(const BRepGraph& theGraph, const RefId theRefId) + { + return theGraph.Refs().Occurrences().Entry(theRefId); + } + + static BRepGraph_OccurrenceId ChildIdOf(const BRepGraph&, + const BRepGraphInc::OccurrenceRef& theRef) + { + return theRef.OccurrenceDefId; + } +}; + +template +class RefsOfParent +{ +public: + using ParentId = typename TraitsT::ParentId; + using RefId = typename TraitsT::RefId; + + RefsOfParent(const BRepGraph& theGraph, const ParentId theParent) + : myGraph(theGraph) + { + if (!TraitsT::IsParentValid(theGraph, theParent)) + { + return; + } + + myRefIds = &TraitsT::RefIds(theGraph, theParent); + myLength = static_cast(myRefIds->Size()); + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myRefIds != nullptr && myIndex < myLength; } + + void Next() + { + ++myIndex; + skipRemoved(); + } + + [[nodiscard]] RefId CurrentId() const { return myRefIds->Value(static_cast(myIndex)); } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + void skipRemoved() + { + while (myRefIds != nullptr && myIndex < myLength) + { + const typename TraitsT::RefEntry& aRef = + TraitsT::Ref(myGraph, myRefIds->Value(static_cast(myIndex))); + if (!aRef.IsRemoved) + { + const BRepGraphInc::BaseDef* aChildDef = + childBaseDef(myGraph, TraitsT::ChildIdOf(myGraph, aRef)); + if (aChildDef != nullptr && !aChildDef->IsRemoved) + { + return; + } + } + ++myIndex; + } + } + + const BRepGraph& myGraph; + const NCollection_DynamicArray* myRefIds = nullptr; + uint32_t myIndex = 0; + uint32_t myLength = 0; +}; + +//! @brief Direct active vertex reference ids of an edge. +//! +//! Iteration order is start vertex, end vertex, then internal/external vertices. +class RefsVertexOfEdge +{ +public: + using RefId = BRepGraph_VertexRefId; + + RefsVertexOfEdge(const BRepGraph& theGraph, const BRepGraph_EdgeId theEdgeId) + : myGraph(theGraph) + { + if (!theEdgeId.IsValid(theGraph.Topo().Edges().Nb()) + || theGraph.Topo().Edges().Definition(theEdgeId).IsRemoved) + { + return; + } + + myEdge = &theGraph.Topo().Edges().Definition(theEdgeId); + myLength = 2u + static_cast(myEdge->InternalVertexRefIds.Size()); + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myEdge != nullptr && myIndex < myLength; } + + void Next() + { + ++myIndex; + skipRemoved(); + } + + [[nodiscard]] RefId CurrentId() const { return refIdAt(myIndex); } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + [[nodiscard]] RefId refIdAt(const uint32_t theIndex) const + { + if (theIndex == 0) + { + return myEdge->StartVertexRefId; + } + if (theIndex == 1) + { + return myEdge->EndVertexRefId; + } + return myEdge->InternalVertexRefIds.Value(static_cast(theIndex - 2)); + } + + void skipRemoved() + { + while (myEdge != nullptr && myIndex < myLength) + { + const RefId aRefId = refIdAt(myIndex); + if (aRefId.IsValid()) + { + const BRepGraphInc::VertexRef& aRef = myGraph.Refs().Vertices().Entry(aRefId); + if (!aRef.IsRemoved) + { + const BRepGraphInc::BaseDef* aChildDef = + myGraph.Topo().Gen().TopoEntity(BRepGraph_NodeId(aRef.VertexDefId)); + if (aChildDef != nullptr && !aChildDef->IsRemoved) + { + return; + } + } + } + ++myIndex; + } + } + + const BRepGraph& myGraph; + const BRepGraphInc::EdgeDef* myEdge = nullptr; + uint32_t myIndex = 0; + uint32_t myLength = 0; +}; + +} // namespace BRepGraph_RefsIterator + +using BRepGraph_RefsShellOfSolid = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsFaceOfShell = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsChildOfShell = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsWireOfFace = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsVertexOfFace = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsCoEdgeOfWire = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsChildOfSolid = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsSolidOfCompSolid = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsChildOfCompound = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsOccurrenceOfProduct = + BRepGraph_RefsIterator::RefsOfParent; +using BRepGraph_RefsVertexOfEdge = BRepGraph_RefsIterator::RefsVertexOfEdge; + +using BRepGraph_ShellRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FaceRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_WireRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_CoEdgeRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_VertexRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_SolidRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_ChildRefIterator = BRepGraph_RefsIterator::RefIterator; +using BRepGraph_OccurrenceRefIterator = + BRepGraph_RefsIterator::RefIterator; + +using BRepGraph_FullShellRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullFaceRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullWireRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullCoEdgeRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullVertexRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullSolidRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullChildRefIterator = + BRepGraph_RefsIterator::RefIterator; +using BRepGraph_FullOccurrenceRefIterator = + BRepGraph_RefsIterator::RefIterator; + +#endif // _BRepGraph_RefsIterator_HeaderFile \ No newline at end of file diff --git a/opencascade/BRepGraph_RefsView.hxx b/opencascade/BRepGraph_RefsView.hxx new file mode 100644 index 000000000..dc9d323e3 --- /dev/null +++ b/opencascade/BRepGraph_RefsView.hxx @@ -0,0 +1,363 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RefsView_HeaderFile +#define _BRepGraph_RefsView_HeaderFile + +#include +#include +#include + +//! @brief Read-only view for RefId/RefUID-based reference storage. +//! +//! This view exposes reference-entry storage: +//! - typed reference entry access (Shell, Face, ...) +//! - reference counts +//! - RefUID lookup and reverse lookup through BRepGraph::UIDs() +//! - stale tracking via BRepGraph_VersionStamp through BRepGraph::UIDs() +//! +//! Identity semantics: +//! - RefId (kind + index) is graph-local and may change after Compact(). +//! Use it for in-graph traversal and short-lived mutation logic. +//! - RefUID (kind + counter + generation) is stable across index remapping +//! and intended for longer-lived identity tracking. +//! +//! ## RefsView vs TopoView naming +//! RefsView accessors take reference IDs (BRepGraph_ShellRefId, BRepGraph_FaceRefId) +//! and return reference-entry structs carrying per-use orientation and location. +//! TopoView accessors take definition IDs (BRepGraph_ShellId, BRepGraph_FaceId) +//! and return definition structs. +//! +//! ## Iterating over references +//! Reference entries are primarily traversed in parent-owned context through +//! the typed grouped IdsOf accessors. When flat iteration is needed, iterate +//! using the matching typed RefId over the appropriate grouped Nb() or NbActive() count: +//! @code +//! const BRepGraph::RefsView& aRefs = aGraph.Refs(); +//! const BRepGraph_FaceRefId anEndFaceRefId = aRefs.Faces().EndId(); +//! for (BRepGraph_FaceRefId aFaceRefId = aRefs.Faces().StartId(); +//! aFaceRefId < anEndFaceRefId; +//! ++aFaceRefId) +//! { +//! const BRepGraphInc::FaceRef& aFR = aRefs.Faces().Entry(aFaceRefId); +//! if (aFR.IsRemoved) +//! continue; +//! // use aFR.FaceDefId, aFR.Orientation, aFR.Location ... +//! } +//! @endcode +//! +//! To iterate refs belonging to a specific parent, use the grouped IdsOf +//! accessors: +//! @code +//! for (const BRepGraph_WireRefId& aWireRefId : aRefs.Wires().IdsOf(aFaceId)) +//! { +//! const BRepGraphInc::WireRef& aWR = aRefs.Wires().Entry(aWireRefId); +//! // ... +//! } +//! @endcode +class BRepGraph::RefsView +{ +public: + //! @brief Shell reference queries. + class ShellOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_ShellRefId StartId() const { return BRepGraph_ShellRefId::Start(); } + + [[nodiscard]] BRepGraph_ShellRefId EndId() const { return BRepGraph_ShellRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::ShellRef& Entry( + const BRepGraph_ShellRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_SolidId theSolid) const; + + private: + friend class RefsView; + + explicit ShellOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Face reference queries. + class FaceOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_FaceRefId StartId() const { return BRepGraph_FaceRefId::Start(); } + + [[nodiscard]] BRepGraph_FaceRefId EndId() const { return BRepGraph_FaceRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::FaceRef& Entry( + const BRepGraph_FaceRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_ShellId theShell) const; + + private: + friend class RefsView; + + explicit FaceOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Wire reference queries. + class WireOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_WireRefId StartId() const { return BRepGraph_WireRefId::Start(); } + + [[nodiscard]] BRepGraph_WireRefId EndId() const { return BRepGraph_WireRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::WireRef& Entry( + const BRepGraph_WireRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_FaceId theFace) const; + + private: + friend class RefsView; + + explicit WireOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Coedge reference queries. + class CoEdgeOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_CoEdgeRefId StartId() const { return BRepGraph_CoEdgeRefId::Start(); } + + [[nodiscard]] BRepGraph_CoEdgeRefId EndId() const { return BRepGraph_CoEdgeRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CoEdgeRef& Entry( + const BRepGraph_CoEdgeRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_WireId theWire) const; + + private: + friend class RefsView; + + explicit CoEdgeOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Vertex reference queries. + class VertexOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_VertexRefId StartId() const { return BRepGraph_VertexRefId::Start(); } + + [[nodiscard]] BRepGraph_VertexRefId EndId() const { return BRepGraph_VertexRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::VertexRef& Entry( + const BRepGraph_VertexRefId theRefId) const; + + private: + friend class RefsView; + + explicit VertexOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Solid reference queries. + class SolidOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_SolidRefId StartId() const { return BRepGraph_SolidRefId::Start(); } + + [[nodiscard]] BRepGraph_SolidRefId EndId() const { return BRepGraph_SolidRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::SolidRef& Entry( + const BRepGraph_SolidRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_CompSolidId theCompSolid) const; + + private: + friend class RefsView; + + explicit SolidOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Generic child reference queries. + class ChildOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_ChildRefId StartId() const { return BRepGraph_ChildRefId::Start(); } + + [[nodiscard]] BRepGraph_ChildRefId EndId() const { return BRepGraph_ChildRefId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::ChildRef& Entry( + const BRepGraph_ChildRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_CompoundId theCompound) const; + + private: + friend class RefsView; + + explicit ChildOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Occurrence reference queries. + class OccurrenceOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_OccurrenceRefId StartId() const + { + return BRepGraph_OccurrenceRefId::Start(); + } + + [[nodiscard]] BRepGraph_OccurrenceRefId EndId() const + { + return BRepGraph_OccurrenceRefId(Nb()); + } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::OccurrenceRef& Entry( + const BRepGraph_OccurrenceRefId theRefId) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& IdsOf( + const BRepGraph_ProductId theProduct) const; + + private: + friend class RefsView; + + explicit OccurrenceOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! Grouped shell reference queries. + [[nodiscard]] const ShellOps& Shells() const { return myShells; } + + //! Grouped face reference queries. + [[nodiscard]] const FaceOps& Faces() const { return myFaces; } + + //! Grouped wire reference queries. + [[nodiscard]] const WireOps& Wires() const { return myWires; } + + //! Grouped coedge reference queries. + [[nodiscard]] const CoEdgeOps& CoEdges() const { return myCoEdges; } + + //! Grouped vertex reference queries. + [[nodiscard]] const VertexOps& Vertices() const { return myVertices; } + + //! Grouped solid reference queries. + [[nodiscard]] const SolidOps& Solids() const { return mySolids; } + + //! Grouped child reference queries. + [[nodiscard]] const ChildOps& Children() const { return myChildren; } + + //! Grouped occurrence reference queries. + [[nodiscard]] const OccurrenceOps& Occurrences() const { return myOccurrences; } + + //! Return the direct parent-owned RefId stored at the specified child step. + //! This is a structural lookup over the parent's raw ref arrays and does not + //! skip removed refs or refs targeting removed child defs. + [[nodiscard]] Standard_EXPORT BRepGraph_RefId RefAtStep(const BRepGraph_NodeId theParent, + const int theStep) const; + + //! Resolve the child definition node referenced by any typed RefId. + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId ChildNode(const BRepGraph_RefId theRef) const; + + //! Return true if the specified typed RefId is marked removed. + [[nodiscard]] Standard_EXPORT bool IsRemoved(const BRepGraph_RefId theRef) const; + + //! Return the local location carried by the specified typed RefId. + //! OccurrenceRef and invalid refs return identity. + [[nodiscard]] Standard_EXPORT TopLoc_Location LocalLocation(const BRepGraph_RefId theRef) const; + + //! Return the orientation carried by the specified typed RefId. + //! CoEdgeRef, OccurrenceRef, and invalid refs return TopAbs_FORWARD. + [[nodiscard]] Standard_EXPORT TopAbs_Orientation Orientation(const BRepGraph_RefId theRef) const; + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit RefsView(const BRepGraph* theGraph) + : myGraph(theGraph), + myShells(theGraph), + myFaces(theGraph), + myWires(theGraph), + myCoEdges(theGraph), + myVertices(theGraph), + mySolids(theGraph), + myChildren(theGraph), + myOccurrences(theGraph) + { + } + + const BRepGraph* myGraph; + ShellOps myShells; + FaceOps myFaces; + WireOps myWires; + CoEdgeOps myCoEdges; + VertexOps myVertices; + SolidOps mySolids; + ChildOps myChildren; + OccurrenceOps myOccurrences; +}; + +#endif // _BRepGraph_RefsView_HeaderFile diff --git a/opencascade/BRepGraph_RelatedIterator.hxx b/opencascade/BRepGraph_RelatedIterator.hxx new file mode 100644 index 000000000..d3528fde2 --- /dev/null +++ b/opencascade/BRepGraph_RelatedIterator.hxx @@ -0,0 +1,381 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RelatedIterator_HeaderFile +#define _BRepGraph_RelatedIterator_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +//! @brief Single-level iterator over semantically related topology nodes. +//! @see BRepGraph class comment "Iterator guide" for choosing between iterator types. +//! +//! The iterator yields immediate related nodes for one source node together +//! with the relation kind explaining why each node is returned. Results are not +//! deduplicated; callers that need uniqueness should filter on top. +class BRepGraph_RelatedIterator +{ +public: + //! Topological relation kinds yielded by the iterator. + //! Only geometry-level relations are supported (Face, Edge, Vertex, Wire, CoEdge). + //! Assembly/container nodes (Solid, Shell, Compound, Product, Occurrence) have + //! no topological relations - use BRepGraph_ChildExplorer / BRepGraph_ParentExplorer instead. + enum class RelationKind + { + BoundaryEdge, //!< Face -> Edge bounding the face + AdjacentFace, //!< Face -> Face sharing an edge + OuterWire, //!< Face -> Wire (outer boundary) + ReferencedByFace, //!< Edge -> Face that uses this edge + IncidentVertex, //!< Edge -> Vertex (start/end) + WireCoEdge, //!< Wire -> CoEdge (member) + OwningFace, //!< Wire/CoEdge -> Face (container) + IncidentEdge, //!< Vertex -> Edge (touching) + ParentEdge, //!< CoEdge -> Edge (underlying definition) + SeamPair, //!< CoEdge -> CoEdge (seam twin) + }; + + enum class Stage + { + First, + Second, + Third, + Finished, + }; + + BRepGraph_RelatedIterator(const BRepGraph& theGraph, const BRepGraph_NodeId theNode) + : myGraph(&theGraph), + myNode(theNode) + { + advance(); + } + + [[nodiscard]] bool More() const { return myHasCurrent; } + + void Next() + { + if (!myHasCurrent) + { + return; + } + advance(); + } + + [[nodiscard]] const BRepGraph_NodeId& Current() const { return myCurrent; } + + [[nodiscard]] RelationKind CurrentRelation() const { return myRelation; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + [[nodiscard]] bool setCurrent(const BRepGraph_NodeId theNode, const RelationKind theRelation) + { + if (!theNode.IsValid() || myGraph->Topo().Gen().IsRemoved(theNode)) + { + return false; + } + + myCurrent = theNode; + myRelation = theRelation; + myHasCurrent = true; + return true; + } + + template + [[nodiscard]] bool advanceRefChildren(IteratorT theIterator, const RelationKind theRelation) + { + for (; theIterator.More(); theIterator.Next()) + { + if (theIterator.Index() < myIndex) + { + continue; + } + + myIndex = theIterator.Index() + 1; + const BRepGraph_NodeId aChildNode = myGraph->Refs().ChildNode(theIterator.CurrentId()); + return setCurrent(aChildNode, theRelation); + } + + return false; + } + + template + [[nodiscard]] bool advanceDefChildren(IteratorT theIterator, const RelationKind theRelation) + { + for (; theIterator.More(); theIterator.Next()) + { + if (theIterator.Index() < myIndex) + { + continue; + } + + myIndex = theIterator.Index() + 1; + return setCurrent(BRepGraph_NodeId(theIterator.CurrentId()), theRelation); + } + + return false; + } + + [[nodiscard]] bool advanceFaceBoundaryEdge() + { + const BRepGraph_FaceId aFaceId = BRepGraph_FaceId::FromNodeId(myNode); + for (BRepGraph_DefsWireOfFace aWireIt(*myGraph, aFaceId); aWireIt.More(); aWireIt.Next()) + { + if (aWireIt.Index() < myIndex) + { + continue; + } + + for (BRepGraph_DefsEdgeOfWire anEdgeIt(*myGraph, aWireIt.CurrentId()); anEdgeIt.More(); + anEdgeIt.Next()) + { + if (aWireIt.Index() == myIndex && anEdgeIt.Index() < myInnerIndex) + { + continue; + } + + myIndex = aWireIt.Index(); + myInnerIndex = anEdgeIt.Index() + 1; + return setCurrent(BRepGraph_NodeId(anEdgeIt.CurrentId()), RelationKind::BoundaryEdge); + } + + myIndex = aWireIt.Index() + 1; + myInnerIndex = 0; + } + + return false; + } + + [[nodiscard]] bool advanceAdjacentFace() + { + const BRepGraph_FaceId aFaceId = BRepGraph_FaceId::FromNodeId(myNode); + for (BRepGraph_DefsWireOfFace aWireIt(*myGraph, aFaceId); aWireIt.More(); aWireIt.Next()) + { + if (aWireIt.Index() < myIndex) + { + continue; + } + + for (BRepGraph_DefsCoEdgeOfWire aCoEdgeIt(*myGraph, aWireIt.CurrentId()); aCoEdgeIt.More(); + aCoEdgeIt.Next()) + { + if (aWireIt.Index() == myIndex && aCoEdgeIt.Index() < myInnerIndex) + { + continue; + } + + const NCollection_DynamicArray& aFaces = + myGraph->Topo().Edges().Faces(aCoEdgeIt.Current().EdgeDefId); + for (; myDeepIndex < static_cast(aFaces.Size()); ++myDeepIndex) + { + const BRepGraph_FaceId anAdjacentFaceId = aFaces.Value(static_cast(myDeepIndex)); + if (anAdjacentFaceId == aFaceId) + { + continue; + } + + myIndex = aWireIt.Index(); + myInnerIndex = aCoEdgeIt.Index(); + ++myDeepIndex; + return setCurrent(BRepGraph_NodeId(anAdjacentFaceId), RelationKind::AdjacentFace); + } + + myDeepIndex = 0; + } + + myIndex = aWireIt.Index() + 1; + myInnerIndex = 0; + } + + return false; + } + + [[nodiscard]] bool advanceEdgeVertex() + { + return advanceDefChildren( + BRepGraph_DefsVertexOfEdge(*myGraph, BRepGraph_EdgeId::FromNodeId(myNode)), + RelationKind::IncidentVertex); + } + + //! Advance through a reverse-index iterator (e.g. BRepGraph_FacesOfEdge). + //! Constructs a ParentsOf starting at myIndex for O(1) amortized resumption. + template + [[nodiscard]] bool advanceParents(const NCollection_DynamicArray& theParents, + const RelationKind theRelation) + { + BRepGraph_ReverseIterator::ParentsOf anIt(*myGraph, theParents, myIndex); + if (anIt.More()) + { + myIndex = anIt.Index() + 1; + return setCurrent(BRepGraph_NodeId(anIt.CurrentId()), theRelation); + } + + return false; + } + + void advance() + { + myHasCurrent = false; + if (!myNode.IsValid() || myGraph->Topo().Gen().IsRemoved(myNode)) + { + return; + } + + for (;;) + { + switch (myNode.NodeKind) + { + // Container/assembly nodes have no topological relations. + // Use BRepGraph_ChildExplorer / BRepGraph_ParentExplorer for navigation. + case BRepGraph_NodeId::Kind::Solid: + case BRepGraph_NodeId::Kind::Shell: + case BRepGraph_NodeId::Kind::Compound: + case BRepGraph_NodeId::Kind::CompSolid: + case BRepGraph_NodeId::Kind::Product: + case BRepGraph_NodeId::Kind::Occurrence: + return; + case BRepGraph_NodeId::Kind::Face: { + if (myStage == Stage::First) + { + if (advanceFaceBoundaryEdge()) + { + return; + } + myStage = Stage::Second; + myIndex = 0; + myInnerIndex = 0; + myDeepIndex = 0; + } + if (myStage == Stage::Second) + { + if (advanceAdjacentFace()) + { + return; + } + myStage = Stage::Third; + myIndex = 0; + } + if (myStage == Stage::Third) + { + myStage = Stage::Finished; + return (void)setCurrent(BRepGraph_NodeId(myGraph->Topo().Faces().OuterWire( + BRepGraph_FaceId::FromNodeId(myNode))), + RelationKind::OuterWire); + } + return; + } + case BRepGraph_NodeId::Kind::Edge: { + if (myStage == Stage::First) + { + if (advanceParents(myGraph->Topo().Edges().Faces(BRepGraph_EdgeId::FromNodeId(myNode)), + RelationKind::ReferencedByFace)) + { + return; + } + myStage = Stage::Second; + myIndex = 0; + } + if (advanceEdgeVertex()) + { + return; + } + return; + } + case BRepGraph_NodeId::Kind::Wire: { + if (myStage == Stage::First) + { + if (advanceRefChildren( + BRepGraph_RefsCoEdgeOfWire(*myGraph, BRepGraph_WireId::FromNodeId(myNode)), + RelationKind::WireCoEdge)) + { + return; + } + myStage = Stage::Second; + myIndex = 0; + } + if (advanceParents(myGraph->Topo().Wires().Faces(BRepGraph_WireId::FromNodeId(myNode)), + RelationKind::OwningFace)) + { + return; + } + return; + } + case BRepGraph_NodeId::Kind::Vertex: { + if (advanceParents( + myGraph->Topo().Vertices().Edges(BRepGraph_VertexId::FromNodeId(myNode)), + RelationKind::IncidentEdge)) + { + return; + } + return; + } + case BRepGraph_NodeId::Kind::CoEdge: { + const BRepGraph_CoEdgeId aCoEdgeId = BRepGraph_CoEdgeId::FromNodeId(myNode); + if (myStage == Stage::First) + { + myStage = Stage::Second; + if (setCurrent(BRepGraph_NodeId(BRepGraph_Tool::CoEdge::EdgeOf(*myGraph, aCoEdgeId)), + RelationKind::ParentEdge)) + { + return; + } + } + if (myStage == Stage::Second) + { + myStage = Stage::Third; + if (setCurrent(BRepGraph_NodeId(BRepGraph_Tool::CoEdge::FaceOf(*myGraph, aCoEdgeId)), + RelationKind::OwningFace)) + { + return; + } + } + if (myStage == Stage::Third) + { + myStage = Stage::Finished; + if (setCurrent(BRepGraph_NodeId(BRepGraph_Tool::CoEdge::SeamPair(*myGraph, aCoEdgeId)), + RelationKind::SeamPair)) + { + return; + } + } + return; + } + } + } + } + +private: + const BRepGraph* myGraph; + BRepGraph_NodeId myNode; + BRepGraph_NodeId myCurrent; + RelationKind myRelation = RelationKind::BoundaryEdge; + Stage myStage = Stage::First; + uint32_t myIndex = 0; + uint32_t myInnerIndex = 0; + uint32_t myDeepIndex = 0; + bool myHasCurrent = false; +}; + +#endif // _BRepGraph_RelatedIterator_HeaderFile \ No newline at end of file diff --git a/opencascade/BRepGraph_RepId.hxx b/opencascade/BRepGraph_RepId.hxx new file mode 100644 index 000000000..6a3570a61 --- /dev/null +++ b/opencascade/BRepGraph_RepId.hxx @@ -0,0 +1,369 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_RepId_HeaderFile +#define _BRepGraph_RepId_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include + +//! Lightweight typed index into a per-kind representation vector inside BRepGraph. +//! +//! The pair (Kind, Index) forms a unique representation identifier within one +//! graph instance. Default-constructed RepId has Index = UINT32_MAX (invalid). +//! +//! Representations are NOT topology nodes - they hold geometry or mesh data +//! referenced by topology entities. They do not participate in BFS traversal, +//! reverse index, or parent-child relationships. +//! +//! RepId is a value type: cheap to copy, compare, hash. +struct BRepGraph_RepId +{ + //! Categories of representation data. + enum class Kind : int + { + // Geometry (exact mathematical definition) + Surface = 0, //!< Geom_Surface for faces + Curve3D = 1, //!< Geom_Curve for edges + Curve2D = 2, //!< Geom2d_Curve for coedges (PCurve geometry) + + // Mesh (discrete approximation) + Triangulation = 3, //!< Poly_Triangulation for faces + Polygon3D = 4, //!< Poly_Polygon3D for edges + Polygon2D = 5, //!< Poly_Polygon2D for coedges (polygon-on-surface) + PolygonOnTri = 6, //!< Poly_PolygonOnTriangulation for coedges + + // Reserved 7-19 for future built-in types + // Custom plugin types start at 100+ + }; + + //! True if the kind is a geometry kind (Surface, Curve3D, Curve2D). + static bool IsGeometryKind(const Kind theKind) + { + return theKind == Kind::Surface || theKind == Kind::Curve3D || theKind == Kind::Curve2D; + } + + //! True if the kind is a mesh kind (Triangulation, Polygon3D, Polygon2D, PolygonOnTri). + static bool IsMeshKind(const Kind theKind) + { + return theKind == Kind::Triangulation || theKind == Kind::Polygon3D + || theKind == Kind::Polygon2D || theKind == Kind::PolygonOnTri; + } + + //! @brief Compile-time typed wrapper around BRepGraph_RepId. + //! + //! Provides compile-time kind safety: a Typed + //! cannot be accidentally used where a Typed is expected. + //! Implicitly converts to BRepGraph_RepId for backward compatibility. + //! + //! @tparam TheKind the BRepGraph_RepId::Kind this typed id represents + template + struct Typed + { + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + uint32_t Index; + + //! Default: invalid (Index = UINT32_MAX). + Typed() + : Index(THE_INVALID_INDEX) + { + } + + //! Construct from index. + explicit Typed(const uint32_t theIdx) + : Index(theIdx) + { + } + + //! Construct from an untyped representation id of the same kind. + explicit Typed(const BRepGraph_RepId theId) + : Typed(FromRepId(theId)) + { + } + + template = 0> + Typed(const Typed&) = delete; + + //! First valid id in a dense per-kind sequence. + [[nodiscard]] static Typed Start() { return Typed(THE_START_INDEX); } + + //! Invalid sentinel id. + [[nodiscard]] static Typed Invalid() { return Typed(); } + + //! True if this id points to an allocated representation slot. + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + //! True if this id is within the dense range exposed by a provider with Nb(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + //! True if this id is within the dense range exposed by a provider with Length(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + //! Implicit conversion to untyped RepId. + operator BRepGraph_RepId() const { return BRepGraph_RepId(TheKind, Index); } + + //! Explicit conversion from untyped RepId. + //! Asserts that the Kind matches in debug builds. + //! @param[in] theId untyped RepId to convert + static Typed FromRepId(const BRepGraph_RepId theId) + { + Standard_ASSERT_VOID(theId.RepKind == TheKind, "RepId kind mismatch"); + return Typed(theId.Index); + } + + bool operator==(const Typed& theOther) const { return Index == theOther.Index; } + + bool operator!=(const Typed& theOther) const { return Index != theOther.Index; } + + bool operator<(const Typed& theOther) const { return Index < theOther.Index; } + + bool operator<=(const Typed& theOther) const { return Index <= theOther.Index; } + + bool operator>(const Typed& theOther) const { return Index > theOther.Index; } + + bool operator>=(const Typed& theOther) const { return Index >= theOther.Index; } + + //! Pre-increment (++id). + Typed& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + Typed operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + Typed aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] Typed operator+(const uint32_t theOffset) const + { + return Typed(Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] Typed operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return Typed(Index - theOffset); + } + + //! Comparison with untyped RepId (checks both Kind and Index). + bool operator==(const BRepGraph_RepId& theOther) const + { + return theOther.RepKind == TheKind && theOther.Index == Index; + } + + bool operator!=(const BRepGraph_RepId& theOther) const { return !(*this == theOther); } + + //! Allow reversed comparison: RepId == Typed. + friend bool operator==(const BRepGraph_RepId& theLhs, const Typed& theRhs) + { + return theRhs == theLhs; + } + + friend bool operator!=(const BRepGraph_RepId& theLhs, const Typed& theRhs) + { + return theRhs != theLhs; + } + }; + + static constexpr uint32_t THE_START_INDEX = 0u; + static constexpr uint32_t THE_INVALID_INDEX = std::numeric_limits::max(); + + Kind RepKind; + uint32_t Index; + + //! Default: invalid RepId (Index = UINT32_MAX). + //! RepKind is set to Kind::Surface but is meaningless when !IsValid(). + BRepGraph_RepId() + : RepKind(Kind::Surface), + Index(THE_INVALID_INDEX) + { + } + + BRepGraph_RepId(const Kind theKind, const uint32_t theIdx) + : RepKind(theKind), + Index(theIdx) + { + } + + //! First valid id in a dense sequence for the specified kind. + [[nodiscard]] static BRepGraph_RepId Start(const Kind theKind) + { + return BRepGraph_RepId(theKind, THE_START_INDEX); + } + + //! Invalid sentinel id for the specified kind. + [[nodiscard]] static BRepGraph_RepId Invalid(const Kind theKind = Kind::Surface) + { + return BRepGraph_RepId(theKind, THE_INVALID_INDEX); + } + + //! True if this id points to an allocated representation slot. + [[nodiscard]] bool IsValid() const { return Index != THE_INVALID_INDEX; } + + //! True if this id points to an allocated slot within [0, theMaxCount). + //! UINT32_MAX (invalid sentinel) always fails this check for any realistic count. + [[nodiscard]] bool IsValid(const uint32_t theMaxCount) const { return Index < theMaxCount; } + + //! True if this id is within the dense range exposed by a provider with Nb(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Nb(), bool()) + { + return IsValid(theProvider.Nb()); + } + + //! True if this id is within the dense range exposed by a provider with Size(). + template + [[nodiscard]] auto IsValidIn(const CountProviderT& theProvider) const + -> decltype(theProvider.Size(), bool()) + { + return IsValid(static_cast(theProvider.Size())); + } + + bool operator==(const BRepGraph_RepId& theOther) const + { + return RepKind == theOther.RepKind && Index == theOther.Index; + } + + bool operator!=(const BRepGraph_RepId& theOther) const { return !(*this == theOther); } + + bool operator<(const BRepGraph_RepId& theOther) const + { + if (RepKind != theOther.RepKind) + return static_cast(RepKind) < static_cast(theOther.RepKind); + return Index < theOther.Index; + } + + //! Pre-increment (++id). + BRepGraph_RepId& operator++() + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "pre-increment on invalid id"); + ++Index; + return *this; + } + + //! Post-increment (id++). + BRepGraph_RepId operator++(int) + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX, "post-increment on invalid id"); + BRepGraph_RepId aPrev = *this; + ++Index; + return aPrev; + } + + //! Advance by offset. + [[nodiscard]] BRepGraph_RepId operator+(const uint32_t theOffset) const + { + return BRepGraph_RepId(RepKind, Index + theOffset); + } + + //! Retreat by offset. + [[nodiscard]] BRepGraph_RepId operator-(const uint32_t theOffset) const + { + Standard_ASSERT_VOID(Index != THE_INVALID_INDEX && Index >= theOffset, + "retreat underflows index"); + return BRepGraph_RepId(RepKind, Index - theOffset); + } + + //! Dispatch a generic rep id to a callable taking the matching typed rep id. + template + static auto Visit(const BRepGraph_RepId theRepId, FuncT&& theFunc) + -> decltype(std::forward(theFunc)(Typed())) + { + switch (theRepId.RepKind) + { + case Kind::Surface: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::Curve3D: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::Curve2D: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::Triangulation: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::Polygon3D: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::Polygon2D: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + case Kind::PolygonOnTri: + return std::forward(theFunc)(Typed::FromRepId(theRepId)); + } + + Standard_ASSERT_VOID(false, "BRepGraph_RepId::Visit: unhandled Kind"); + return std::forward(theFunc)(Typed()); + } +}; + +// Convenience type aliases for typed RepIds. +using BRepGraph_SurfaceRepId = BRepGraph_RepId::Typed; +using BRepGraph_Curve3DRepId = BRepGraph_RepId::Typed; +using BRepGraph_Curve2DRepId = BRepGraph_RepId::Typed; +using BRepGraph_TriangulationRepId = BRepGraph_RepId::Typed; +using BRepGraph_Polygon3DRepId = BRepGraph_RepId::Typed; +using BRepGraph_Polygon2DRepId = BRepGraph_RepId::Typed; +using BRepGraph_PolygonOnTriRepId = BRepGraph_RepId::Typed; + +//! std::hash specialization for NCollection_DefaultHasher support. +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_RepId& theId) const noexcept + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(static_cast(theId.RepKind)); + aCombination[1] = opencascade::hash(theId.Index); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; + +//! std::hash specialization for BRepGraph_RepId::Typed. +template +struct std::hash> +{ + size_t operator()(const BRepGraph_RepId::Typed& theId) const noexcept + { + return std::hash{}(static_cast(theId)); + } +}; + +#endif // _BRepGraph_RepId_HeaderFile diff --git a/opencascade/BRepGraph_ReverseIterator.hxx b/opencascade/BRepGraph_ReverseIterator.hxx new file mode 100644 index 000000000..6374107bd --- /dev/null +++ b/opencascade/BRepGraph_ReverseIterator.hxx @@ -0,0 +1,585 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_ReverseIterator_HeaderFile +#define _BRepGraph_ReverseIterator_HeaderFile + +#include +#include +#include +#include + +#include + +//! @brief Single-level typed iterators over parent definitions via reverse index. +//! +//! These iterators wrap the NCollection_DynamicArray returned by TopoView +//! reverse-index accessors (e.g. Edges().Faces(), Wires().Faces(), Vertices().Edges()). +//! They provide a typed, skip-removed iteration pattern consistent with the +//! forward iterators in BRepGraph_DefsIterator and BRepGraph_RefsIterator. +//! +//! Usage: +//! @code +//! // Traditional iteration: +//! for (BRepGraph_FacesOfEdge anIt(aGraph, aGraph.Topo().Edges().Faces(anEdgeId)); +//! anIt.More(); anIt.Next()) +//! { +//! const BRepGraph_FaceId aFaceId = anIt.CurrentId(); +//! } +//! +//! // Range-based for: +//! for (const BRepGraph_FaceId aFaceId : +//! BRepGraph_FacesOfEdge(aGraph, aGraph.Topo().Edges().Faces(anEdgeId))) +//! { +//! // ... +//! } +//! @endcode +namespace BRepGraph_ReverseIterator +{ + +//! Compile-time traits mapping typed ID to its definition type and accessor. +template +struct DefTraits; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::SolidDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_SolidId theId) + { + return theGraph.Topo().Solids().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::ShellDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_ShellId theId) + { + return theGraph.Topo().Shells().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::FaceDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_FaceId theId) + { + return theGraph.Topo().Faces().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::WireDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_WireId theId) + { + return theGraph.Topo().Wires().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::EdgeDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_EdgeId theId) + { + return theGraph.Topo().Edges().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::VertexDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_VertexId theId) + { + return theGraph.Topo().Vertices().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::CoEdgeDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_CoEdgeId theId) + { + return theGraph.Topo().CoEdges().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::CompoundDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_CompoundId theId) + { + return theGraph.Topo().Compounds().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::CompSolidDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_CompSolidId theId) + { + return theGraph.Topo().CompSolids().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::ProductDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_ProductId theId) + { + return theGraph.Topo().Products().Definition(theId); + } +}; + +template <> +struct DefTraits +{ + using DefType = BRepGraphInc::OccurrenceDef; + + static const DefType& Get(const BRepGraph& theGraph, const BRepGraph_OccurrenceId theId) + { + return theGraph.Topo().Occurrences().Definition(theId); + } +}; + +//! Typed iterator over a reverse-index vector of parent IDs. +//! Skips removed parent definitions automatically in sequential iteration. +//! Also provides indexed access (Length/Value) for callers that need +//! random access into the underlying vector (e.g. BRepGraph_ParentExplorer). +//! @tparam TypedIdT Typed ID such as BRepGraph_FaceId, BRepGraph_EdgeId, etc. +template +class ParentsOf +{ +public: + ParentsOf(const BRepGraph& theGraph, const NCollection_DynamicArray& theParents) + : myGraph(&theGraph), + myParents(&theParents) + { + skipRemoved(); + } + + //! Construct starting at a given vector index (for resumable iteration). + //! Skips to the first non-removed entry at or after theStartIndex. + ParentsOf(const BRepGraph& theGraph, + const NCollection_DynamicArray& theParents, + const uint32_t theStartIndex) + : myGraph(&theGraph), + myParents(&theParents), + myIndex(theStartIndex) + { + skipRemoved(); + } + + [[nodiscard]] bool More() const { return myIndex < static_cast(myParents->Size()); } + + void Next() + { + ++myIndex; + skipRemoved(); + } + + [[nodiscard]] TypedIdT CurrentId() const + { + return myParents->Value(static_cast(myIndex)); + } + + //! Alias for CurrentId(), enables range-for via NCollection_ForwardRange Current() priority. + [[nodiscard]] TypedIdT Current() const { return CurrentId(); } + + //! Current parent definition (typed lookup via DefTraits). + [[nodiscard]] const typename DefTraits::DefType& Definition() const + { + return DefTraits::Get(*myGraph, CurrentId()); + } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns the total number of parent entries (including removed). + [[nodiscard]] int Length() const { return myParents->Length(); } + + [[nodiscard]] size_t Size() const { return myParents->Size(); } + + //! Returns the parent ID at the given index (does NOT check IsRemoved). + [[nodiscard]] TypedIdT Value(const size_t theIndex) const { return myParents->Value(theIndex); } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + void skipRemoved() + { + while (myIndex < static_cast(myParents->Length())) + { + const BRepGraphInc::BaseDef* aDef = + myGraph->Topo().Gen().TopoEntity(myParents->Value(static_cast(myIndex))); + if (aDef != nullptr && !aDef->IsRemoved) + { + return; + } + ++myIndex; + } + } + + const BRepGraph* myGraph = nullptr; + const NCollection_DynamicArray* myParents = nullptr; + uint32_t myIndex = 0; +}; + +//! Result pair returned by RefsParentsOf: parent definition ID + the RefId +//! in that parent which references the child. +template +struct ParentRef +{ + ParentIdT ParentId; + RefIdT Ref; +}; + +//! Typed iterator over parent definitions via reverse index that also resolves +//! the specific RefId linking each parent to the child. +//! Requires a traits class to find the matching ref within each parent. +//! @tparam TraitsT Traits with: ParentId, ChildId, RefId types, +//! FindRef(graph, parentId, childId) -> RefId (invalid if not found) +template +class RefsParentsOf +{ +public: + using ParentIdType = typename TraitsT::ParentId; + using ChildIdType = typename TraitsT::ChildId; + using RefIdType = typename TraitsT::RefId; + using ResultType = ParentRef; + + RefsParentsOf(const BRepGraph& theGraph, + const NCollection_DynamicArray& theParents, + const ChildIdType theChild) + : myGraph(&theGraph), + myParents(&theParents), + myChild(theChild) + { + advance(); + } + + [[nodiscard]] bool More() const { return myHasCurrent; } + + void Next() + { + ++myIndex; + advance(); + } + + [[nodiscard]] ResultType Current() const { return myCurrent; } + + [[nodiscard]] ParentIdType CurrentParentId() const { return myCurrent.ParentId; } + + [[nodiscard]] RefIdType CurrentRefId() const { return myCurrent.Ref; } + + [[nodiscard]] uint32_t Index() const { return myIndex; } + + //! Returns an STL-compatible iterator for range-based for loops. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + void advance() + { + myHasCurrent = false; + while (myIndex < static_cast(myParents->Size())) + { + const ParentIdType aParentId = myParents->Value(static_cast(myIndex)); + const BRepGraphInc::BaseDef* aDef = + myGraph->Topo().Gen().TopoEntity(BRepGraph_NodeId(aParentId)); + if (aDef != nullptr && !aDef->IsRemoved) + { + const RefIdType aRefId = TraitsT::FindRef(*myGraph, aParentId, myChild); + if (aRefId.IsValid()) + { + myCurrent = ResultType{aParentId, aRefId}; + myHasCurrent = true; + return; + } + } + ++myIndex; + } + } + + const BRepGraph* myGraph = nullptr; + const NCollection_DynamicArray* myParents = nullptr; + ChildIdType myChild; + ResultType myCurrent; + uint32_t myIndex = 0; + bool myHasCurrent = false; +}; + +// Traits for RefsParentsOf - each knows how to find the RefId +// linking a parent to a specific child definition. + +struct FaceOfWireRefTraits +{ + using ParentId = BRepGraph_FaceId; + using ChildId = BRepGraph_WireId; + using RefId = BRepGraph_WireRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_FaceId theParent, + const BRepGraph_WireId theChild) + { + for (BRepGraph_RefsWireOfFace aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct ShellOfFaceRefTraits +{ + using ParentId = BRepGraph_ShellId; + using ChildId = BRepGraph_FaceId; + using RefId = BRepGraph_FaceRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_ShellId theParent, + const BRepGraph_FaceId theChild) + { + for (BRepGraph_RefsFaceOfShell aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct SolidOfShellRefTraits +{ + using ParentId = BRepGraph_SolidId; + using ChildId = BRepGraph_ShellId; + using RefId = BRepGraph_ShellRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_SolidId theParent, + const BRepGraph_ShellId theChild) + { + for (BRepGraph_RefsShellOfSolid aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct WireOfCoEdgeRefTraits +{ + using ParentId = BRepGraph_WireId; + using ChildId = BRepGraph_CoEdgeId; + using RefId = BRepGraph_CoEdgeRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_WireId theParent, + const BRepGraph_CoEdgeId theChild) + { + for (BRepGraph_RefsCoEdgeOfWire aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct EdgeOfVertexRefTraits +{ + using ParentId = BRepGraph_EdgeId; + using ChildId = BRepGraph_VertexId; + using RefId = BRepGraph_VertexRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_EdgeId theParent, + const BRepGraph_VertexId theChild) + { + for (BRepGraph_RefsVertexOfEdge aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct CompSolidOfSolidRefTraits +{ + using ParentId = BRepGraph_CompSolidId; + using ChildId = BRepGraph_SolidId; + using RefId = BRepGraph_SolidRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_CompSolidId theParent, + const BRepGraph_SolidId theChild) + { + for (BRepGraph_RefsSolidOfCompSolid aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct CompoundOfChildRefTraits +{ + using ParentId = BRepGraph_CompoundId; + using ChildId = BRepGraph_NodeId; + using RefId = BRepGraph_ChildRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_CompoundId theParent, + const BRepGraph_NodeId theChild) + { + for (BRepGraph_RefsChildOfCompound aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == theChild) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +struct ProductOfOccurrenceRefTraits +{ + using ParentId = BRepGraph_ProductId; + using ChildId = BRepGraph_OccurrenceId; + using RefId = BRepGraph_OccurrenceRefId; + + static RefId FindRef(const BRepGraph& theGraph, + const BRepGraph_ProductId theParent, + const BRepGraph_OccurrenceId theChild) + { + for (BRepGraph_RefsOccurrenceOfProduct aIt(theGraph, theParent); aIt.More(); aIt.Next()) + { + if (theGraph.Refs().ChildNode(aIt.CurrentId()) == BRepGraph_NodeId(theChild)) + { + return aIt.CurrentId(); + } + } + return RefId(); + } +}; + +} // namespace BRepGraph_ReverseIterator + +// Vertex -> parent Edges +using BRepGraph_EdgesOfVertex = BRepGraph_ReverseIterator::ParentsOf; +// Edge -> parent Wires +using BRepGraph_WiresOfEdge = BRepGraph_ReverseIterator::ParentsOf; +// Edge -> parent CoEdges +using BRepGraph_CoEdgesOfEdge = BRepGraph_ReverseIterator::ParentsOf; +// Edge -> parent Faces (derived from CoEdge.FaceDefId) +using BRepGraph_FacesOfEdge = BRepGraph_ReverseIterator::ParentsOf; +// Wire -> parent Faces +using BRepGraph_FacesOfWire = BRepGraph_ReverseIterator::ParentsOf; +// CoEdge -> parent Wires +using BRepGraph_WiresOfCoEdge = BRepGraph_ReverseIterator::ParentsOf; +// Face -> parent Shells +using BRepGraph_ShellsOfFace = BRepGraph_ReverseIterator::ParentsOf; +// Face -> parent Compounds +using BRepGraph_CompoundsOfFace = BRepGraph_ReverseIterator::ParentsOf; +// Shell -> parent Solids +using BRepGraph_SolidsOfShell = BRepGraph_ReverseIterator::ParentsOf; +// Shell -> parent Compounds +using BRepGraph_CompoundsOfShell = BRepGraph_ReverseIterator::ParentsOf; +// Solid -> parent CompSolids +using BRepGraph_CompSolidsOfSolid = BRepGraph_ReverseIterator::ParentsOf; +// Solid -> parent Compounds +using BRepGraph_CompoundsOfSolid = BRepGraph_ReverseIterator::ParentsOf; +// CompSolid -> parent Compounds +using BRepGraph_CompoundsOfCompSolid = BRepGraph_ReverseIterator::ParentsOf; +// Compound -> parent Compounds +using BRepGraph_CompoundsOfCompound = BRepGraph_ReverseIterator::ParentsOf; +// Product -> Occurrences +using BRepGraph_OccurrencesOfProduct = BRepGraph_ReverseIterator::ParentsOf; + +// Ref-based reverse iterators: yield (ParentId, RefId) pairs. +// These find the specific reference entry in each parent that links to the child. + +// Wire -> parent Faces (with WireRefId) +using BRepGraph_RefsFacesOfWire = + BRepGraph_ReverseIterator::RefsParentsOf; +// Face -> parent Shells (with FaceRefId) +using BRepGraph_RefsShellsOfFace = + BRepGraph_ReverseIterator::RefsParentsOf; +// Shell -> parent Solids (with ShellRefId) +using BRepGraph_RefsSolidsOfShell = + BRepGraph_ReverseIterator::RefsParentsOf; +// CoEdge -> parent Wires (with CoEdgeRefId) +using BRepGraph_RefsWiresOfCoEdge = + BRepGraph_ReverseIterator::RefsParentsOf; +// Vertex -> parent Edges (with VertexRefId) +using BRepGraph_RefsEdgesOfVertex = + BRepGraph_ReverseIterator::RefsParentsOf; +// Solid -> parent CompSolids (with SolidRefId) +using BRepGraph_RefsCompSolidsOfSolid = + BRepGraph_ReverseIterator::RefsParentsOf; +// Any child -> parent Compounds (with ChildRefId) +using BRepGraph_RefsCompoundsOfChild = + BRepGraph_ReverseIterator::RefsParentsOf; +// Occurrence -> parent Products (with OccurrenceRefId) +using BRepGraph_RefsProductsOfOccurrence = + BRepGraph_ReverseIterator::RefsParentsOf; + +#endif // _BRepGraph_ReverseIterator_HeaderFile diff --git a/opencascade/BRepGraph_ShapesView.hxx b/opencascade/BRepGraph_ShapesView.hxx new file mode 100644 index 000000000..d3af85d96 --- /dev/null +++ b/opencascade/BRepGraph_ShapesView.hxx @@ -0,0 +1,108 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_ShapesView_HeaderFile +#define _BRepGraph_ShapesView_HeaderFile + +#include + +//! @brief Read-only view for TopoDS_Shape reconstruction from graph data. +//! +//! Reconstructs TopoDS shapes from graph nodes on demand, with caching +//! for repeated access. Topology nodes are delegated to the incidence-table +//! reconstruction backend, while Product / Occurrence nodes are assembled at +//! the facade level using product-local roots and occurrence placement chains. +//! Provides lookup from original construction-time shapes back to their graph +//! NodeIds via TShape pointer comparison. Shape() is the stable cached public +//! route for repeated access; Reconstruct() forces a fresh rebuild with the +//! same node-kind semantics and bypasses the persistent reconstructed-shape cache. +//! BRepGraph_Builder::Add() and Compact() clear the persistent reconstructed-shape cache. +//! Obtained via BRepGraph::Shapes(). +class BRepGraph::ShapesView +{ +public: + //! Return or reconstruct a TopoDS_Shape for a node. + //! Prefer this route for repeated public queries. + //! Returns a cached shape when available and valid; otherwise reconstructs. + //! Topology definition nodes (Vertex..CompSolid) reconstruct their topology + //! directly, without assembly wrappers. + //! Product nodes are reconstructed in product-local coordinates. + //! Occurrence nodes are reconstructed with cumulative occurrence placement. + //! @param[in] theNode node identifier + //! @return corresponding TopoDS_Shape, or null shape for invalid/removed nodes + [[nodiscard]] Standard_EXPORT TopoDS_Shape Shape(const BRepGraph_NodeId theNode) const; + + //! Check if the node has an original shape from graph construction. + //! Editor-created and mutation-derived nodes have no original. + //! @param[in] theNode node identifier + //! @return true if an original shape exists + [[nodiscard]] Standard_EXPORT bool HasOriginal(const BRepGraph_NodeId theNode) const; + + //! Return a pointer to the original TopoDS_Shape stored during graph construction. + //! This is the non-throw lookup counterpart of OriginalOf(). + //! @param[in] theNode node identifier + //! @return pointer to original shape for an active node, or nullptr when absent/invalid/removed + [[nodiscard]] Standard_EXPORT const TopoDS_Shape* FindOriginal( + const BRepGraph_NodeId theNode) const; + + //! Return the original TopoDS_Shape stored during graph construction. + //! @param[in] theNode node identifier + //! @return reference to the exact TopoDS_Shape stored during graph construction + //! @exception Standard_ProgramError if no original shape exists + [[nodiscard]] Standard_EXPORT const TopoDS_Shape& OriginalOf( + const BRepGraph_NodeId theNode) const; + + //! Reconstruct a TopoDS_Shape from a graph node without using the persistent cache. + //! Use this when the caller explicitly needs a fresh rebuild instead of the + //! shared cached shape returned by Shape(). This method does not populate the + //! persistent reconstructed-shape cache. + //! Topology definition nodes reconstruct topology directly. + //! Product nodes are reconstructed in product-local coordinates. + //! Occurrence nodes are reconstructed with cumulative occurrence placement. + //! @param[in] theRoot definition node identifier + //! @return reconstructed shape, or null shape for invalid/removed nodes + [[nodiscard]] Standard_EXPORT TopoDS_Shape Reconstruct(const BRepGraph_NodeId theRoot) const; + + //! Look up the definition NodeId for a shape from graph construction input. + //! Uses TShape pointer comparison (same semantics as IsSame()). + //! Synthetic Product / Occurrence reconstructions are not given dedicated + //! TShape bindings, so lookup is only guaranteed for construction-time topology. + //! Programmatically created Builder().Add*() nodes can still be located by + //! UID or by direct iteration over Topo() definitions. + //! @param[in] theShape shape to look up + //! @return active node identifier, or invalid NodeId if the shape is absent or removed + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId FindNode(const TopoDS_Shape& theShape) const; + + //! Check if a shape is known to the graph (was part of construction input). + //! Uses TShape pointer comparison (same semantics as IsSame()). + //! Synthetic Product / Occurrence reconstructions are not given dedicated + //! TShape bindings, so this is only guaranteed for construction-time topology. + //! Programmatically created Builder().Add*() nodes can still be located by + //! UID or by direct iteration over Topo() definitions. + //! @param[in] theShape shape to check + //! @return true if the shape has a corresponding active definition node + [[nodiscard]] Standard_EXPORT bool HasNode(const TopoDS_Shape& theShape) const; + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit ShapesView(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; +}; + +#endif // _BRepGraph_ShapesView_HeaderFile diff --git a/opencascade/BRepGraph_Tool.hxx b/opencascade/BRepGraph_Tool.hxx new file mode 100644 index 000000000..b9ff61f81 --- /dev/null +++ b/opencascade/BRepGraph_Tool.hxx @@ -0,0 +1,730 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Tool_HeaderFile +#define _BRepGraph_Tool_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class Adaptor3d_CurveOnSurface; + +//! Centralized geometry access for BRepGraph - analogue of BRep_Tool. +//! +//! Geometry in BRepGraph is stored in the definition frame (representation +//! Location baked via applyRepresentationLocation). Instance Locations live +//! on topology Instance/Ref structs (VertexInstance, CoEdgeInstance, WireInstance, +//! FaceInstance, ShellInstance, SolidInstance, OccurrenceInstance). This class applies +//! ref Locations automatically when accessing 3D geometry. +//! Instance structs are lightweight read-only projections produced during +//! traversal, while Ref structs are stored reference entries from RefsView; +//! this API accepts whichever form naturally carries the required context for +//! the queried property. +//! +//! Methods are grouped by topology kind via nested classes: +//! BRepGraph_Tool::Vertex, Edge, CoEdge, Face, Wire. +class BRepGraph_Tool +{ +public: + using VertexUsage = BRepGraphInc::VertexInstance; + using CoEdgeUsage = BRepGraphInc::CoEdgeInstance; + using VertexRef = BRepGraphInc::VertexRef; + using WireRef = BRepGraphInc::WireRef; + using CoEdgeDef = BRepGraphInc::CoEdgeDef; + + //! @brief Vertex geometry accessors. + //! + //! Provides 3D point retrieval (with or without Location applied), + //! tolerance access, and parameter lookup for vertex-on-curve and + //! vertex-on-surface representations. + class Vertex + { + public: + //! Returns the vertex 3D point with VertexUsage Location applied. + //! @param[in] theGraph source graph + //! @param[in] theRef vertex incidence reference carrying Location + //! @return transformed 3D point + [[nodiscard]] Standard_EXPORT static gp_Pnt Pnt(const BRepGraph& theGraph, + const VertexUsage& theRef); + + //! Returns the vertex 3D point in definition frame (no Location applied). + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @return 3D point in definition frame + [[nodiscard]] Standard_EXPORT static gp_Pnt Pnt(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex); + + //! Returns the vertex tolerance. + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @return tolerance value + [[nodiscard]] Standard_EXPORT static double Tolerance(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex); + + //! Returns the vertex parameter on an edge's 3D curve. + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @param[in] theEdge typed edge definition identifier + //! @return curve parameter + //! @throws Standard_NoSuchObject if vertex has no PointOnCurve for this edge + [[nodiscard]] Standard_EXPORT static double Parameter(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex, + const BRepGraph_EdgeId theEdge); + + //! Returns the vertex (U,V) parameters on a face surface. + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @param[in] theFace typed face definition identifier + //! @return 2D point with (U,V) parameters + //! @throws Standard_NoSuchObject if vertex has no PointOnSurface for this face + [[nodiscard]] Standard_EXPORT static gp_Pnt2d Parameters(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex, + const BRepGraph_FaceId theFace); + + //! Returns the vertex parameter on a coedge's PCurve. + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @param[in] theCoEdge typed coedge definition identifier + //! @return PCurve parameter + //! @throws Standard_NoSuchObject if vertex has no PointOnPCurve for this coedge + [[nodiscard]] Standard_EXPORT static double PCurveParameter(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the number of edges that reference this vertex. + //! @param[in] theGraph source graph + //! @param[in] theVertex typed vertex definition identifier + //! @return edge count + [[nodiscard]] Standard_EXPORT static uint32_t NbEdges(const BRepGraph& theGraph, + const BRepGraph_VertexId theVertex); + }; + + //! @brief Edge geometry, curve, polygon, and continuity accessors. + //! + //! Provides tolerance, degeneracy, and parameter flags; raw and + //! location-adjusted 3D curve access; polygon discretization; + //! continuity queries between adjacent faces; and PCurve lookup + //! for edge-face contexts including seam edge support. + class Edge + { + public: + //! Returns the edge tolerance. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return tolerance value + [[nodiscard]] Standard_EXPORT static double Tolerance(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge is degenerate (collapses to a point on surface). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if degenerate + [[nodiscard]] Standard_EXPORT static bool Degenerated(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the SameParameter flag. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if all PCurves are reparametrized to the same range as the 3D curve + [[nodiscard]] Standard_EXPORT static bool SameParameter(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the SameRange flag. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if PCurve parameter range equals the 3D curve range + [[nodiscard]] Standard_EXPORT static bool SameRange(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the 3D curve parameter range as (first, last). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return pair of (first, last) parameters + [[nodiscard]] Standard_EXPORT static std::pair Range( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the start vertex reference entry (carries Location and Orientation). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return const reference to the start VertexRef + [[nodiscard]] Standard_EXPORT static const VertexRef& StartVertexRef( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the end vertex reference entry (carries Location and Orientation). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return const reference to the end VertexRef + [[nodiscard]] Standard_EXPORT static const VertexRef& EndVertexRef( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the start vertex definition id directly (shortcut for + //! `StartVertexRef(...).VertexDefId`). Invalid if the edge has no start vertex. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return start vertex id + [[nodiscard]] Standard_EXPORT static BRepGraph_VertexId StartVertexId( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the end vertex definition id directly (shortcut for + //! `EndVertexRef(...).VertexDefId`). Invalid if the edge has no end vertex. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return end vertex id + [[nodiscard]] Standard_EXPORT static BRepGraph_VertexId EndVertexId( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge has a 3D curve representation. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if edge has a 3D curve + [[nodiscard]] Standard_EXPORT static bool HasCurve(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the raw 3D curve handle (definition frame, no copy). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return curve handle, or null handle if no curve + [[nodiscard]] Standard_EXPORT static const occ::handle& Curve( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the transformed 3D curve handle via CoEdgeUsage (applies Location, may copy). + //! @param[in] theGraph source graph + //! @param[in] theRef coedge incidence reference carrying Location + //! @return transformed curve handle + [[nodiscard]] Standard_EXPORT static occ::handle Curve(const BRepGraph& theGraph, + const CoEdgeUsage& theRef); + + //! Returns the 3D curve adaptor in definition frame (identity Trsf). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return curve adaptor, or empty adaptor if no curve + [[nodiscard]] Standard_EXPORT static GeomAdaptor_TransformedCurve CurveAdaptor( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the 3D curve adaptor via CoEdgeUsage (applies edge-in-wire Location in Trsf). + //! Falls back to CurveOnSurface when no 3D curve exists. + //! @param[in] theGraph source graph + //! @param[in] theRef coedge incidence reference carrying Location + //! @return curve adaptor with Location applied + [[nodiscard]] Standard_EXPORT static GeomAdaptor_TransformedCurve CurveAdaptor( + const BRepGraph& theGraph, + const CoEdgeUsage& theRef); + + //! Returns true if the edge has a 3D polygon discretization. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if edge has a polygon + [[nodiscard]] Standard_EXPORT static bool HasPolygon3D(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the 3D polygon handle (definition frame). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return polygon handle, or null handle if no polygon + [[nodiscard]] Standard_EXPORT static const occ::handle& Polygon3D( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge has continuity info between two faces. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace1 typed first face definition identifier + //! @param[in] theFace2 typed second face definition identifier + //! @return true if continuity is recorded + [[nodiscard]] Standard_EXPORT static bool HasContinuity(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2); + + //! Returns the geometric continuity between two adjacent faces. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace1 typed first face definition identifier + //! @param[in] theFace2 typed second face definition identifier + //! @return continuity order (GeomAbs_C0 if not found) + [[nodiscard]] Standard_EXPORT static GeomAbs_Shape Continuity(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace1, + const BRepGraph_FaceId theFace2); + + //! Returns the maximum continuity across all face pairs for this edge. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return maximum continuity order + [[nodiscard]] Standard_EXPORT static GeomAbs_Shape MaxContinuity( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns the number of faces that reference this edge via coedges. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return face count + [[nodiscard]] Standard_EXPORT static uint32_t NbFaces(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge is shared by exactly two faces (manifold). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if manifold + [[nodiscard]] Standard_EXPORT static bool IsManifold(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge belongs to exactly one face (boundary / free edge). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @return true if boundary + [[nodiscard]] Standard_EXPORT static bool IsBoundary(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge); + + //! Returns true if the edge has two PCurves on a face (seam/closed surface). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace typed face definition identifier + //! @return true if the edge is a seam on this face + [[nodiscard]] Standard_EXPORT static bool IsClosedOnFace(const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace); + + //! Finds the CoEdge entity for an edge on a face. + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace typed face definition identifier + //! @return pointer to CoEdgeDef, or nullptr if not found + [[nodiscard]] Standard_EXPORT static const CoEdgeDef* FindPCurve( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace); + + //! Finds the CoEdge entity with specific orientation (for seam edges). + //! @param[in] theGraph source graph + //! @param[in] theEdge typed edge definition identifier + //! @param[in] theFace typed face definition identifier + //! @param[in] theOri edge orientation on the face + //! @return pointer to CoEdgeDef, or nullptr if not found + [[nodiscard]] Standard_EXPORT static const CoEdgeDef* FindPCurve( + const BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace, + const TopAbs_Orientation theOri); + + //! Returns a CurveOnSurface adaptor built from a CoEdgeUsage and face. + //! @param[in] theGraph source graph + //! @param[in] theRef coedge incidence reference + //! @param[in] theFace typed face definition identifier + //! @return adaptor handle, or null if PCurve or surface is missing + [[nodiscard]] Standard_EXPORT static occ::handle CurveOnSurface( + const BRepGraph& theGraph, + const CoEdgeUsage& theRef, + const BRepGraph_FaceId theFace); + }; + + //! @brief CoEdge (half-edge) parametric curve and polygon accessors. + //! + //! Provides PCurve retrieval, adaptor construction, UV endpoint + //! access, parameter range queries, and polygon-on-surface access + //! for coedge definitions. + class CoEdge + { + public: + //! Returns the coedge orientation relative to its parent edge. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return orientation enum + [[nodiscard]] Standard_EXPORT static TopAbs_Orientation Orientation( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns true if the coedge is REVERSED relative to its parent edge. + //! Convenience shortcut for `Orientation(...) == TopAbs_REVERSED`. + [[nodiscard]] Standard_EXPORT static bool IsReversed(const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the parent edge definition id this coedge uses. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return parent edge id (invalid for removed coedges) + [[nodiscard]] Standard_EXPORT static BRepGraph_EdgeId EdgeOf( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the owning face definition id for this coedge. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return owning face id (invalid for free-wire coedges) + [[nodiscard]] Standard_EXPORT static BRepGraph_FaceId FaceOf( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the seam-pair coedge for closed/seam edges. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return paired coedge id, or invalid if this coedge is not a seam half + [[nodiscard]] Standard_EXPORT static BRepGraph_CoEdgeId SeamPair( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns true if this coedge is one half of a seam pair. + [[nodiscard]] Standard_EXPORT static bool IsSeam(const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns true if the coedge has a PCurve representation. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return true if PCurve exists + [[nodiscard]] Standard_EXPORT static bool HasPCurve(const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the raw PCurve handle by coedge identifier (no Location - UV space). + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return curve handle, or null handle if no PCurve + [[nodiscard]] Standard_EXPORT static const occ::handle& PCurve( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the raw PCurve handle from a CoEdgeDef (no Location - UV space). + //! @param[in] theGraph source graph + //! @param[in] theCoEdge coedge entity reference + //! @return curve handle, or null handle if no PCurve + [[nodiscard]] Standard_EXPORT static const occ::handle& PCurve( + const BRepGraph& theGraph, + const CoEdgeDef& theCoEdge); + + //! Returns a PCurve adaptor by coedge identifier. + //! If the coedge has a stored PCurve (Curve2DRepIdx >= 0), returns it directly. + //! Otherwise, for planar face surfaces, computes the PCurve on-the-fly by projecting + //! the edge's 3D curve onto the plane (CurveOnPlane), mirroring the behavior of + //! BRep_Tool::CurveOnSurface for planar faces without stored PCurves. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return 2D curve adaptor, or empty adaptor if no PCurve and surface is not planar + [[nodiscard]] Standard_EXPORT static Geom2dAdaptor_Curve PCurveAdaptor( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns a PCurve adaptor from a CoEdgeUsage. + //! @param[in] theGraph source graph + //! @param[in] theRef coedge incidence reference + //! @return 2D curve adaptor + [[nodiscard]] Standard_EXPORT static Geom2dAdaptor_Curve PCurveAdaptor( + const BRepGraph& theGraph, + const CoEdgeUsage& theRef); + + //! Returns the UV endpoints from a CoEdge as (UV1, UV2). + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return pair of 2D points at parameter first and last + [[nodiscard]] Standard_EXPORT static std::pair UVPoints( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the PCurve parameter range as (first, last). + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return pair of (first, last) parameters + [[nodiscard]] Standard_EXPORT static std::pair Range( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns true if the coedge has a polygon-on-surface representation. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return true if polygon exists + [[nodiscard]] Standard_EXPORT static bool HasPolygonOnSurface( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + + //! Returns the polygon-on-surface (2D) for the coedge. + //! @param[in] theGraph source graph + //! @param[in] theCoEdge typed coedge definition identifier + //! @return polygon handle, or null handle if no polygon + [[nodiscard]] Standard_EXPORT static const occ::handle& PolygonOnSurface( + const BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge); + }; + + //! @brief Face surface, triangulation, and property accessors. + //! + //! Provides tolerance, natural restriction flag, surface handle + //! and adaptor access (with optional UV bounds), active triangulation + //! retrieval, and outer wire lookup. + class Face + { + public: + //! Returns the face tolerance. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return tolerance value + [[nodiscard]] Standard_EXPORT static double Tolerance(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the NaturalRestriction flag. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return true if face has natural restriction + [[nodiscard]] Standard_EXPORT static bool NaturalRestriction(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns true if the face has a surface representation. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return true if surface exists + [[nodiscard]] Standard_EXPORT static bool HasSurface(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns true if the face has an active triangulation. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return true if triangulation exists + [[nodiscard]] Standard_EXPORT static bool HasTriangulation(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the outer wire reference, or nullptr if none. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return pointer to the outer WireRef, or nullptr + [[nodiscard]] Standard_EXPORT static const WireRef* OuterWire(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the outer wire definition id directly (shortcut for + //! `OuterWire(...)->WireDefId`). Invalid if the face has no outer wire. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return outer wire id + [[nodiscard]] Standard_EXPORT static BRepGraph_WireId OuterWireId( + const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the raw surface handle (definition frame, no copy). + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return surface handle, or null handle if no surface + [[nodiscard]] Standard_EXPORT static const occ::handle& Surface( + const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns a surface adaptor in definition frame. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return surface adaptor, or empty adaptor if no surface + [[nodiscard]] Standard_EXPORT static GeomAdaptor_TransformedSurface SurfaceAdaptor( + const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns a surface adaptor with explicit UV bounds. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @param[in] theUFirst first U parameter + //! @param[in] theULast last U parameter + //! @param[in] theVFirst first V parameter + //! @param[in] theVLast last V parameter + //! @return surface adaptor with bounds, or empty adaptor if no surface + [[nodiscard]] Standard_EXPORT static GeomAdaptor_TransformedSurface SurfaceAdaptor( + const BRepGraph& theGraph, + const BRepGraph_FaceId theFace, + const double theUFirst, + const double theULast, + const double theVFirst, + const double theVLast); + + //! Returns the active triangulation for the face (definition frame). + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return triangulation handle, or null handle if none + [[nodiscard]] Standard_EXPORT static const occ::handle& Triangulation( + const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the number of wire references on the face (outer + holes). + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @return wire count (includes removed refs) + [[nodiscard]] Standard_EXPORT static uint32_t NbWires(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace); + + //! Returns the UV parameter bounds of the face surface. + //! For faces with NaturalRestriction the bounds come directly from the surface. + //! Fills out-parameters with the surface bounds; all values are set to 0.0 if + //! the face has no surface. + //! @param[in] theGraph source graph + //! @param[in] theFace typed face definition identifier + //! @param[out] theUMin minimum U parameter + //! @param[out] theUMax maximum U parameter + //! @param[out] theVMin minimum V parameter + //! @param[out] theVMax maximum V parameter + Standard_EXPORT static void Bounds(const BRepGraph& theGraph, + const BRepGraph_FaceId theFace, + double& theUMin, + double& theUMax, + double& theVMin, + double& theVMax); + }; + + //! @brief Wire property accessors. + //! + //! Provides wire closure, size, and ownership queries. + //! For ordered edge traversal, use BRepGraphInc_WireExplorer or access + //! the WireDef::CoEdgeRefIds vector directly via TopoView. + class Wire + { + public: + //! Returns true if the wire is topologically closed. + //! @param[in] theGraph source graph + //! @param[in] theWire typed wire definition identifier + //! @return true if closed + [[nodiscard]] Standard_EXPORT static bool IsClosed(const BRepGraph& theGraph, + const BRepGraph_WireId theWire); + + //! Number of CoEdge references in the wire (raw count: seam halves count twice, + //! matching TopoDS_Iterator(wire) semantics). + //! @param[in] theGraph source graph + //! @param[in] theWire typed wire definition identifier + //! @return number of coedge entries + [[nodiscard]] Standard_EXPORT static uint32_t NbCoEdges(const BRepGraph& theGraph, + const BRepGraph_WireId theWire); + + //! Number of distinct underlying edges in the wire (seam halves count once). + //! @param[in] theGraph source graph + //! @param[in] theWire typed wire definition identifier + //! @return number of distinct EdgeDefIds reachable from the wire's CoEdgeRefIds + [[nodiscard]] Standard_EXPORT static uint32_t NbDistinctEdges(const BRepGraph& theGraph, + const BRepGraph_WireId theWire); + + //! Returns the first owning face for this wire via the reverse-index table. + //! Returns an invalid id if the wire has no owning face (free wire). + //! @param[in] theGraph source graph + //! @param[in] theWire typed wire definition identifier + //! @return owning face id, or invalid + [[nodiscard]] Standard_EXPORT static BRepGraph_FaceId FaceOf(const BRepGraph& theGraph, + const BRepGraph_WireId theWire); + + //! Returns true if this wire is the outer boundary (IsOuter flag) of its owning face. + //! Scans WireRefs that reference this wire. + //! Returns false for free wires (no owning face). + //! @param[in] theGraph source graph + //! @param[in] theWire typed wire definition identifier + //! @return true if outer wire + [[nodiscard]] Standard_EXPORT static bool IsOuter(const BRepGraph& theGraph, + const BRepGraph_WireId theWire); + }; + + //! @brief Shell property accessors. + //! + //! Provides shell closure and face count queries. + class Shell + { + public: + //! Returns true if the shell is topologically closed (watertight boundary). + //! @param[in] theGraph source graph + //! @param[in] theShell typed shell definition identifier + //! @return true if closed + [[nodiscard]] Standard_EXPORT static bool IsClosed(const BRepGraph& theGraph, + const BRepGraph_ShellId theShell); + + //! Returns the number of face references in the shell. + //! @param[in] theGraph source graph + //! @param[in] theShell typed shell definition identifier + //! @return number of face entries (including removed) + [[nodiscard]] Standard_EXPORT static uint32_t NbFaces(const BRepGraph& theGraph, + const BRepGraph_ShellId theShell); + }; + + //! @brief Mesh cache writes and representation creation. + //! + //! Static methods for creating mesh representations in storage and + //! writing to the mesh cache. These do NOT trigger markModified() + //! or mutation tracking -- mesh data is derived, not model data. + class Mesh + { + public: + //! Create a new TriangulationRep in storage. + //! @return typed identifier, or invalid if the handle is null + [[nodiscard]] Standard_EXPORT static BRepGraph_TriangulationRepId CreateTriangulationRep( + BRepGraph& theGraph, + const occ::handle& theTriangulation); + + //! Create a new Polygon3DRep in storage. + //! @return typed identifier, or invalid if the handle is null + [[nodiscard]] Standard_EXPORT static BRepGraph_Polygon3DRepId CreatePolygon3DRep( + BRepGraph& theGraph, + const occ::handle& thePolygon); + + //! Create a new PolygonOnTriRep in storage. + //! @return typed identifier, or invalid if polygon is null or theTriRepId is invalid + [[nodiscard]] Standard_EXPORT static BRepGraph_PolygonOnTriRepId CreatePolygonOnTriRep( + BRepGraph& theGraph, + const occ::handle& thePolygon, + const BRepGraph_TriangulationRepId theTriRepId); + + //! Append a triangulation rep to the face's cached mesh (multi-LOD support). + Standard_EXPORT static void AppendCachedTriangulation( + BRepGraph& theGraph, + const BRepGraph_FaceId theFace, + const BRepGraph_TriangulationRepId theTriRepId); + + //! Set the active triangulation index in the face's cached mesh. + Standard_EXPORT static void SetCachedActiveIndex(BRepGraph& theGraph, + const BRepGraph_FaceId theFace, + const int theActiveIndex); + + //! Clear cached mesh for a face and its coedges. + Standard_EXPORT static void ClearFaceCache(BRepGraph& theGraph, const BRepGraph_FaceId theFace); + + //! Set the polygon-3D rep in the edge's cached mesh. + Standard_EXPORT static void SetCachedPolygon3D(BRepGraph& theGraph, + const BRepGraph_EdgeId theEdge, + const BRepGraph_Polygon3DRepId thePolyRepId); + + //! Clear cached mesh for an edge. + Standard_EXPORT static void ClearEdgeCache(BRepGraph& theGraph, const BRepGraph_EdgeId theEdge); + + //! Append a polygon-on-tri rep to the coedge's cached mesh (seam edge support). + Standard_EXPORT static void AppendCachedPolygonOnTri( + BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_PolygonOnTriRepId thePolyRepId); + + //! Set the polygon-2D rep in the coedge's cached mesh. + Standard_EXPORT static void SetCachedPolygon2D(BRepGraph& theGraph, + const BRepGraph_CoEdgeId theCoEdge, + const BRepGraph_Polygon2DRepId thePolyRepId); + }; + +private: + BRepGraph_Tool() = delete; +}; + +#endif // _BRepGraph_Tool_HeaderFile diff --git a/opencascade/BRepGraph_TopoView.hxx b/opencascade/BRepGraph_TopoView.hxx new file mode 100644 index 000000000..7fd1815c0 --- /dev/null +++ b/opencascade/BRepGraph_TopoView.hxx @@ -0,0 +1,586 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_TopoView_HeaderFile +#define _BRepGraph_TopoView_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +class Adaptor3d_CurveOnSurface; + +//! @brief Unified read-only view over topology definitions, adjacency, and representations. +//! +//! Provides topology definition lookup, representation lookup, read-only +//! adjacency queries, and assembly classification over the incidence-table +//! model stored in BRepGraph. +//! Obtained via BRepGraph::Topo(). +//! +//! ## Soft-deletion convention +//! Per-kind count methods (Faces().Nb(), Edges().Nb(), etc.) return totals +//! including soft-removed nodes. Prefer per-kind NbActive() variants for +//! traversal and validation code that should ignore removed entities. +//! Definition accessors (Face, Edge, etc.) do not filter removed nodes - callers should check +//! IsRemoved() if needed. +//! +//! ## TopoView vs RefsView naming +//! TopoView accessors take definition IDs (BRepGraph_FaceId, BRepGraph_ShellId, etc.) +//! and return definition structs (FaceDef, ShellDef). RefsView accessors take +//! reference IDs (BRepGraph_FaceRefId, BRepGraph_ShellRefId) and return +//! reference-entry structs carrying per-use orientation and location. +//! +//! Reverse-index accessors return const references to internal vectors. The +//! reference itself is always valid; the returned vector may be empty when the +//! queried entity has no parents of that kind. +class BRepGraph::TopoView +{ +public: + //! @brief Face-oriented topology queries. + class FaceOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_FaceId StartId() const { return BRepGraph_FaceId::Start(); } + + [[nodiscard]] BRepGraph_FaceId EndId() const { return BRepGraph_FaceId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::FaceDef& Definition( + const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Shells( + const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Compounds( + const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT BRepGraph_SurfaceRepId + SurfaceRepId(const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT BRepGraph_TriangulationRepId + ActiveTriangulationRepId(const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT NCollection_DynamicArray SameDomain( + const BRepGraph_FaceId theFace, + const occ::handle& theAllocator) const; + [[nodiscard]] Standard_EXPORT NCollection_DynamicArray SharedEdges( + const BRepGraph_FaceId theFaceA, + const BRepGraph_FaceId theFaceB, + const occ::handle& theAllocator) const; + [[nodiscard]] Standard_EXPORT NCollection_DynamicArray Adjacent( + const BRepGraph_FaceId theFace, + const occ::handle& theAllocator) const; + [[nodiscard]] Standard_EXPORT BRepGraph_WireId OuterWire(const BRepGraph_FaceId theFace) const; + + private: + friend class TopoView; + + explicit FaceOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Edge-oriented topology queries. + class EdgeOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_EdgeId StartId() const { return BRepGraph_EdgeId::Start(); } + + [[nodiscard]] BRepGraph_EdgeId EndId() const { return BRepGraph_EdgeId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::EdgeDef& Definition( + const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT uint32_t NbFaces(const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Wires( + const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& CoEdges( + const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Faces( + const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT BRepGraph_Curve3DRepId + Curve3DRepId(const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT NCollection_DynamicArray Adjacent( + const BRepGraph_EdgeId theEdge, + const occ::handle& theAllocator) const; + [[nodiscard]] Standard_EXPORT bool IsBoundary(const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT bool IsManifold(const BRepGraph_EdgeId theEdge) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CoEdgeDef* FindPCurve( + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CoEdgeDef* FindPCurve( + const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace, + const TopAbs_Orientation theOrientation) const; + + //! Find the CoEdgeId for a given (edge, face) pair. + //! @param[in] theEdge edge to look up + //! @param[in] theFace face the edge belongs to + //! @return CoEdgeId, or invalid if no coedge binds this edge to this face + [[nodiscard]] Standard_EXPORT BRepGraph_CoEdgeId + FindCoEdgeId(const BRepGraph_EdgeId theEdge, const BRepGraph_FaceId theFace) const; + + //! Find the CoEdgeId for a given (edge, face, orientation) triple. + //! Useful for seam edges where two coedges share the same face. + //! @param[in] theEdge edge to look up + //! @param[in] theFace face the edge belongs to + //! @param[in] theOrientation orientation to match (FORWARD or REVERSED) + //! @return CoEdgeId, or invalid if no coedge matches + [[nodiscard]] Standard_EXPORT BRepGraph_CoEdgeId + FindCoEdgeId(const BRepGraph_EdgeId theEdge, + const BRepGraph_FaceId theFace, + const TopAbs_Orientation theOrientation) const; + + private: + friend class TopoView; + + explicit EdgeOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Vertex-oriented topology queries. + class VertexOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_VertexId StartId() const { return BRepGraph_VertexId::Start(); } + + [[nodiscard]] BRepGraph_VertexId EndId() const { return BRepGraph_VertexId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::VertexDef& Definition( + const BRepGraph_VertexId theVertex) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Edges( + const BRepGraph_VertexId theVertex) const; + + private: + friend class TopoView; + + explicit VertexOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Wire-oriented topology queries. + class WireOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_WireId StartId() const { return BRepGraph_WireId::Start(); } + + [[nodiscard]] BRepGraph_WireId EndId() const { return BRepGraph_WireId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::WireDef& Definition( + const BRepGraph_WireId theWire) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Faces( + const BRepGraph_WireId theWire) const; + + private: + friend class TopoView; + + explicit WireOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Shell-oriented topology queries. + class ShellOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_ShellId StartId() const { return BRepGraph_ShellId::Start(); } + + [[nodiscard]] BRepGraph_ShellId EndId() const { return BRepGraph_ShellId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::ShellDef& Definition( + const BRepGraph_ShellId theShell) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Solids( + const BRepGraph_ShellId theShell) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Compounds( + const BRepGraph_ShellId theShell) const; + + private: + friend class TopoView; + + explicit ShellOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Solid-oriented topology queries. + class SolidOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_SolidId StartId() const { return BRepGraph_SolidId::Start(); } + + [[nodiscard]] BRepGraph_SolidId EndId() const { return BRepGraph_SolidId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::SolidDef& Definition( + const BRepGraph_SolidId theSolid) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& CompSolids( + const BRepGraph_SolidId theSolid) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Compounds( + const BRepGraph_SolidId theSolid) const; + + private: + friend class TopoView; + + explicit SolidOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Coedge-oriented topology and representation queries. + class CoEdgeOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_CoEdgeId StartId() const { return BRepGraph_CoEdgeId::Start(); } + + [[nodiscard]] BRepGraph_CoEdgeId EndId() const { return BRepGraph_CoEdgeId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CoEdgeDef& Definition( + const BRepGraph_CoEdgeId theCoEdge) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Wires( + const BRepGraph_CoEdgeId theCoEdge) const; + [[nodiscard]] Standard_EXPORT BRepGraph_EdgeId Edge(const BRepGraph_CoEdgeId theCoEdge) const; + [[nodiscard]] Standard_EXPORT BRepGraph_FaceId Face(const BRepGraph_CoEdgeId theCoEdge) const; + [[nodiscard]] Standard_EXPORT BRepGraph_Curve2DRepId + Curve2DRepId(const BRepGraph_CoEdgeId theCoEdge) const; + [[nodiscard]] Standard_EXPORT BRepGraph_CoEdgeId + SeamPair(const BRepGraph_CoEdgeId theCoEdge) const; + + private: + friend class TopoView; + + explicit CoEdgeOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Compound-oriented topology queries. + class CompoundOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_CompoundId StartId() const { return BRepGraph_CompoundId::Start(); } + + [[nodiscard]] BRepGraph_CompoundId EndId() const { return BRepGraph_CompoundId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CompoundDef& Definition( + const BRepGraph_CompoundId theCompound) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& + ParentCompounds(const BRepGraph_CompoundId theCompound) const; + + private: + friend class TopoView; + + explicit CompoundOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Comp-solid oriented topology queries. + class CompSolidOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_CompSolidId StartId() const { return BRepGraph_CompSolidId::Start(); } + + [[nodiscard]] BRepGraph_CompSolidId EndId() const { return BRepGraph_CompSolidId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::CompSolidDef& Definition( + const BRepGraph_CompSolidId theCompSolid) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Compounds( + const BRepGraph_CompSolidId theCompSolid) const; + + private: + friend class TopoView; + + explicit CompSolidOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Product-oriented raw assembly queries. + class ProductOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_ProductId StartId() const { return BRepGraph_ProductId::Start(); } + + [[nodiscard]] BRepGraph_ProductId EndId() const { return BRepGraph_ProductId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::ProductDef& Definition( + const BRepGraph_ProductId theProduct) const; + [[nodiscard]] Standard_EXPORT const NCollection_DynamicArray& Instances( + const BRepGraph_ProductId theProduct) const; + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId + ShapeRoot(const BRepGraph_ProductId theProduct) const; + + //! True if the product is an assembly (has active child occurrences and no topology root). + //! @param[in] theProduct typed product definition identifier + [[nodiscard]] Standard_EXPORT bool IsAssembly(const BRepGraph_ProductId theProduct) const; + + //! True if the product is a part (has a valid topology root). + //! @param[in] theProduct typed product definition identifier + [[nodiscard]] Standard_EXPORT bool IsPart(const BRepGraph_ProductId theProduct) const; + + //! Return the topology root NodeId for a part product. + //! For assemblies (no topology root) returns an invalid NodeId. + //! @param[in] theProduct typed product definition identifier + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId + ShapeRootNode(const BRepGraph_ProductId theProduct) const; + + //! Number of active child occurrences of a product. + //! @param[in] theProduct typed product definition identifier + [[nodiscard]] Standard_EXPORT int NbComponents(const BRepGraph_ProductId theProduct) const; + + //! Return the i-th active child occurrence identifier of a product. + //! @param[in] theProduct typed product definition identifier + //! @param[in] theComponentIdx zero-based active occurrence index within the product + [[nodiscard]] Standard_EXPORT BRepGraph_OccurrenceId + Component(const BRepGraph_ProductId theProduct, const int theComponentIdx) const; + + private: + friend class TopoView; + + explicit ProductOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Occurrence-oriented raw assembly queries. + class OccurrenceOps + { + public: + [[nodiscard]] Standard_EXPORT int Nb() const; + [[nodiscard]] Standard_EXPORT int NbActive() const; + + [[nodiscard]] BRepGraph_OccurrenceId StartId() const { return BRepGraph_OccurrenceId::Start(); } + + [[nodiscard]] BRepGraph_OccurrenceId EndId() const { return BRepGraph_OccurrenceId(Nb()); } + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::OccurrenceDef& Definition( + const BRepGraph_OccurrenceId theOccurrence) const; + [[nodiscard]] Standard_EXPORT BRepGraph_ProductId + Product(const BRepGraph_OccurrenceId theOccurrence) const; + [[nodiscard]] Standard_EXPORT BRepGraph_ProductId + ParentProduct(const BRepGraph_OccurrenceId theOccurrence) const; + //! Return the local placement of an occurrence (OccurrenceRef::LocalLocation). + //! This is the placement relative to the parent product, not the global placement. + //! For global placement, use ChildExplorer with cumulative location tracking. + //! @param[in] theOccurrence typed occurrence identifier + //! @return OccurrenceRef::LocalLocation, or identity if not found + [[nodiscard]] Standard_EXPORT TopLoc_Location + OccurrenceLocation(const BRepGraph_OccurrenceId theOccurrence) const; + + private: + friend class TopoView; + + explicit OccurrenceOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Generic topology and assembly count / meta queries. + class GenOps + { + public: + [[nodiscard]] Standard_EXPORT const BRepGraphInc::BaseDef* TopoEntity( + const BRepGraph_NodeId theId) const; + [[nodiscard]] Standard_EXPORT int NbNodes() const; + [[nodiscard]] Standard_EXPORT bool IsRemoved(const BRepGraph_NodeId theNode) const; + + private: + friend class TopoView; + + explicit GenOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! @brief Analytic geometry representation queries. + class GeometryOps + { + public: + [[nodiscard]] Standard_EXPORT int NbSurfaces() const; + [[nodiscard]] Standard_EXPORT int NbCurves3D() const; + [[nodiscard]] Standard_EXPORT int NbCurves2D() const; + + [[nodiscard]] Standard_EXPORT int NbActiveSurfaces() const; + [[nodiscard]] Standard_EXPORT int NbActiveCurves3D() const; + [[nodiscard]] Standard_EXPORT int NbActiveCurves2D() const; + + [[nodiscard]] Standard_EXPORT const BRepGraphInc::SurfaceRep& SurfaceRep( + const BRepGraph_SurfaceRepId theRep) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::Curve3DRep& Curve3DRep( + const BRepGraph_Curve3DRepId theRep) const; + [[nodiscard]] Standard_EXPORT const BRepGraphInc::Curve2DRep& Curve2DRep( + const BRepGraph_Curve2DRepId theRep) const; + + private: + friend class TopoView; + + explicit GeometryOps(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; + }; + + //! Grouped face-oriented queries. + [[nodiscard]] const FaceOps& Faces() const { return myFaces; } + + //! Grouped edge-oriented queries. + [[nodiscard]] const EdgeOps& Edges() const { return myEdges; } + + //! Grouped vertex-oriented queries. + [[nodiscard]] const VertexOps& Vertices() const { return myVertices; } + + //! Grouped wire-oriented queries. + [[nodiscard]] const WireOps& Wires() const { return myWires; } + + //! Grouped shell-oriented queries. + [[nodiscard]] const ShellOps& Shells() const { return myShells; } + + //! Grouped solid-oriented queries. + [[nodiscard]] const SolidOps& Solids() const { return mySolids; } + + //! Grouped coedge-oriented queries. + [[nodiscard]] const CoEdgeOps& CoEdges() const { return myCoEdges; } + + //! Grouped compound-oriented queries. + [[nodiscard]] const CompoundOps& Compounds() const { return myCompounds; } + + //! Grouped comp-solid oriented queries. + [[nodiscard]] const CompSolidOps& CompSolids() const { return myCompSolids; } + + //! Grouped product-oriented queries. + [[nodiscard]] const ProductOps& Products() const { return myProducts; } + + //! Grouped occurrence-oriented queries. + [[nodiscard]] const OccurrenceOps& Occurrences() const { return myOccurrences; } + + //! Grouped generic topology and assembly counts / meta queries. + [[nodiscard]] const GenOps& Gen() const { return myGen; } + + //! Grouped analytic geometry representation queries. + [[nodiscard]] const GeometryOps& Geometry() const { return myGeometry; } + + //! Representations use dense 0-based indexing. Iterate through grouped accessors: + //! @code + //! for (int i = 0; i < aGraph.Topo().Geometry().NbSurfaces(); ++i) + //! { + //! const BRepGraphInc::SurfaceRep& aRep = + //! aGraph.Topo().Geometry().SurfaceRep(BRepGraph_SurfaceRepId(i)); + //! } + //! @endcode + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + friend class BRepGraph_Tool; + + explicit TopoView(const BRepGraph* theGraph) + : myGraph(theGraph), + myFaces(theGraph), + myEdges(theGraph), + myVertices(theGraph), + myWires(theGraph), + myShells(theGraph), + mySolids(theGraph), + myCoEdges(theGraph), + myCompounds(theGraph), + myCompSolids(theGraph), + myProducts(theGraph), + myOccurrences(theGraph), + myGen(theGraph), + myGeometry(theGraph) + { + } + + const BRepGraph* myGraph; + FaceOps myFaces; + EdgeOps myEdges; + VertexOps myVertices; + WireOps myWires; + ShellOps myShells; + SolidOps mySolids; + CoEdgeOps myCoEdges; + CompoundOps myCompounds; + CompSolidOps myCompSolids; + ProductOps myProducts; + OccurrenceOps myOccurrences; + GenOps myGen; + GeometryOps myGeometry; +}; + +#endif // _BRepGraph_TopoView_HeaderFile diff --git a/opencascade/BRepGraph_Transform.hxx b/opencascade/BRepGraph_Transform.hxx new file mode 100644 index 000000000..5ded63041 --- /dev/null +++ b/opencascade/BRepGraph_Transform.hxx @@ -0,0 +1,113 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Transform_HeaderFile +#define _BRepGraph_Transform_HeaderFile + +#include +#include +#include + +#include +#include + +//! @brief Graph-to-graph transformation. +//! +//! Produces a new BRepGraph by copying and then applying a geometric +//! transformation to vertex points and geometry node locations. +//! +//! Two geometry modes (matching BRepBuilderAPI_Transform semantics): +//! - theCopyGeom = true (geometry-level): deep-copy geometry, transform handles +//! in-place via Geom_Surface::Transform() etc., reset locations to identity. +//! - theCopyGeom = false (root-level): light-copy with shared geometry, apply +//! transform via location modification only. +//! +//! Mesh handling (theCopyMesh parameter): +//! - theCopyMesh = false (default): triangulations and polygons are discarded +//! after a geometry-level transform and must be recomputed. +//! - theCopyMesh = true: all mesh data (Poly_Triangulation on FaceDefs and the +//! MeshLayer cache, Poly_Polygon3D on edges, Poly_PolygonOnTriangulation on +//! coedges) is copied and transformed in sync with the geometry. +//! In location-only mode the mesh data is copied as-is (nodes stay in the +//! graph coordinate system, which is unaffected by a pure location compose). +//! +//! @note Returns BRepGraph directly (not a Result struct) because this is an +//! immutable operation producing a new graph. Check IsDone() for success. +//! +//! ## Typical usage +//! @code +//! BRepGraph aGraph; +//! BRepGraph_Builder::Add(aGraph, myShape); +//! gp_Trsf aTrsf; +//! aTrsf.SetTranslation(gp_Vec(10.0, 0.0, 0.0)); +//! BRepGraph aTransformed = BRepGraph_Transform::Perform(aGraph, aTrsf); +//! TopoDS_Shape aShape = aTransformed.Shapes().Shape(); +//! @endcode +class BRepGraph_Transform +{ +public: + DEFINE_STANDARD_ALLOC + + //! Transform the entire graph. + //! @param[in] theGraph a pre-built BRepGraph (must have IsDone() == true) + //! @param[in] theTrsf the transformation to apply + //! @param[in] theCopyGeom if true, geometry is deep-copied before transforming; + //! if false, light-copy then transform locations/points only + //! @param[in] theCopyMesh if true, mesh data (triangulations, polygons) is copied and + //! transformed; if false, meshes are discarded after transform + //! @return a new BRepGraph with the transformation applied + [[nodiscard]] Standard_EXPORT static BRepGraph Perform(const BRepGraph& theGraph, + const gp_Trsf& theTrsf, + const bool theCopyGeom = true, + const bool theCopyMesh = false); + + //! Transform a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex). + //! Produces a new BRepGraph containing only the specified node and its referenced sub-graph. + //! The transform is applied to all copied geometry (same rules as Perform()). + //! @param[in] theGraph a pre-built BRepGraph + //! @param[in] theNodeId node identifier (any kind: Face, Shell, Solid, Wire, Edge, Vertex, + //! Compound, CompSolid, Product, Occurrence) + //! @param[in] theTrsf the transformation to apply + //! @param[in] theCopyGeom if true, geometry is deep-copied before transforming + //! @param[in] theCopyMesh if true, mesh data is copied and transformed + //! @return a new BRepGraph containing only the specified sub-graph, transformed + [[nodiscard]] Standard_EXPORT static BRepGraph TransformNode(const BRepGraph& theGraph, + const BRepGraph_NodeId theNodeId, + const gp_Trsf& theTrsf, + const bool theCopyGeom = true, + const bool theCopyMesh = false); + + //! Apply an in-place location-only transform to a single reference. + //! Composes theTrsf into the reference's LocalLocation field without copying + //! any geometry. This is O(1) and equivalent to TopoDS_Shape::Moved(trsf). + //! Cached mesh data on entities downstream of the moved ref is stored in the + //! entity's local frame and is unaffected; callers that bake a world transform + //! into a cache key own the invalidation responsibility. + //! @note Only pure rotation/translation transforms (scale == 1) are supported. + //! The method is a no-op and returns false if |scaleFactor| != 1. + //! @param[in] theGraph the graph containing the reference + //! @param[in] theRefId reference to move (any ref kind) + //! @param[in] theTrsf the transformation to compose into the location + //! @return true on success; false if theTrsf has a non-unit scale factor + Standard_EXPORT static bool MoveRef(BRepGraph& theGraph, + const BRepGraph_RefId& theRefId, + const gp_Trsf& theTrsf); + +private: + //! Apply location-only transform by storing per-node locations. + static void applyLocationTransform(BRepGraph& theGraph, const gp_Trsf& theTrsf); + + BRepGraph_Transform() = delete; +}; + +#endif // _BRepGraph_Transform_HeaderFile diff --git a/opencascade/BRepGraph_TransientCache.hxx b/opencascade/BRepGraph_TransientCache.hxx new file mode 100644 index 000000000..122644a5c --- /dev/null +++ b/opencascade/BRepGraph_TransientCache.hxx @@ -0,0 +1,362 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_TransientCache_HeaderFile +#define _BRepGraph_TransientCache_HeaderFile + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +//! @brief Descriptor of one transient cache family. +//! +//! A cache kind defines stable public identity for one class of transient, +//! recomputable per-node data such as bounding boxes or UV bounds. +//! Instances are process-global descriptors registered in +//! BRepGraph_CacheKindRegistry and referenced from graphs by dense runtime slots. +class BRepGraph_CacheKind : public Standard_Transient +{ +public: + //! Create a cache kind descriptor. + //! @param[in] theID stable public GUID identity + //! @param[in] theName display-only name + //! @param[in] theNodeKindsMask optional node-kind applicability mask; + //! 0 means "unspecified / unrestricted" + Standard_EXPORT BRepGraph_CacheKind( + const Standard_GUID& theID, + const TCollection_AsciiString& theName = TCollection_AsciiString(), + const int theNodeKindsMask = 0); + + //! Stable public identity. + [[nodiscard]] const Standard_GUID& ID() const { return myID; } + + //! Display-only metadata. + [[nodiscard]] const TCollection_AsciiString& Name() const { return myName; } + + //! Optional node-kind applicability mask. + [[nodiscard]] int NodeKindsMask() const { return myNodeKindsMask; } + + //! True if this cache kind is applicable to the given node kind. + //! Cache kinds with NodeKindsMask() == 0 are treated as unrestricted. + [[nodiscard]] bool SupportsNodeKind(const BRepGraph_NodeId::Kind theKind) const + { + return myNodeKindsMask == 0 || (myNodeKindsMask & KindBit(theKind)) != 0; + } + + //! Convenience: bitmask bit for a given node kind. + static int KindBit(const BRepGraph_NodeId::Kind theKind) + { + return 1 << static_cast(theKind); + } + + DEFINE_STANDARD_RTTIEXT(BRepGraph_CacheKind, Standard_Transient) + +private: + Standard_GUID myID; + TCollection_AsciiString myName; + int myNodeKindsMask = 0; +}; + +//! @brief Process-global registry of cache kind descriptors. +//! +//! Maps stable GUID identity to dense runtime slot index. Slot indices are an +//! internal storage detail used by BRepGraph_TransientCache for O(1) indexing. +//! The registry is shared across all BRepGraph instances in the current process, +//! so cache-kind GUIDs should be globally unique. +class BRepGraph_CacheKindRegistry +{ +public: + //! Register a cache kind descriptor. + //! Idempotent: the same GUID always yields the same slot. + //! Slot assignment is process-global and graph-instance independent. + //! @return dense runtime slot, or -1 for null input + [[nodiscard]] Standard_EXPORT static int Register( + const occ::handle& theKind); + + //! Find slot by GUID. Returns -1 if not found. + [[nodiscard]] Standard_EXPORT static int FindSlot(const Standard_GUID& theGUID); + + //! Find slot by GUID. + //! @param[out] theSlot dense runtime slot if found + //! @return true if the GUID is registered + Standard_EXPORT static bool FindSlot(const Standard_GUID& theGUID, int& theSlot); + + //! Find descriptor by GUID. + [[nodiscard]] Standard_EXPORT static occ::handle FindKind( + const Standard_GUID& theGUID); + + //! Find descriptor by slot. + [[nodiscard]] Standard_EXPORT static occ::handle FindKind(const int theSlot); + + //! Check whether a GUID is registered. + [[nodiscard]] Standard_EXPORT static bool Contains(const Standard_GUID& theGUID); + + //! Check whether a slot is registered. + [[nodiscard]] Standard_EXPORT static bool Contains(const int theSlot); + + //! Number of registered cache kinds. + [[nodiscard]] Standard_EXPORT static int NbRegistered(); + +private: + BRepGraph_CacheKindRegistry() = delete; +}; + +//! @brief Abstract base for transient per-node cache values. +//! +//! Inherits from Standard_Transient and is stored via +//! occ::handle. This uses OCCT's embedded refcount and is +//! consistent with the Handle pattern used throughout the codebase. +class BRepGraph_CacheValue : public Standard_Transient +{ +public: + //! Mark the cached value as needing recomputation. Lock-free. + void Invalidate() { myDirty.store(true, std::memory_order_release); } + + //! True if the cached value needs recomputation. + bool IsDirty() const { return myDirty.load(std::memory_order_acquire); } + + DEFINE_STANDARD_RTTI_INLINE(BRepGraph_CacheValue, Standard_Transient) + +protected: + BRepGraph_CacheValue() + : myDirty(true) + { + } + + //! Subclass calls after successful computation to clear the dirty flag. + void MarkClean() const { myDirty.store(false, std::memory_order_release); } + + //! Mutex for thread-safe Get() in subclasses. + mutable std::shared_mutex myMutex; + +private: + mutable std::atomic myDirty; +}; + +//! @brief Concrete typed wrapper for a lazily-computed per-node value. +//! +//! @tparam T cached value type (for example double). +template +class BRepGraph_TypedCacheValue : public BRepGraph_CacheValue +{ +public: + BRepGraph_TypedCacheValue() = default; + + //! Construct with an initial value (marked clean). + explicit BRepGraph_TypedCacheValue(const T& theInitial) + : myValue(theInitial) + { + MarkClean(); + } + + //! Get the cached value, computing via theComputer if dirty. + //! Thread-safe: uses the base class shared_mutex. + T Get(const std::function& theComputer) const + { + if (!IsDirty()) + { + std::shared_lock aLock(myMutex); + if (!IsDirty()) + { + return myValue; + } + } + + std::unique_lock aLock(myMutex); + if (IsDirty()) + { + myValue = theComputer(); + MarkClean(); + } + return myValue; + } + + //! Direct write - stores the value and marks clean. + void Set(const T& theValue) + { + std::unique_lock aLock(myMutex); + myValue = theValue; + MarkClean(); + } + + //! Direct read. Caller must guarantee freshness. + const T& UncheckedValue() const { return myValue; } + +private: + mutable T myValue{}; +}; + +//! @brief Centralized transient cache for algorithm-computed per-node values. +//! +//! Stores short-lived cached data (BndBox, UVBounds, etc.) in dense per-cache-kind +//! vectors indexed by entity index. O(1) access by direct indexing - no hashing. +//! +//! ## SubtreeGen-based freshness +//! Each stored slot records SubtreeGen at write time. On read, if stored +//! SubtreeGen differs from entity's current SubtreeGen the cached value is +//! considered stale - the caller decides how to handle it. +//! +//! ## Lifecycle +//! NOT a Layer. Cleared on BRepGraph_Builder::Add() and Compact(). No OnNodeRemoved handling - +//! stale data is auto-detected by SubtreeGen mismatch. +//! +//! ## Thread safety +//! After Reserve(), Get() and Set() for in-range indices bypass the mutex +//! entirely - safe because parallel algorithms access different entity slots. +//! Out-of-range access (entities added after construction) falls back to mutex. +class BRepGraph_TransientCache +{ +public: + //! Number of Kind enum slots to cover (0..11, with gap at 9). + static constexpr int THE_KIND_COUNT = BRepGraph_NodeId::THE_KIND_COUNT; + + //! Default number of cache-kind slots reserved after BRepGraph_Builder::Add(). + static constexpr int THE_DEFAULT_RESERVED_KIND_COUNT = 16; + + //! Per-slot storage: cached value handle + SubtreeGen stamp. + struct CacheSlot + { + occ::handle Value; + uint32_t StoredSubtreeGen = 0; + }; + + //! Store a cached value for a node and cache kind. + //! @pre Reserve() must have been called for lock-free parallel access + //! on in-range entity indices; out-of-range access falls back to mutex. + Standard_EXPORT void Set(const BRepGraph_NodeId theNode, + const occ::handle& theKind, + const occ::handle& theValue, + const uint32_t theCurrentSubtreeGen); + + //! Store a cached value using a pre-resolved kind slot index. + //! Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths. + //! @param[in] theKindSlot slot from BRepGraph_CacheKindRegistry::Register() + Standard_EXPORT void Set(const BRepGraph_NodeId theNode, + const int theKindSlot, + const occ::handle& theValue, + const uint32_t theCurrentSubtreeGen); + + //! Retrieve a cached value for a node and cache kind. + //! @pre Reserve() must have been called for lock-free parallel access + //! on in-range entity indices; out-of-range access falls back to mutex. + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_NodeId theNode, + const occ::handle& theKind, + const uint32_t theCurrentSubtreeGen) const; + + //! Retrieve a cached value using a pre-resolved kind slot index. + //! Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths. + //! @param[in] theKindSlot slot from BRepGraph_CacheKindRegistry::Register() + [[nodiscard]] Standard_EXPORT occ::handle Get( + const BRepGraph_NodeId theNode, + const int theKindSlot, + const uint32_t theCurrentSubtreeGen) const; + + //! Remove a cached value for a node and cache kind. + [[nodiscard]] Standard_EXPORT bool Remove(const BRepGraph_NodeId theNode, + const occ::handle& theKind); + + //! Remove a cached value using a pre-resolved cache-kind slot. + [[nodiscard]] Standard_EXPORT bool Remove(const BRepGraph_NodeId theNode, const int theKindSlot); + + //! Collect fresh cache-kind slot indices for a node (zero heap allocation). + //! Used internally by CacheView::CacheKindIterator. + //! @param[in] theNode node to query + //! @param[in] theCurrentSubtreeGen freshness stamp to match + //! @param[out] theSlots output array (caller-allocated, must hold + //! THE_DEFAULT_RESERVED_KIND_COUNT) + //! @return number of populated slots written to theSlots + Standard_EXPORT int CollectCacheKindSlots(const BRepGraph_NodeId theNode, + const uint32_t theCurrentSubtreeGen, + int theSlots[]) const; + + //! Pre-allocate storage for lock-free parallel access. + Standard_EXPORT void Reserve(const int theKindCount, const int theCounts[THE_KIND_COUNT]); + + //! True if Reserve() has been called and storage is pre-allocated. + [[nodiscard]] bool IsReserved() const noexcept + { + return myIsReserved.load(std::memory_order_acquire); + } + + //! Clear all cached data. Called on BRepGraph_Builder::Add() and Compact(). + Standard_EXPORT void Clear() noexcept; + + //! Move constructor: transfers data, creates fresh mutex. + BRepGraph_TransientCache(BRepGraph_TransientCache&& theOther) noexcept + : myKinds(std::move(theOther.myKinds)), + myIsReserved(theOther.myIsReserved.load(std::memory_order_relaxed)) + { + theOther.myIsReserved.store(false, std::memory_order_relaxed); + } + + //! Move assignment: transfers data, mutex stays local. + BRepGraph_TransientCache& operator=(BRepGraph_TransientCache&& theOther) noexcept + { + if (this != &theOther) + { + myKinds = std::move(theOther.myKinds); + myIsReserved.store(theOther.myIsReserved.load(std::memory_order_relaxed), + std::memory_order_relaxed); + theOther.myIsReserved.store(false, std::memory_order_relaxed); + } + return *this; + } + + BRepGraph_TransientCache() = default; + BRepGraph_TransientCache(const BRepGraph_TransientCache&) = delete; + BRepGraph_TransientCache& operator=(const BRepGraph_TransientCache&) = delete; + +private: + //! Per-node-kind dense vector of cache slots. + struct NodeKindStore + { + NCollection_DynamicArray mySlots; + }; + + //! Per-cache-kind storage: one node-kind store per entity kind. + struct CacheKindSlot + { + NodeKindStore myNodeKinds[THE_KIND_COUNT]; + }; + + //! Ensure myKinds has capacity for the given cache-kind slot. + void ensureKind(const int theKindSlot); + + //! Access slot (mutable) - grows vector if needed. + CacheSlot& changeSlot(const BRepGraph_NodeId theNode, const int theKindSlot); + + //! Access slot (const) - returns nullptr if out of range. + const CacheSlot* seekSlot(const BRepGraph_NodeId theNode, const int theKindSlot) const; + + //! Outer vector indexed by cache-kind slot. + NCollection_DynamicArray myKinds; + + //! True after Reserve() - enables lock-free access for in-range slots. + std::atomic myIsReserved{false}; + + //! Protects structural modifications (vector growth) during concurrent access. + mutable std::shared_mutex myMutex; +}; + +#endif // _BRepGraph_TransientCache_HeaderFile diff --git a/opencascade/BRepGraph_UID.hxx b/opencascade/BRepGraph_UID.hxx new file mode 100644 index 000000000..0958b4cf3 --- /dev/null +++ b/opencascade/BRepGraph_UID.hxx @@ -0,0 +1,123 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_UID_HeaderFile +#define _BRepGraph_UID_HeaderFile + +#include + +#include +#include +#include + +//! Unique node identifier within a BRepGraph. +//! +//! Identity = (Kind, Counter). Two nodes of different kinds may share a +//! counter value but their UIDs are distinct. Within one kind, counter +//! values never repeat (monotonic, never resets). +//! +//! Generation is NOT part of identity; it indicates which BRepGraph::Clear() cycle +//! produced this UID (for stale-reference detection). +//! +//! Trivially copyable, cheap to pass by value. +//! +//! ## Serialization Contract +//! +//! Entity UIDs (BRepGraph_UID) and reference UIDs (BRepGraph_RefUID) share +//! a single monotonic counter (BRepGraph_Data::myNextUIDCounter). +//! To persist a BRepGraph across sessions: +//! 1. Write: for each entity, serialize (Kind, Counter, OwnGen). +//! 2. Read: reconstruct entities, populate UID vectors with deserialized +//! (Kind, Counter) values, set myNextUIDCounter to +//! max(all_entity_counters, all_ref_counters) + 1. +//! 3. myGeneration resets to 0 on load (session-scoped). +//! 4. VersionStamps from a previous session will correctly detect staleness +//! via Generation mismatch. +struct BRepGraph_UID +{ + //! Default: invalid UID (counter = 0 is the invalid sentinel). + BRepGraph_UID() + : myCounter(0), + myKind(BRepGraph_NodeId::Kind::Solid), + myGeneration(0) + { + } + + //! Construct a valid UID. Called internally by BRepGraph::allocateUID(). + //! @pre theCounter > 0 (counter = 0 is reserved as the invalid sentinel) + BRepGraph_UID(const BRepGraph_NodeId::Kind theKind, + const size_t theCounter, + const uint32_t theGeneration) + : myCounter(theCounter), + myKind(theKind), + myGeneration(theGeneration) + { + Standard_ASSERT_VOID(theCounter > 0, "BRepGraph_UID: counter must be > 0 for valid UIDs"); + } + + //! Factory: returns an explicitly invalid UID. + static BRepGraph_UID Invalid() { return BRepGraph_UID(); } + + [[nodiscard]] bool IsValid() const { return myCounter > 0; } + + [[nodiscard]] BRepGraph_NodeId::Kind Kind() const { return myKind; } + + [[nodiscard]] size_t Counter() const { return myCounter; } + + [[nodiscard]] uint32_t Generation() const { return myGeneration; } + + [[nodiscard]] bool IsTopology() const { return BRepGraph_NodeId::IsTopologyKind(myKind); } + + [[nodiscard]] bool IsAssembly() const { return BRepGraph_NodeId::IsAssemblyKind(myKind); } + + //! Equality: Identity = (Kind, Counter). Generation excluded. + //! Two invalid UIDs are equal. + bool operator==(const BRepGraph_UID& theOther) const + { + if (myCounter == 0 || theOther.myCounter == 0) + return (myCounter == 0) == (theOther.myCounter == 0); + return myKind == theOther.myKind && myCounter == theOther.myCounter; + } + + bool operator!=(const BRepGraph_UID& theOther) const { return !(*this == theOther); } + + bool operator<(const BRepGraph_UID& theOther) const + { + if (myKind != theOther.myKind) + return static_cast(myKind) < static_cast(theOther.myKind); + return myCounter < theOther.myCounter; + } + + //! Hash value: f(Kind, Counter). + [[nodiscard]] size_t HashValue() const + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(static_cast(myKind)); + aCombination[1] = opencascade::hash(myCounter); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } + +private: + size_t myCounter; //!< 0 = invalid sentinel; valid counters start at 1. + BRepGraph_NodeId::Kind myKind; //!< Node kind. + uint32_t myGeneration; //!< BRepGraph::Clear() cycle that produced this UID. +}; + +//! std::hash specialization for NCollection_DefaultHasher support. +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_UID& theUID) const noexcept { return theUID.HashValue(); } +}; + +#endif // _BRepGraph_UID_HeaderFile diff --git a/opencascade/BRepGraph_UIDsView.hxx b/opencascade/BRepGraph_UIDsView.hxx new file mode 100644 index 000000000..161a18367 --- /dev/null +++ b/opencascade/BRepGraph_UIDsView.hxx @@ -0,0 +1,105 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_UIDsView_HeaderFile +#define _BRepGraph_UIDsView_HeaderFile + +#include +#include + +class Standard_GUID; + +//! @brief Read-only view for persistent unique identifiers. +//! +//! UIDs are (Kind, Counter) pairs that persist across graph mutations +//! (Compact, node removal). Counters are monotonic and independent of vector +//! indices. Clear() starts a new graph generation and refreshes the graph +//! GUID, enabling stale-reference detection when a graph is rebuilt. +//! Provides bidirectional NodeId/UID resolution. Obtained via BRepGraph::UIDs(). +class BRepGraph::UIDsView +{ +public: + //! Return the UID assigned to a node. + //! @param[in] theNode node identifier + //! @return UID for the active node, or invalid UID if theNode is out of bounds or removed + [[nodiscard]] Standard_EXPORT BRepGraph_UID Of(const BRepGraph_NodeId theNode) const; + + //! Return the RefUID assigned to a reference. + //! @param[in] theRefId reference identifier + //! @return RefUID for the active reference, or invalid RefUID if theRefId is out of bounds or + //! removed + [[nodiscard]] Standard_EXPORT BRepGraph_RefUID Of(const BRepGraph_RefId theRefId) const; + + //! Resolve a UID back to a NodeId using the internal reverse index. + //! @param[in] theUID unique identifier to resolve + //! @return corresponding active NodeId, or invalid NodeId if not found/removed + [[nodiscard]] Standard_EXPORT BRepGraph_NodeId NodeIdFrom(const BRepGraph_UID& theUID) const; + + //! Resolve a RefUID back to a RefId using the internal reverse index. + //! @param[in] theUID unique reference identifier to resolve + //! @return corresponding active RefId, or invalid RefId if not found/removed + [[nodiscard]] Standard_EXPORT BRepGraph_RefId RefIdFrom(const BRepGraph_RefUID& theUID) const; + + //! Check if a UID is valid and exists in this graph generation. + //! @param[in] theUID unique identifier to check + //! @return true if the UID resolves to an active node in this graph generation + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_UID& theUID) const; + + //! Check if a RefUID is valid and exists in this graph generation. + //! @param[in] theUID unique reference identifier to check + //! @return true if the RefUID resolves to an active reference in this graph generation + [[nodiscard]] Standard_EXPORT bool Has(const BRepGraph_RefUID& theUID) const; + + //! Return the current generation counter (incremented on each BRepGraph::Clear()). + //! @return graph generation number + [[nodiscard]] Standard_EXPORT uint32_t Generation() const; + + //! Return the graph-level identity GUID. + //! Generated randomly at BRepGraph::Clear() time; changes on each rebuild. + //! @return reference to the graph identity GUID + [[nodiscard]] Standard_EXPORT const Standard_GUID& GraphGUID() const; + + //! Produce a version stamp for the given node. + //! Combines the node's UID with its current OwnGen and graph Generation. + //! @param[in] theNode node identifier + //! @return version stamp, or invalid stamp if theNode is invalid, removed, or out of bounds + [[nodiscard]] Standard_EXPORT BRepGraph_VersionStamp + StampOf(const BRepGraph_NodeId theNode) const; + + //! Produce a version stamp for the given reference. + //! Combines the reference's RefUID with its current OwnGen and graph Generation. + //! @param[in] theRefId reference identifier + //! @return version stamp, or invalid stamp if theRefId is invalid, removed, or out of bounds + [[nodiscard]] Standard_EXPORT BRepGraph_VersionStamp + StampOf(const BRepGraph_RefId theRefId) const; + + //! Check if a previously-taken stamp is stale. + //! A stamp is stale when the stamped node or reference has been mutated, + //! removed, or the graph was rebuilt since the stamp was taken. + //! @param[in] theStamp version stamp to check + //! @return true if the stamp no longer matches the current graph state + [[nodiscard]] Standard_EXPORT bool IsStale(const BRepGraph_VersionStamp& theStamp) const; + +private: + friend class BRepGraph; + friend struct BRepGraph_Data; + + explicit UIDsView(const BRepGraph* theGraph) + : myGraph(theGraph) + { + } + + const BRepGraph* myGraph; +}; + +#endif // _BRepGraph_UIDsView_HeaderFile diff --git a/opencascade/BRepGraph_Validate.hxx b/opencascade/BRepGraph_Validate.hxx new file mode 100644 index 000000000..d588b668f --- /dev/null +++ b/opencascade/BRepGraph_Validate.hxx @@ -0,0 +1,165 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_Validate_HeaderFile +#define _BRepGraph_Validate_HeaderFile + +#include + +#include +#include +#include +#include + +//! @brief Structural invariant checker for BRepGraph. +//! +//! Read-only algorithm that verifies the graph's internal consistency: +//! cross-reference bounds, reverse index symmetry, incidence ref consistency, +//! geometry reference validity, removed-node isolation, and wire connectivity. +//! +//! Distinct from BRepGraphCheck (geometric shape validity). This class +//! checks the graph data structure itself. +//! +//! ### Validation Mode Check Matrix +//! +//! | Check | Lightweight | Audit | +//! |--------------------------------|:-----------:|:-----:| +//! | Active entity count boundary | YES | YES | +//! | Cross-reference bounds | - | YES | +//! | Reverse-index consistency | - | YES | +//! | Face-count cache consistency | - | YES | +//! | Incidence ref consistency | - | YES | +//! | Geometry representation refs | - | YES | +//! | Removed-node isolation | - | YES | +//! | Wire edge connectivity | - | YES | +//! | Entity ID positional integrity | - | YES | +//! | UID round-trip integrity | - | YES | +//! | Assembly DAG cycle detection | - | YES | +//! +//! ### Mode Guidance +//! +//! | Mode | What it checks | Cost | Recommended use | +//! |------|----------------|------|-----------------| +//! | `Lightweight` | Active entity count boundary only | Low | Hot-path release builds when the +//! graph structure is already trusted | | `Audit` | Full structural audit from cross-reference +//! bounds through assembly DAG cycle detection | Higher | Default validation mode for production +//! pipelines, test gates, and API-boundary verification | +//! +//! For production pipelines, prefer `Mode::Audit`; `Mode::Lightweight` is intended +//! for hot-path release builds where the graph structure is already trusted. +class BRepGraph_Validate +{ +public: + DEFINE_STANDARD_ALLOC + + //! Severity level for reported issues. + enum class Severity + { + Warning, + Error + }; + + //! Validation mode controlling check depth/performance trade-off. + enum class Mode + { + //! Fast boundary-oriented checks for frequent validation points. + Lightweight, + //! Full structural audit (superset of Lightweight). + Audit + }; + + //! A single structural issue found in the graph. + struct Issue + { + Severity Sev; + BRepGraph_NodeId NodeId; + TCollection_AsciiString Description; + }; + + //! Aggregated validation result. + struct Result + { + NCollection_DynamicArray Issues; + + //! True if no Error-level issues were found. + [[nodiscard]] bool IsValid() const + { + for (const Issue& anIssue : Issues) + { + if (anIssue.Sev == Severity::Error) + return false; + } + return true; + } + + //! Count issues of a given severity. + [[nodiscard]] int NbIssues(const Severity theSev) const + { + int aCount = 0; + for (const Issue& anIssue : Issues) + { + if (anIssue.Sev == theSev) + ++aCount; + } + return aCount; + } + }; + + //! Validation options. + struct Options + { + //! Default mode for regular validation calls. + Mode ValidationMode = Mode::Lightweight; + + //! Build options for lightweight validation. + static Options Lightweight() + { + Options anOptions; + anOptions.ValidationMode = Mode::Lightweight; + return anOptions; + } + + //! Build options for full-audit validation. + static Options Audit() + { + Options anOptions; + anOptions.ValidationMode = Mode::Audit; + return anOptions; + } + }; + + //! Run default lightweight structural checks on a built graph. + //! Uses Mode::Lightweight; for full structural audit use Perform(theGraph, Mode::Audit). + //! @param[in] theGraph graph to validate (const, read-only) + //! @return validation result with all detected issues + [[nodiscard]] Standard_EXPORT static Result Perform(const BRepGraph& theGraph); + + //! Run structural checks on a built graph with explicit mode. + //! @param[in] theGraph graph to validate (const, read-only) + //! @param[in] theMode validation mode + //! @return validation result with all detected issues + [[nodiscard]] Standard_EXPORT static Result Perform(const BRepGraph& theGraph, + const Mode theMode); + + //! Run structural checks on a built graph with explicit options. + //! @param[in] theGraph graph to validate (const, read-only) + //! @param[in] theOptions validation profile/options + //! @return validation result with all detected issues + [[nodiscard]] Standard_EXPORT static Result Perform(const BRepGraph& theGraph, + const Options& theOptions); + +private: + BRepGraph_Validate() = delete; +}; + +#endif // _BRepGraph_Validate_HeaderFile diff --git a/opencascade/BRepGraph_VersionStamp.hxx b/opencascade/BRepGraph_VersionStamp.hxx new file mode 100644 index 000000000..963e450f5 --- /dev/null +++ b/opencascade/BRepGraph_VersionStamp.hxx @@ -0,0 +1,186 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_VersionStamp_HeaderFile +#define _BRepGraph_VersionStamp_HeaderFile + +#include +#include +#include + +#include + +//! @brief Snapshot of an entity/ref identity and version at a point in time. +//! +//! Combines a persistent UID (entity or reference entry) with +//! OwnGen (own-data version counter) and graph Generation (BRepGraph::Clear() cycle). +//! Computed on demand via BRepGraph::UIDs().StampOf(). +//! +//! Usage pattern: +//! @code +//! BRepGraph_VersionStamp aStamp = aGraph.UIDs().StampOf(aFaceId); +//! // ... later, after mutations ... +//! if (aGraph.UIDs().IsStale(aStamp)) +//! recomputeDerivedData(); +//! @endcode +//! +struct BRepGraph_VersionStamp +{ + //! Identity domain encoded in this stamp. + enum class Domain : uint8_t + { + None = 0, + Entity = 1, + Ref = 2 + }; + + BRepGraph_UID myUID; //!< Entity identity for entity-domain stamps. + BRepGraph_RefUID myRefUID; //!< Reference identity for ref-domain stamps. + uint32_t + myMutationGen; //!< OwnGen counter at snapshot time (maps to BaseDef::OwnGen / BaseRef::OwnGen). + uint32_t myGeneration; //!< Graph BRepGraph::Clear() generation at snapshot time. + Domain myDomain; //!< Active identity domain. + + //! Default constructor. Creates an invalid stamp (invalid UID, zero counters). + BRepGraph_VersionStamp() + : myMutationGen(0), + myGeneration(0), + myDomain(Domain::None) + { + } + + //! Construct an entity-domain stamp from components. + //! @param[in] theUID persistent entity identity + //! @param[in] theMutationGen OwnGen counter (own-data mutation counter) + //! @param[in] theGeneration graph BRepGraph::Clear() generation + BRepGraph_VersionStamp(const BRepGraph_UID& theUID, + const uint32_t theMutationGen, + const uint32_t theGeneration) + : myUID(theUID), + myMutationGen(theMutationGen), + myGeneration(theGeneration), + myDomain(Domain::Entity) + { + } + + //! Construct a reference-domain stamp from components. + //! @param[in] theRefUID persistent reference identity + //! @param[in] theMutationGen OwnGen counter (own-data mutation counter) + //! @param[in] theGeneration graph BRepGraph::Clear() generation + BRepGraph_VersionStamp(const BRepGraph_RefUID& theRefUID, + const uint32_t theMutationGen, + const uint32_t theGeneration) + : myRefUID(theRefUID), + myMutationGen(theMutationGen), + myGeneration(theGeneration), + myDomain(Domain::Ref) + { + } + + //! Check if the stamp has a valid identity in its domain. + [[nodiscard]] bool IsValid() const + { + if (myDomain == Domain::Entity) + return myUID.IsValid(); + if (myDomain == Domain::Ref) + return myRefUID.IsValid(); + return myUID.IsValid() || myRefUID.IsValid(); + } + + //! True when this is an entity-domain stamp. + [[nodiscard]] bool IsEntityStamp() const + { + if (myDomain == Domain::Entity) + return myUID.IsValid(); + return myDomain == Domain::None && myUID.IsValid() && !myRefUID.IsValid(); + } + + //! True when this is a reference-domain stamp. + [[nodiscard]] bool IsRefStamp() const + { + if (myDomain == Domain::Ref) + return myRefUID.IsValid(); + return myDomain == Domain::None && myRefUID.IsValid() && !myUID.IsValid(); + } + + //! Full equality: same domain, UID, OwnGen, and Generation. + //! Two invalid stamps are equal. + bool operator==(const BRepGraph_VersionStamp& theOther) const + { + if (!IsValid() && !theOther.IsValid()) + return true; + if (myDomain != theOther.myDomain) + return false; + if (myMutationGen != theOther.myMutationGen || myGeneration != theOther.myGeneration) + return false; + if (myDomain == Domain::Entity) + return myUID == theOther.myUID; + if (myDomain == Domain::Ref) + return myRefUID == theOther.myRefUID; + return myUID == theOther.myUID && myRefUID == theOther.myRefUID; + } + + bool operator!=(const BRepGraph_VersionStamp& theOther) const { return !(*this == theOther); } + + //! Check if two stamps refer to the same entity/reference regardless of version. + //! Compares active UID only, ignoring OwnGen and Generation. + //! @param[in] theOther stamp to compare with + //! @return true if both stamps have the same domain and UID + [[nodiscard]] bool IsSameNode(const BRepGraph_VersionStamp& theOther) const + { + if (myDomain != theOther.myDomain) + return false; + if (myDomain == Domain::Entity) + return myUID == theOther.myUID; + if (myDomain == Domain::Ref) + return myRefUID == theOther.myRefUID; + return myUID == theOther.myUID && myRefUID == theOther.myRefUID; + } + + //! Derive a deterministic Standard_GUID from this stamp. + //! The graph GUID is incorporated into the hash, making per-node GUIDs + //! globally unique across different graph instances. + //! One-way: cannot reconstruct stamp fields from the resulting GUID. + //! @param[in] theGraphGUID the owning graph's identity GUID + //! @return deterministic Standard_GUID derived from stamp + graph GUID + [[nodiscard]] Standard_EXPORT Standard_GUID ToGUID(const Standard_GUID& theGraphGUID) const; + + //! Compute hash value consistent with operator==. + //! @return hash combining active UID, domain, OwnGen, and Generation + [[nodiscard]] size_t HashValue() const + { + size_t aCombination[4]; + aCombination[0] = opencascade::hash(static_cast(myDomain)); + if (myDomain == Domain::Entity) + aCombination[1] = myUID.HashValue(); + else if (myDomain == Domain::Ref) + aCombination[1] = myRefUID.HashValue(); + else + aCombination[1] = opencascade::hash(0); + aCombination[2] = opencascade::hash(myMutationGen); + aCombination[3] = opencascade::hash(myGeneration); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; + +//! std::hash specialization for NCollection_DefaultHasher support. +template <> +struct std::hash +{ + size_t operator()(const BRepGraph_VersionStamp& theStamp) const noexcept + { + return theStamp.HashValue(); + } +}; + +#endif // _BRepGraph_VersionStamp_HeaderFile diff --git a/opencascade/BRepGraph_WireExplorer.hxx b/opencascade/BRepGraph_WireExplorer.hxx new file mode 100644 index 000000000..c2fb49c8a --- /dev/null +++ b/opencascade/BRepGraph_WireExplorer.hxx @@ -0,0 +1,215 @@ +// Copyright (c) 2026 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepGraph_WireExplorer_HeaderFile +#define _BRepGraph_WireExplorer_HeaderFile + +#include +#include +#include +#include +#include +#include + +class BRepGraph; + +//! @brief Iterator for traversing wire edges in connection order using graph data. +//! @see BRepGraph class comment "Iterator guide" for choosing between iterator types. +//! +//! Reorders wire coedges by vertex adjacency: the end vertex of each edge +//! matches the start vertex of the next. This is the graph equivalent of +//! BRepTools_WireExplorer, operating on pre-built BRepGraph data. +//! +//! The coedges are reordered on construction (O(N^2) worst case for N coedges). +//! For most wires this is fast since N is small (4-8 edges typically). +//! +//! Internal storage uses NCollection_LocalArray with stack allocation for +//! wires with up to 16 edges (the common case), falling back to heap for larger wires. +//! +//! Usage: +//! @code +//! BRepGraph_WireExplorer anExp(aGraph, aWireId); +//! for (; anExp.More(); anExp.Next()) +//! { +//! const BRepGraph_CoEdgeId aCoEdgeId = anExp.CurrentCoEdgeId(); +//! const BRepGraphInc::CoEdgeDef& aDef = aGraph.Topo().CoEdges().Definition(aCoEdgeId); +//! // ... use aDef ... +//! } +//! @endcode +class BRepGraph_WireExplorer +{ +public: + //! Initialize the explorer from a pre-built BRepGraph and wire identifier. + //! Collects coedge IDs from graph iterators and reorders them by vertex connectivity. + //! @param[in] theGraph pre-built BRepGraph (IsDone() == true) + //! @param[in] theWire wire definition identifier + BRepGraph_WireExplorer(const BRepGraph& theGraph, const BRepGraph_WireId theWire) + : myCurrent(0), + myLength(0) + { + buildOrder(theGraph, theWire); + } + + //! Returns true if there are more edges to iterate. + bool More() const { return myCurrent < myLength; } + + //! Advance to the next edge. + void Next() { ++myCurrent; } + + //! Reset the iterator to the beginning (for re-iteration). + void Reset() { myCurrent = 0; } + + //! Current coedge definition identifier in connection order. + BRepGraph_CoEdgeId CurrentCoEdgeId() const { return myOrder[myCurrent]; } + + //! Number of coedges in the ordered sequence. + int NbEdges() const { return myLength; } + + //! Current coedge identifier (alias for CurrentCoEdgeId(), enables range-for). + BRepGraph_CoEdgeId Current() const { return CurrentCoEdgeId(); } + + //! Returns an STL-compatible iterator for range-based for loops. + //! Yields BRepGraph_CoEdgeId values. + NCollection_ForwardRangeIterator begin() + { + return NCollection_ForwardRangeIterator(this); + } + + //! Returns a sentinel marking the end of iteration. + NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; } + +private: + //! Resolve the oriented start vertex of an edge. + static BRepGraph_NodeId orientedStartVertex(const BRepGraph& theGraph, + const BRepGraphInc::EdgeDef& theEdge, + const TopAbs_Orientation theOrientation) + { + const BRepGraph_VertexRefId aRefId = + (theOrientation == TopAbs_FORWARD) ? theEdge.StartVertexRefId : theEdge.EndVertexRefId; + if (!aRefId.IsValid()) + return BRepGraph_NodeId(); + return theGraph.Refs().Vertices().Entry(aRefId).VertexDefId; + } + + //! Resolve the oriented end vertex of an edge. + static BRepGraph_NodeId orientedEndVertex(const BRepGraph& theGraph, + const BRepGraphInc::EdgeDef& theEdge, + const TopAbs_Orientation theOrientation) + { + const BRepGraph_VertexRefId aRefId = + (theOrientation == TopAbs_FORWARD) ? theEdge.EndVertexRefId : theEdge.StartVertexRefId; + if (!aRefId.IsValid()) + return BRepGraph_NodeId(); + return theGraph.Refs().Vertices().Entry(aRefId).VertexDefId; + } + + //! Recursive backtracking chain: try to extend myOrder from theDepth onward, + //! picking each unused candidate whose oriented start matches the previous + //! oriented end. Returns true iff a full chain covering [0, theNbEdges) is built. + bool chainRecursive(const BRepGraph& theGraph, + const NCollection_LocalArray& theInput, + NCollection_LocalArray& theUsed, + const int theDepth, + const int theNbEdges) + { + if (theDepth == theNbEdges) + return true; + + const BRepGraphInc::CoEdgeDef& aPrevCoEdge = + theGraph.Topo().CoEdges().Definition(myOrder[theDepth - 1]); + const BRepGraphInc::EdgeDef& aPrevEdge = + theGraph.Topo().Edges().Definition(aPrevCoEdge.EdgeDefId); + const BRepGraph_NodeId aPrevEnd = + orientedEndVertex(theGraph, aPrevEdge, aPrevCoEdge.Orientation); + + for (int i = 0; i < theNbEdges; ++i) + { + if (theUsed[i]) + continue; + const BRepGraphInc::CoEdgeDef& aCandCoEdge = + theGraph.Topo().CoEdges().Definition(theInput[i]); + const BRepGraphInc::EdgeDef& aCandEdge = + theGraph.Topo().Edges().Definition(aCandCoEdge.EdgeDefId); + const BRepGraph_NodeId aCandStart = + orientedStartVertex(theGraph, aCandEdge, aCandCoEdge.Orientation); + + if (!aPrevEnd.IsValid() || !aCandStart.IsValid() || aPrevEnd != aCandStart) + continue; + + myOrder[theDepth] = theInput[i]; + theUsed[i] = true; + if (chainRecursive(theGraph, theInput, theUsed, theDepth + 1, theNbEdges)) + return true; + theUsed[i] = false; + } + return false; + } + + //! Build connection-ordered coedge sequence from graph data. + //! Uses greedy depth-first backtracking so that wires with ambiguous + //! continuations (e.g. cylinder lateral face with a seam pair) still produce + //! a fully connected chain whenever one exists. For pathologically disconnected + //! wires, remaining coedges are appended in input order. + void buildOrder(const BRepGraph& theGraph, const BRepGraph_WireId theWire) + { + int aNbEdges = 0; + for (BRepGraph_RefsCoEdgeOfWire aCountIt(theGraph, theWire); aCountIt.More(); aCountIt.Next()) + ++aNbEdges; + + if (aNbEdges == 0) + return; + + NCollection_LocalArray anInput(aNbEdges); + { + int anIdx = 0; + for (BRepGraph_RefsCoEdgeOfWire aCEIt(theGraph, theWire); aCEIt.More(); aCEIt.Next()) + { + const BRepGraphInc::CoEdgeRef& aCRef = theGraph.Refs().CoEdges().Entry(aCEIt.CurrentId()); + anInput[anIdx++] = aCRef.CoEdgeDefId; + } + } + + myOrder.Allocate(aNbEdges); + myLength = aNbEdges; + + NCollection_LocalArray aUsed(aNbEdges); + for (int i = 0; i < aNbEdges; ++i) + aUsed[i] = false; + + myOrder[0] = anInput[0]; + aUsed[0] = true; + + if (!chainRecursive(theGraph, anInput, aUsed, 1, aNbEdges)) + { + // Pathologically disconnected wire: append any unused coedges in input order. + for (int aPlaced = 1; aPlaced < aNbEdges; ++aPlaced) + { + for (int i = 0; i < aNbEdges; ++i) + { + if (!aUsed[i]) + { + myOrder[aPlaced] = anInput[i]; + aUsed[i] = true; + break; + } + } + } + } + } + + NCollection_LocalArray myOrder; //!< Ordered coedge IDs (stack for <=16). + int myCurrent; //!< Current iteration index. + int myLength; //!< Number of coedges. +}; + +#endif // _BRepGraph_WireExplorer_HeaderFile diff --git a/opencascade/BRepIntCurveSurface_Inter.hxx b/opencascade/BRepIntCurveSurface_Inter.hxx index ef49cceac..a5424568c 100644 --- a/opencascade/BRepIntCurveSurface_Inter.hxx +++ b/opencascade/BRepIntCurveSurface_Inter.hxx @@ -19,8 +19,11 @@ #include #include -#include -#include +#include +#include +#include +#include +#include #include class BRepTopAdaptor_TopolTool; @@ -46,7 +49,7 @@ class TopoDS_Face; //! for( i =1; i <= nbCurves;i++) //! { //! Inter.Init(curve); -//! for( ;Inter.More(); Inter.Next()) +//! for( ;Inter.More(); Inter.Next()) //! { //! ....... //! } @@ -63,23 +66,23 @@ public: //! tolerance used for the classification. Standard_EXPORT void Init(const TopoDS_Shape& theShape, const GeomAdaptor_Curve& theCurve, - const Standard_Real theTol); + const double theTol); //! Load the Shape, the curve and initialize the //! tolerance used for the classification. Standard_EXPORT void Init(const TopoDS_Shape& theShape, const gp_Lin& theLine, - const Standard_Real theTol); + const double theTol); //! Load the Shape, and initialize the //! tolerance used for the classification. - Standard_EXPORT void Load(const TopoDS_Shape& theShape, const Standard_Real theTol); + Standard_EXPORT void Load(const TopoDS_Shape& theShape, const double theTol); //! Method to find intersections of specified curve with loaded shape. Standard_EXPORT void Init(const GeomAdaptor_Curve& theCurve); //! returns True if there is a current face. - Standard_EXPORT Standard_Boolean More() const; + Standard_EXPORT bool More() const; //! Sets the next intersection point to check. Standard_EXPORT void Next(); @@ -92,15 +95,15 @@ public: //! returns the U parameter of the current point //! on the current face. - Standard_EXPORT Standard_Real U() const; + Standard_EXPORT double U() const; //! returns the V parameter of the current point //! on the current face. - Standard_EXPORT Standard_Real V() const; + Standard_EXPORT double V() const; //! returns the parameter of the current point //! on the curve. - Standard_EXPORT Standard_Real W() const; + Standard_EXPORT double W() const; //! returns the current state (IN or ON) Standard_EXPORT TopAbs_State State() const; @@ -116,25 +119,25 @@ protected: Standard_EXPORT void Find(); //! Method check found intersection point - Standard_EXPORT Standard_Boolean FindPoint(); + Standard_EXPORT bool FindPoint(); //! Method to clear fields of class Standard_EXPORT void Clear(); private: - Standard_Real myTolerance; - Handle(GeomAdaptor_Curve) myCurve; - IntCurveSurface_HInter myIntcs; - Standard_Integer myCurrentindex; - Standard_Integer myCurrentnbpoints; - Handle(BRepTopAdaptor_TopolTool) myFastClass; - TopAbs_State myCurrentstate; - Standard_Real myCurrentU; - Standard_Real myCurrentV; - Bnd_Box myCurveBox; - Standard_Integer myIndFace; - TopTools_SequenceOfShape myFaces; - Handle(Bnd_HArray1OfBox) myFaceBoxes; + double myTolerance; + occ::handle myCurve; + IntCurveSurface_HInter myIntcs; + int myCurrentindex; + int myCurrentnbpoints; + occ::handle myFastClass; + TopAbs_State myCurrentstate; + double myCurrentU; + double myCurrentV; + Bnd_Box myCurveBox; + int myIndFace; + NCollection_Sequence myFaces; + occ::handle> myFaceBoxes; }; #endif // _BRepIntCurveSurface_Inter_HeaderFile diff --git a/opencascade/BRepLProp.hxx b/opencascade/BRepLProp.hxx index 648a33254..43adac189 100644 --- a/opencascade/BRepLProp.hxx +++ b/opencascade/BRepLProp.hxx @@ -34,21 +34,21 @@ public: DEFINE_STANDARD_ALLOC //! Computes the regularity at the junction between C1 and - //! C2. The point u1 on C1 and the point u2 on C2 must be - //! confused. tl and ta are the linear and angular + //! C2. The point u1 on C1 and the point u2 on C2 must be + //! confused. tl and ta are the linear and angular //! tolerance used two compare the derivative. Standard_EXPORT static GeomAbs_Shape Continuity(const BRepAdaptor_Curve& C1, const BRepAdaptor_Curve& C2, - const Standard_Real u1, - const Standard_Real u2, - const Standard_Real tl, - const Standard_Real ta); + const double u1, + const double u2, + const double tl, + const double ta); //! The same as preceding but using the standard tolerances from package Precision. Standard_EXPORT static GeomAbs_Shape Continuity(const BRepAdaptor_Curve& C1, const BRepAdaptor_Curve& C2, - const Standard_Real u1, - const Standard_Real u2); + const double u1, + const double u2); }; #endif // _BRepLProp_HeaderFile diff --git a/opencascade/BRepLProp_CLProps.hxx b/opencascade/BRepLProp_CLProps.hxx index c9ce64d2f..67b464851 100644 --- a/opencascade/BRepLProp_CLProps.hxx +++ b/opencascade/BRepLProp_CLProps.hxx @@ -17,111 +17,10 @@ #ifndef _BRepLProp_CLProps_HeaderFile #define _BRepLProp_CLProps_HeaderFile -#include -#include - #include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class BRepAdaptor_Curve; -class gp_Vec; -class gp_Pnt; -class gp_Dir; -class BRepLProp_CurveTool; - -class BRepLProp_CLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the curve - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, 2 or 3). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const Standard_Integer N, - const Standard_Real Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value . - //! All the computations done will be related to and . - Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, - const Standard_Real U, - const Standard_Integer N, - const Standard_Real Resolution); - - //! Same as previous constructor but here the parameter is - //! set to the value and the curve is set - //! with SetCurve. - //! the curve can have a empty constructor - //! All the computations done will be related to and - //! when the functions "set" will be done. - Standard_EXPORT BRepLProp_CLProps(const Standard_Integer N, const Standard_Real Resolution); - - //! Initializes the local properties of the curve - //! for the parameter value . - Standard_EXPORT void SetParameter(const Standard_Real U); - - //! Initializes the local properties of the curve - //! for the new curve. - Standard_EXPORT void SetCurve(const BRepAdaptor_Curve& C); - - //! Returns the Point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1(); - - //! Returns the second derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2(); - - //! Returns the third derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D3(); - - //! Returns True if the tangent is defined. - //! For example, the tangent is not defined if the - //! three first derivatives are all null. - Standard_EXPORT Standard_Boolean IsTangentDefined(); - - //! output the tangent direction - Standard_EXPORT void Tangent(gp_Dir& D); - - //! Returns the curvature. - Standard_EXPORT Standard_Real Curvature(); - - //! Returns the normal direction . - Standard_EXPORT void Normal(gp_Dir& N); - - //! Returns the centre of curvature

. - Standard_EXPORT void CentreOfCurvature(gp_Pnt& P); +#include -protected: -private: - BRepAdaptor_Curve myCurve; - Standard_Real myU; - Standard_Integer myDerOrder; - Standard_Real myCN; - Standard_Real myLinTol; - gp_Pnt myPnt; - gp_Vec myDerivArr[3]; - gp_Dir myTangent; - Standard_Real myCurvature; - LProp_Status myTangentStatus; - Standard_Integer mySignificantFirstDerivativeOrder; -}; +//! Alias for curve local properties using BRepAdaptor_Curve. +using BRepLProp_CLProps = GeomLProp_CLPropsBase; #endif // _BRepLProp_CLProps_HeaderFile diff --git a/opencascade/BRepLProp_CurveTool.hxx b/opencascade/BRepLProp_CurveTool.hxx deleted file mode 100644 index fc2a744d0..000000000 --- a/opencascade/BRepLProp_CurveTool.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Created on: 1994-02-24 -// Created by: Laurent BOURESCHE -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _BRepLProp_CurveTool_HeaderFile -#define _BRepLProp_CurveTool_HeaderFile - -#include -#include - -#include -class BRepAdaptor_Curve; -class gp_Pnt; -class gp_Vec; - -class BRepLProp_CurveTool -{ -public: - DEFINE_STANDARD_ALLOC - - //! Computes the point

of parameter on the curve . - Standard_EXPORT static void Value(const BRepAdaptor_Curve& C, const Standard_Real U, gp_Pnt& P); - - //! Computes the point

and first derivative of - //! parameter on the curve . - Standard_EXPORT static void D1(const BRepAdaptor_Curve& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1); - - //! Computes the point

, the first derivative and second - //! derivative of parameter on the curve . - Standard_EXPORT static void D2(const BRepAdaptor_Curve& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2); - - //! Computes the point

, the first derivative , the - //! second derivative and third derivative of - //! parameter on the curve . - Standard_EXPORT static void D3(const BRepAdaptor_Curve& C, - const Standard_Real U, - gp_Pnt& P, - gp_Vec& V1, - gp_Vec& V2, - gp_Vec& V3); - - //! returns the order of continuity of the curve . - //! returns 1 : first derivative only is computable - //! returns 2 : first and second derivative only are computable. - //! returns 3 : first, second and third are computable. - Standard_EXPORT static Standard_Integer Continuity(const BRepAdaptor_Curve& C); - - //! returns the first parameter bound of the curve. - Standard_EXPORT static Standard_Real FirstParameter(const BRepAdaptor_Curve& C); - - //! returns the last parameter bound of the curve. - //! FirstParameter must be less than LastParamenter. - Standard_EXPORT static Standard_Real LastParameter(const BRepAdaptor_Curve& C); - -protected: -private: -}; - -#endif // _BRepLProp_CurveTool_HeaderFile diff --git a/opencascade/BRepLProp_SLProps.hxx b/opencascade/BRepLProp_SLProps.hxx index 5a73a8bbb..a3de40a10 100644 --- a/opencascade/BRepLProp_SLProps.hxx +++ b/opencascade/BRepLProp_SLProps.hxx @@ -17,160 +17,10 @@ #ifndef _BRepLProp_SLProps_HeaderFile #define _BRepLProp_SLProps_HeaderFile -#include -#include - #include -#include -#include -#include -#include -#include -class LProp_BadContinuity; -class Standard_DomainError; -class Standard_OutOfRange; -class LProp_NotDefined; -class BRepAdaptor_Surface; -class BRepLProp_SurfaceTool; -class gp_Pnt; -class gp_Vec; -class gp_Dir; - -class BRepLProp_SLProps -{ -public: - DEFINE_STANDARD_ALLOC - - //! Initializes the local properties of the surface - //! for the parameter values (, ). - //! The current point and the derivatives are - //! computed at the same time, which allows an - //! optimization of the computation time. - //! indicates the maximum number of derivations to - //! be done (0, 1, or 2). For example, to compute - //! only the tangent, N should be equal to 1. - //! is the linear tolerance (it is used to test - //! if a vector is null). - Standard_EXPORT BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, - const Standard_Integer N, - const Standard_Real Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and . - Standard_EXPORT BRepLProp_SLProps(const BRepAdaptor_Surface& S, - const Standard_Integer N, - const Standard_Real Resolution); - - //! idem as previous constructor but without setting the value - //! of parameters and and the surface. - //! the surface can have an empty constructor. - Standard_EXPORT BRepLProp_SLProps(const Standard_Integer N, const Standard_Real Resolution); - - //! Initializes the local properties of the surface S - //! for the new surface. - Standard_EXPORT void SetSurface(const BRepAdaptor_Surface& S); - - //! Initializes the local properties of the surface S - //! for the new parameter values (, ). - Standard_EXPORT void SetParameters(const Standard_Real U, const Standard_Real V); - - //! Returns the point. - Standard_EXPORT const gp_Pnt& Value() const; - - //! Returns the first U derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1U(); - - //! Returns the first V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D1V(); - - //! Returns the second U derivatives - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2U(); - - //! Returns the second V derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& D2V(); - - //! Returns the second UV cross-derivative. - //! The derivative is computed if it has not been yet. - Standard_EXPORT const gp_Vec& DUV(); - - //! returns True if the U tangent is defined. - //! For example, the tangent is not defined if the - //! two first U derivatives are null. - Standard_EXPORT Standard_Boolean IsTangentUDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentU(gp_Dir& D); - - //! returns if the V tangent is defined. - //! For example, the tangent is not defined if the - //! two first V derivatives are null. - Standard_EXPORT Standard_Boolean IsTangentVDefined(); - - //! Returns the tangent direction on the iso-V. - Standard_EXPORT void TangentV(gp_Dir& D); - - //! Tells if the normal is defined. - Standard_EXPORT Standard_Boolean IsNormalDefined(); - - //! Returns the normal direction. - Standard_EXPORT const gp_Dir& Normal(); - - //! returns True if the curvature is defined. - Standard_EXPORT Standard_Boolean IsCurvatureDefined(); - - //! returns True if the point is umbilic (i.e. if the - //! curvature is constant). - Standard_EXPORT Standard_Boolean IsUmbilic(); - - //! Returns the maximum curvature - Standard_EXPORT Standard_Real MaxCurvature(); - - //! Returns the minimum curvature - Standard_EXPORT Standard_Real MinCurvature(); - - //! Returns the direction of the maximum and minimum curvature - //! and - Standard_EXPORT void CurvatureDirections(gp_Dir& MaxD, gp_Dir& MinD); - - //! Returns the mean curvature. - Standard_EXPORT Standard_Real MeanCurvature(); - - //! Returns the Gaussian curvature - Standard_EXPORT Standard_Real GaussianCurvature(); +#include -protected: -private: - BRepAdaptor_Surface mySurf; - Standard_Real myU; - Standard_Real myV; - Standard_Integer myDerOrder; - Standard_Integer myCN; - Standard_Real myLinTol; - gp_Pnt myPnt; - gp_Vec myD1u; - gp_Vec myD1v; - gp_Vec myD2u; - gp_Vec myD2v; - gp_Vec myDuv; - gp_Dir myNormal; - Standard_Real myMinCurv; - Standard_Real myMaxCurv; - gp_Dir myDirMinCurv; - gp_Dir myDirMaxCurv; - Standard_Real myMeanCurv; - Standard_Real myGausCurv; - Standard_Integer mySignificantFirstDerivativeOrderU; - Standard_Integer mySignificantFirstDerivativeOrderV; - LProp_Status myUTangentStatus; - LProp_Status myVTangentStatus; - LProp_Status myNormalStatus; - LProp_Status myCurvatureStatus; -}; +//! Alias for surface local properties using BRepAdaptor_Surface. +using BRepLProp_SLProps = GeomLProp_SLPropsBase; #endif // _BRepLProp_SLProps_HeaderFile diff --git a/opencascade/BRepLProp_SurfaceTool.hxx b/opencascade/BRepLProp_SurfaceTool.hxx index f041eeb98..f78102830 100644 --- a/opencascade/BRepLProp_SurfaceTool.hxx +++ b/opencascade/BRepLProp_SurfaceTool.hxx @@ -33,15 +33,15 @@ public: //! Computes the point

of parameter and on the //! Surface . Standard_EXPORT static void Value(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P); //! Computes the point

and first derivative of //! parameter and on the Surface . Standard_EXPORT static void D1(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V); @@ -49,8 +49,8 @@ public: //! Computes the point

, the first derivative and second //! derivative of parameter and on the Surface . Standard_EXPORT static void D2(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, + const double U, + const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, @@ -59,25 +59,22 @@ public: gp_Vec& DUV); Standard_EXPORT static gp_Vec DN(const BRepAdaptor_Surface& S, - const Standard_Real U, - const Standard_Real V, - const Standard_Integer IU, - const Standard_Integer IV); + const double U, + const double V, + const int IU, + const int IV); //! returns the order of continuity of the Surface . //! returns 1 : first derivative only is computable //! returns 2 : first and second derivative only are computable. - Standard_EXPORT static Standard_Integer Continuity(const BRepAdaptor_Surface& S); + Standard_EXPORT static int Continuity(const BRepAdaptor_Surface& S); //! returns the bounds of the Surface. Standard_EXPORT static void Bounds(const BRepAdaptor_Surface& S, - Standard_Real& U1, - Standard_Real& V1, - Standard_Real& U2, - Standard_Real& V2); - -protected: -private: + double& U1, + double& V1, + double& U2, + double& V2); }; #endif // _BRepLProp_SurfaceTool_HeaderFile diff --git a/opencascade/BRepLib.hxx b/opencascade/BRepLib.hxx index af82fe5c3..3bd02c038 100644 --- a/opencascade/BRepLib.hxx +++ b/opencascade/BRepLib.hxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include class Geom2d_Curve; @@ -52,25 +52,25 @@ public: //! Computes the max distance between edge //! and its 2d representation on the face. - //! Sets the default precision. The current Precision + //! Sets the default precision. The current Precision //! is returned. - Standard_EXPORT static void Precision(const Standard_Real P); + Standard_EXPORT static void Precision(const double P); //! Returns the default precision. - Standard_EXPORT static Standard_Real Precision(); + Standard_EXPORT static double Precision(); //! Sets the current plane to P. - Standard_EXPORT static void Plane(const Handle(Geom_Plane)& P); + Standard_EXPORT static void Plane(const occ::handle& P); //! Returns the current plane. - Standard_EXPORT static const Handle(Geom_Plane)& Plane(); + Standard_EXPORT static const occ::handle& Plane(); //! checks if the Edge is same range IGNORING //! the same range flag of the edge //! Confusion argument is to compare real numbers //! idenpendently of any model space tolerance - Standard_EXPORT static Standard_Boolean CheckSameRange(const TopoDS_Edge& E, - const Standard_Real Confusion = 1.0e-12); + Standard_EXPORT static bool CheckSameRange(const TopoDS_Edge& E, + const double Confusion = 1.0e-12); //! will make all the curve representation have //! the same range domain for the parameters. @@ -80,32 +80,31 @@ public: //! range of that curve. If not the first curve representation //! encountered in the list will give its range to //! the all the other curves. - Standard_EXPORT static void SameRange(const TopoDS_Edge& E, - const Standard_Real Tolerance = 1.0e-5); + Standard_EXPORT static void SameRange(const TopoDS_Edge& E, const double Tolerance = 1.0e-5); - //! Computes the 3d curve for the edge if it does - //! not exist. Returns True if the curve was computed - //! or existed. Returns False if there is no planar + //! Computes the 3d curve for the edge if it does + //! not exist. Returns True if the curve was computed + //! or existed. Returns False if there is no planar //! pcurve or the computation failed. //! >= 30 in approximation - Standard_EXPORT static Standard_Boolean BuildCurve3d(const TopoDS_Edge& E, - const Standard_Real Tolerance = 1.0e-5, - const GeomAbs_Shape Continuity = GeomAbs_C1, - const Standard_Integer MaxDegree = 14, - const Standard_Integer MaxSegment = 0); + Standard_EXPORT static bool BuildCurve3d(const TopoDS_Edge& E, + const double Tolerance = 1.0e-5, + const GeomAbs_Shape Continuity = GeomAbs_C1, + const int MaxDegree = 14, + const int MaxSegment = 0); - //! Computes the 3d curves for all the edges of + //! Computes the 3d curves for all the edges of //! return False if one of the computation failed. //! >= 30 in approximation - Standard_EXPORT static Standard_Boolean BuildCurves3d(const TopoDS_Shape& S, - const Standard_Real Tolerance, - const GeomAbs_Shape Continuity = GeomAbs_C1, - const Standard_Integer MaxDegree = 14, - const Standard_Integer MaxSegment = 0); + Standard_EXPORT static bool BuildCurves3d(const TopoDS_Shape& S, + const double Tolerance, + const GeomAbs_Shape Continuity = GeomAbs_C1, + const int MaxDegree = 14, + const int MaxSegment = 0); - //! Computes the 3d curves for all the edges of + //! Computes the 3d curves for all the edges of //! return False if one of the computation failed. - Standard_EXPORT static Standard_Boolean BuildCurves3d(const TopoDS_Shape& S); + Standard_EXPORT static bool BuildCurves3d(const TopoDS_Shape& S); //! Builds pcurve of edge on face if the surface is plane, and updates the edge. Standard_EXPORT static void BuildPCurveForEdgeOnPlane(const TopoDS_Edge& theE, @@ -113,10 +112,10 @@ public: //! Builds pcurve of edge on face if the surface is plane, but does not update the edge. //! The output are the pcurve and the flag telling that pcurve was built. - Standard_EXPORT static void BuildPCurveForEdgeOnPlane(const TopoDS_Edge& theE, - const TopoDS_Face& theF, - Handle(Geom2d_Curve)& aC2D, - Standard_Boolean& bToUpdate); + Standard_EXPORT static void BuildPCurveForEdgeOnPlane(const TopoDS_Edge& theE, + const TopoDS_Face& theF, + occ::handle& aC2D, + bool& bToUpdate); //! Builds pcurves of edges on face if the surface is plane, and update the edges. template @@ -130,153 +129,150 @@ public: } } - //! Checks if the edge has a Tolerance smaller than -- -- - //! -- -- MaxToleranceToCheck if so it will compute the - //! radius of -- the cylindrical pipe surface that + //! Checks if the edge has a Tolerance smaller than + //! MaxToleranceToCheck if so it will compute the + //! radius of the cylindrical pipe surface that //! MinToleranceRequest is the minimum tolerance before it //! is useful to start testing. //! Usually it should be around 10e-5 - //! contains all -- the curve representation of the edge + //! contains all the curve representation of the edge //! returns True if the Edge tolerance had to be updated - Standard_EXPORT static Standard_Boolean UpdateEdgeTol(const TopoDS_Edge& E, - const Standard_Real MinToleranceRequest, - const Standard_Real MaxToleranceToCheck); + Standard_EXPORT static bool UpdateEdgeTol(const TopoDS_Edge& E, + const double MinToleranceRequest, + const double MaxToleranceToCheck); - //! -- Checks all the edges of the shape whose -- -- -- - //! Tolerance is smaller than MaxToleranceToCheck -- - //! Returns True if at least one edge was updated -- + //! Checks all the edges of the shape whose + //! Tolerance is smaller than MaxToleranceToCheck + //! Returns True if at least one edge was updated //! MinToleranceRequest is the minimum tolerance before - //! -- it -- is useful to start testing. - //! Usually it should be around -- 10e-5-- + //! it is useful to start testing. + //! Usually it should be around 10e-5 //! - //! Warning :The method is very slow as it checks all. - //! Use only in interfaces or processing assimilate batch - Standard_EXPORT static Standard_Boolean UpdateEdgeTolerance( - const TopoDS_Shape& S, - const Standard_Real MinToleranceRequest, - const Standard_Real MaxToleranceToCheck); - - //! Computes new 2d curve(s) for the edge to have - //! the same parameter as the 3d curve. + //! Warning: The method is very slow as it checks all. + //! Use only in interfaces or processing assimilate batch + Standard_EXPORT static bool UpdateEdgeTolerance(const TopoDS_Shape& S, + const double MinToleranceRequest, + const double MaxToleranceToCheck); + + //! Computes new 2d curve(s) for the edge to have + //! the same parameter as the 3d curve. //! The algorithm is not done if the flag SameParameter - //! was True on the Edge. - Standard_EXPORT static void SameParameter(const TopoDS_Edge& theEdge, - const Standard_Real Tolerance = 1.0e-5); + //! was True on the Edge. + Standard_EXPORT static void SameParameter(const TopoDS_Edge& theEdge, + const double Tolerance = 1.0e-5); - //! Computes new 2d curve(s) for the edge to have - //! the same parameter as the 3d curve. + //! Computes new 2d curve(s) for the edge to have + //! the same parameter as the 3d curve. //! The algorithm is not done if the flag SameParameter - //! was True on the Edge.
+ //! was True on the Edge. //! theNewTol is a new tolerance of vertices of the input edge //! (not applied inside the algorithm, but pre-computed). //! If IsUseOldEdge is true then the input edge will be modified, //! otherwise the new copy of input edge will be created. //! Returns the new edge as a result, can be ignored if IsUseOldEdge is true. - Standard_EXPORT static TopoDS_Edge SameParameter(const TopoDS_Edge& theEdge, - const Standard_Real theTolerance, - Standard_Real& theNewTol, - const Standard_Boolean IsUseOldEdge); + Standard_EXPORT static TopoDS_Edge SameParameter(const TopoDS_Edge& theEdge, + const double theTolerance, + double& theNewTol, + const bool IsUseOldEdge); - //! Computes new 2d curve(s) for all the edges of - //! to have the same parameter as the 3d curve. + //! Computes new 2d curve(s) for all the edges of + //! to have the same parameter as the 3d curve. //! The algorithm is not done if the flag SameParameter - //! was True on an Edge. - Standard_EXPORT static void SameParameter(const TopoDS_Shape& S, - const Standard_Real Tolerance = 1.0e-5, - const Standard_Boolean forced = Standard_False); + //! was True on an Edge. + Standard_EXPORT static void SameParameter(const TopoDS_Shape& S, + const double Tolerance = 1.0e-5, + const bool forced = false); - //! Computes new 2d curve(s) for all the edges of - //! to have the same parameter as the 3d curve. + //! Computes new 2d curve(s) for all the edges of + //! to have the same parameter as the 3d curve. //! The algorithm is not done if the flag SameParameter - //! was True on an Edge.
+ //! was True on an Edge. //! theReshaper is used to record the modifications of input shape to prevent any //! modifications on the shape itself. //! Thus the input shape (and its subshapes) will not be modified, instead the reshaper will //! contain a modified empty-copies of original subshapes as substitutions. - Standard_EXPORT static void SameParameter(const TopoDS_Shape& S, - BRepTools_ReShape& theReshaper, - const Standard_Real Tolerance = 1.0e-5, - const Standard_Boolean forced = Standard_False); + Standard_EXPORT static void SameParameter(const TopoDS_Shape& S, + BRepTools_ReShape& theReshaper, + const double Tolerance = 1.0e-5, + const bool forced = false); - //! Replaces tolerance of FACE EDGE VERTEX by the + //! Replaces tolerance of FACE EDGE VERTEX by the //! tolerance Max of their connected handling shapes. //! It is not necessary to use this call after //! SameParameter. (called in) - Standard_EXPORT static void UpdateTolerances( - const TopoDS_Shape& S, - const Standard_Boolean verifyFaceTolerance = Standard_False); + Standard_EXPORT static void UpdateTolerances(const TopoDS_Shape& S, + const bool verifyFaceTolerance = false); - //! Replaces tolerance of FACE EDGE VERTEX by the + //! Replaces tolerance of FACE EDGE VERTEX by the //! tolerance Max of their connected handling shapes. //! It is not necessary to use this call after - //! SameParameter. (called in)
+ //! SameParameter. (called in) //! theReshaper is used to record the modifications of input shape to prevent any //! modifications on the shape itself. //! Thus the input shape (and its subshapes) will not be modified, instead the reshaper will //! contain a modified empty-copies of original subshapes as substitutions. - Standard_EXPORT static void UpdateTolerances( - const TopoDS_Shape& S, - BRepTools_ReShape& theReshaper, - const Standard_Boolean verifyFaceTolerance = Standard_False); + Standard_EXPORT static void UpdateTolerances(const TopoDS_Shape& S, + BRepTools_ReShape& theReshaper, + const bool verifyFaceTolerance = false); //! Checks tolerances of edges (including inner points) and vertices //! of a shape and updates them to satisfy "SameParameter" condition Standard_EXPORT static void UpdateInnerTolerances(const TopoDS_Shape& S); - //! Orients the solid forward and the shell with the - //! orientation to have matter in the solid. Returns + //! Orients the solid forward and the shell with the + //! orientation to have matter in the solid. Returns //! False if the solid is unOrientable (open or incoherent) - Standard_EXPORT static Standard_Boolean OrientClosedSolid(TopoDS_Solid& solid); + Standard_EXPORT static bool OrientClosedSolid(TopoDS_Solid& solid); //! Returns the order of continuity between two faces //! connected by an edge - Standard_EXPORT static GeomAbs_Shape ContinuityOfFaces(const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace1, - const TopoDS_Face& theFace2, - const Standard_Real theAngleTol); + Standard_EXPORT static GeomAbs_Shape ContinuityOfFaces(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace1, + const TopoDS_Face& theFace2, + const double theAngleTol); //! Encodes the Regularity of edges on a Shape. //! Warning: is an angular tolerance, expressed in Rad. //! Warning: If the edges's regularity are coded before, nothing //! is done. Standard_EXPORT static void EncodeRegularity(const TopoDS_Shape& S, - const Standard_Real TolAng = 1.0e-10); + const double TolAng = 1.0e-10); //! Encodes the Regularity of edges in list on the shape //! Warning: is an angular tolerance, expressed in Rad. //! Warning: If the edges's regularity are coded before, nothing //! is done. - Standard_EXPORT static void EncodeRegularity(const TopoDS_Shape& S, - const TopTools_ListOfShape& LE, - const Standard_Real TolAng = 1.0e-10); + Standard_EXPORT static void EncodeRegularity(const TopoDS_Shape& S, + const NCollection_List& LE, + const double TolAng = 1.0e-10); //! Encodes the Regularity between and by //! Warning: is an angular tolerance, expressed in Rad. //! Warning: If the edge's regularity is coded before, nothing //! is done. - Standard_EXPORT static void EncodeRegularity(TopoDS_Edge& E, - const TopoDS_Face& F1, - const TopoDS_Face& F2, - const Standard_Real TolAng = 1.0e-10); + Standard_EXPORT static void EncodeRegularity(TopoDS_Edge& E, + const TopoDS_Face& F1, + const TopoDS_Face& F2, + const double TolAng = 1.0e-10); - //! Sorts in LF the Faces of S on the complexity of - //! their surfaces + //! Sorts in LF the Faces of S on the complexity of + //! their surfaces //! (Plane,Cylinder,Cone,Sphere,Torus,other) - Standard_EXPORT static void SortFaces(const TopoDS_Shape& S, TopTools_ListOfShape& LF); + Standard_EXPORT static void SortFaces(const TopoDS_Shape& S, NCollection_List& LF); - //! Sorts in LF the Faces of S on the reverse - //! complexity of their surfaces + //! Sorts in LF the Faces of S on the reverse + //! complexity of their surfaces //! (other,Torus,Sphere,Cone,Cylinder,Plane) - Standard_EXPORT static void ReverseSortFaces(const TopoDS_Shape& S, TopTools_ListOfShape& LF); + Standard_EXPORT static void ReverseSortFaces(const TopoDS_Shape& S, + NCollection_List& LF); //! Corrects the normals in Poly_Triangulation of faces, //! in such way that normals at nodes lying along smooth //! edges have the same value on both adjacent triangulations. //! Returns TRUE if any correction is done. - Standard_EXPORT static Standard_Boolean EnsureNormalConsistency( - const TopoDS_Shape& S, - const Standard_Real theAngTol = 0.001, - const Standard_Boolean ForceComputeNormals = Standard_False); + Standard_EXPORT static bool EnsureNormalConsistency(const TopoDS_Shape& S, + const double theAngTol = 0.001, + const bool ForceComputeNormals = false); //! Updates value of deflection in Poly_Triangulation of faces //! by the maximum deviation measured on existing triangulation. @@ -288,30 +284,30 @@ public: //! other vertices. Standard_EXPORT static void BoundingVertex(const NCollection_List& theLV, gp_Pnt& theNewCenter, - Standard_Real& theNewTol); + double& theNewTol); //! For an edge defined by 3d curve and tolerance and vertices defined by points, //! parameters on curve and tolerances, //! finds a range of curve between vertices not covered by vertices tolerances. //! Returns false if there is no such range. Otherwise, sets theFirst and //! theLast as its bounds. - Standard_EXPORT static Standard_Boolean FindValidRange(const Adaptor3d_Curve& theCurve, - const Standard_Real theTolE, - const Standard_Real theParV1, - const gp_Pnt& thePntV1, - const Standard_Real theTolV1, - const Standard_Real theParV2, - const gp_Pnt& thePntV2, - const Standard_Real theTolV2, - Standard_Real& theFirst, - Standard_Real& theLast); + Standard_EXPORT static bool FindValidRange(const Adaptor3d_Curve& theCurve, + const double theTolE, + const double theParV1, + const gp_Pnt& thePntV1, + const double theTolV1, + const double theParV2, + const gp_Pnt& thePntV2, + const double theTolV2, + double& theFirst, + double& theLast); //! Finds a range of 3d curve of the edge not covered by vertices tolerances. //! Returns false if there is no such range. Otherwise, sets theFirst and //! theLast as its bounds. - Standard_EXPORT static Standard_Boolean FindValidRange(const TopoDS_Edge& theEdge, - Standard_Real& theFirst, - Standard_Real& theLast); + Standard_EXPORT static bool FindValidRange(const TopoDS_Edge& theEdge, + double& theFirst, + double& theLast); //! Enlarges the face on the given value. //! @param[in] theF The face to extend @@ -321,13 +317,13 @@ public: //! @param[in] theExtVMin Defines whether to extend the face in VMin direction //! @param[in] theExtVMax Defines whether to extend the face in VMax direction //! @param[in] theFExtended The extended face - Standard_EXPORT static void ExtendFace(const TopoDS_Face& theF, - const Standard_Real theExtVal, - const Standard_Boolean theExtUMin, - const Standard_Boolean theExtUMax, - const Standard_Boolean theExtVMin, - const Standard_Boolean theExtVMax, - TopoDS_Face& theFExtended); + Standard_EXPORT static void ExtendFace(const TopoDS_Face& theF, + const double theExtVal, + const bool theExtUMin, + const bool theExtUMax, + const bool theExtVMin, + const bool theExtVMax, + TopoDS_Face& theFExtended); }; #endif // _BRepLib_HeaderFile diff --git a/opencascade/BRepLib_CheckCurveOnSurface.hxx b/opencascade/BRepLib_CheckCurveOnSurface.hxx index e8090b1f1..a23953337 100644 --- a/opencascade/BRepLib_CheckCurveOnSurface.hxx +++ b/opencascade/BRepLib_CheckCurveOnSurface.hxx @@ -27,7 +27,7 @@ public: //! Default constructor BRepLib_CheckCurveOnSurface() - : myIsParallel(Standard_False) + : myIsParallel(false) { } @@ -39,17 +39,17 @@ public: Standard_EXPORT void Init(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); //! Performs the calculation - //! If myIsParallel == Standard_True then computation will be performed in parallel. + //! If myIsParallel == true then computation will be performed in parallel. Standard_EXPORT void Perform(); //! Returns true if the max distance has been found - Standard_Boolean IsDone() const { return myCOnSurfGeom.ErrorStatus() == 0; } + bool IsDone() const { return myCOnSurfGeom.ErrorStatus() == 0; } //! Sets parallel flag - void SetParallel(const Standard_Boolean theIsParallel) { myIsParallel = theIsParallel; } + void SetParallel(const bool theIsParallel) { myIsParallel = theIsParallel; } //! Returns true if parallel flag is set - Standard_Boolean IsParallel() { return myIsParallel; } + bool IsParallel() { return myIsParallel; } //! Returns error status //! The possible values are: @@ -57,25 +57,25 @@ public: //! 1 - null curve or surface or 2d curve; //! 2 - invalid parametric range; //! 3 - error in calculations. - Standard_Integer ErrorStatus() const { return myCOnSurfGeom.ErrorStatus(); } + int ErrorStatus() const { return myCOnSurfGeom.ErrorStatus(); } //! Returns max distance - Standard_Real MaxDistance() const { return myCOnSurfGeom.MaxDistance(); } + double MaxDistance() const { return myCOnSurfGeom.MaxDistance(); } //! Returns parameter in which the distance is maximal - Standard_Real MaxParameter() const { return myCOnSurfGeom.MaxParameter(); } + double MaxParameter() const { return myCOnSurfGeom.MaxParameter(); } protected: //! Computes the max distance for the 3d curve of //! and 2d curve - //! If isMultiThread == Standard_True then computation will be performed in parallel. - Standard_EXPORT void Compute(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface); + //! If isMultiThread == true then computation will be performed in parallel. + Standard_EXPORT void Compute(const occ::handle& theCurveOnSurface); private: - GeomLib_CheckCurveOnSurface myCOnSurfGeom; - Handle(Adaptor3d_CurveOnSurface) myAdaptorCurveOnSurface; - Handle(Adaptor3d_CurveOnSurface) myAdaptorCurveOnSurface2; - Standard_Boolean myIsParallel; + GeomLib_CheckCurveOnSurface myCOnSurfGeom; + occ::handle myAdaptorCurveOnSurface; + occ::handle myAdaptorCurveOnSurface2; + bool myIsParallel; }; #endif // _BRepLib_CheckCurveOnSurface_HeaderFile diff --git a/opencascade/BRepLib_Command.hxx b/opencascade/BRepLib_Command.hxx index 0c21b4c82..008d1224c 100644 --- a/opencascade/BRepLib_Command.hxx +++ b/opencascade/BRepLib_Command.hxx @@ -39,7 +39,7 @@ public: Standard_EXPORT virtual ~BRepLib_Command(); - Standard_EXPORT Standard_Boolean IsDone() const; + Standard_EXPORT bool IsDone() const; //! Raises NotDone if done is false. Standard_EXPORT void Check() const; @@ -55,7 +55,7 @@ protected: Standard_EXPORT void NotDone(); private: - Standard_Boolean myDone; + bool myDone; }; #endif // _BRepLib_Command_HeaderFile diff --git a/opencascade/BRepLib_FindSurface.hxx b/opencascade/BRepLib_FindSurface.hxx index 80e6abc13..5c014309f 100644 --- a/opencascade/BRepLib_FindSurface.hxx +++ b/opencascade/BRepLib_FindSurface.hxx @@ -25,25 +25,25 @@ class Geom_Surface; class TopoDS_Shape; -//! Provides an algorithm to find a Surface through a +//! Provides an algorithm to find a Surface through a //! set of edges. //! -//! The edges of the shape given as argument are -//! explored if they are not coplanar at the required -//! tolerance the method Found returns false. +//! The edges of the shape given as argument are +//! explored if they are not coplanar at the required +//! tolerance the method Found returns false. //! -//! If a null tolerance is given the max of the edges +//! If a null tolerance is given the max of the edges //! tolerances is used. //! -//! The method Tolerance returns the true distance of +//! The method Tolerance returns the true distance of //! the edges to the Surface. //! //! The method Surface returns the Surface if found. //! -//! The method Existed returns returns True if the +//! The method Existed returns True if the //! Surface was already attached to some of the edges. //! -//! When Existed returns True the Surface may have a +//! When Existed returns True the Surface may have a //! location given by the Location method. class BRepLib_FindSurface { @@ -52,51 +52,50 @@ public: Standard_EXPORT BRepLib_FindSurface(); - //! Computes the Surface from the edges of with the + //! Computes the Surface from the edges of with the //! given tolerance. //! if is true, the computed surface will be //! a plane. If it is not possible to find a plane, the //! flag NotDone will be set. - //! If is true, then S should be a wire - //! and the existing surface, on which wire S is not + //! If is true, then S should be a wire + //! and the existing surface, on which wire S is not //! closed in 2D, will be ignored. - Standard_EXPORT BRepLib_FindSurface(const TopoDS_Shape& S, - const Standard_Real Tol = -1, - const Standard_Boolean OnlyPlane = Standard_False, - const Standard_Boolean OnlyClosed = Standard_False); + Standard_EXPORT BRepLib_FindSurface(const TopoDS_Shape& S, + const double Tol = -1, + const bool OnlyPlane = false, + const bool OnlyClosed = false); - //! Computes the Surface from the edges of with the + //! Computes the Surface from the edges of with the //! given tolerance. //! if is true, the computed surface will be //! a plane. If it is not possible to find a plane, the //! flag NotDone will be set. - //! If is true, then S should be a wire - //! and the existing surface, on which wire S is not + //! If is true, then S should be a wire + //! and the existing surface, on which wire S is not //! closed in 2D, will be ignored. - Standard_EXPORT void Init(const TopoDS_Shape& S, - const Standard_Real Tol = -1, - const Standard_Boolean OnlyPlane = Standard_False, - const Standard_Boolean OnlyClosed = Standard_False); + Standard_EXPORT void Init(const TopoDS_Shape& S, + const double Tol = -1, + const bool OnlyPlane = false, + const bool OnlyClosed = false); - Standard_EXPORT Standard_Boolean Found() const; + Standard_EXPORT bool Found() const; - Standard_EXPORT Handle(Geom_Surface) Surface() const; + Standard_EXPORT occ::handle Surface() const; - Standard_EXPORT Standard_Real Tolerance() const; + Standard_EXPORT double Tolerance() const; - Standard_EXPORT Standard_Real ToleranceReached() const; + Standard_EXPORT double ToleranceReached() const; - Standard_EXPORT Standard_Boolean Existed() const; + Standard_EXPORT bool Existed() const; Standard_EXPORT TopLoc_Location Location() const; -protected: private: - Handle(Geom_Surface) mySurface; - Standard_Real myTolerance; - Standard_Real myTolReached; - Standard_Boolean isExisted; - TopLoc_Location myLocation; + occ::handle mySurface; + double myTolerance; + double myTolReached; + bool isExisted; + TopLoc_Location myLocation; }; #endif // _BRepLib_FindSurface_HeaderFile diff --git a/opencascade/BRepLib_FuseEdges.hxx b/opencascade/BRepLib_FuseEdges.hxx index 7ffbec403..08331b519 100644 --- a/opencascade/BRepLib_FuseEdges.hxx +++ b/opencascade/BRepLib_FuseEdges.hxx @@ -20,24 +20,23 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include class TopoDS_Vertex; class TopoDS_Edge; -//! This class can detect vertices in a face that can +//! This class can detect vertices in a face that can //! be considered useless and then perform the fuse of -//! the edges and remove the useless vertices. By -//! useles vertices, we mean : -//! * vertices that have exactly two connex edges +//! the edges and remove the useless vertices. By +//! useles vertices, we mean: +//! * vertices that have exactly two connex edges //! * the edges connex to the vertex must have -//! exactly the same 2 connex faces . +//! exactly the same 2 connex faces. //! * The edges connex to the vertex must have the //! same geometric support. class BRepLib_FuseEdges @@ -45,79 +44,83 @@ class BRepLib_FuseEdges public: DEFINE_STANDARD_ALLOC - //! Initialise members and build construction of map + //! Initialise members and build construction of map //! of ancestors. - Standard_EXPORT BRepLib_FuseEdges(const TopoDS_Shape& theShape, - const Standard_Boolean PerformNow = Standard_False); + Standard_EXPORT BRepLib_FuseEdges(const TopoDS_Shape& theShape, const bool PerformNow = false); //! set edges to avoid being fused - Standard_EXPORT void AvoidEdges(const TopTools_IndexedMapOfShape& theMapEdg); + Standard_EXPORT void AvoidEdges( + const NCollection_IndexedMap& theMapEdg); //! set mode to enable concatenation G1 BSpline edges in one - //! End Modified by IFV 19.04.07 - Standard_EXPORT void SetConcatBSpl(const Standard_Boolean theConcatBSpl = Standard_True); + //! End Modified by IFV 19.04.07 + Standard_EXPORT void SetConcatBSpl(const bool theConcatBSpl = true); - //! returns all the list of edges to be fused + //! returns all the list of edges to be fused //! each list of the map represent a set of connex edges //! that can be fused. - Standard_EXPORT void Edges(TopTools_DataMapOfIntegerListOfShape& theMapLstEdg); + Standard_EXPORT void Edges( + NCollection_DataMap>& theMapLstEdg); //! returns all the fused edges. each integer entry in - //! the map corresponds to the integer in the - //! DataMapOfIntegerListOfShape we get in method - //! Edges. That is to say, to the list of edges in + //! the map corresponds to the integer in the + //! DataMapOfIntegerListOfShape we get in method + //! Edges. That is to say, to the list of edges in //! theMapLstEdg(i) corresponds the resulting edge theMapEdge(i) - Standard_EXPORT void ResultEdges(TopTools_DataMapOfIntegerShape& theMapEdg); + Standard_EXPORT void ResultEdges(NCollection_DataMap& theMapEdg); //! returns the map of modified faces. - Standard_EXPORT void Faces(TopTools_DataMapOfShapeShape& theMapFac); + Standard_EXPORT void Faces( + NCollection_DataMap& theMapFac); //! returns myShape modified with the list of internal //! edges removed from it. Standard_EXPORT TopoDS_Shape& Shape(); //! returns the number of vertices candidate to be removed - Standard_EXPORT Standard_Integer NbVertices(); + Standard_EXPORT int NbVertices(); - //! Using map of list of connex edges, fuse each list to + //! Using map of list of connex edges, fuse each list to //! one edge and then update myShape Standard_EXPORT void Perform(); -protected: private: //! Build the all the lists of edges that are to be fused Standard_EXPORT void BuildListEdges(); - //! Build result fused edges according to the list + //! Build result fused edges according to the list //! builtin BuildLisEdges Standard_EXPORT void BuildListResultEdges(); - Standard_EXPORT void BuildListConnexEdge(const TopoDS_Shape& theEdge, - TopTools_MapOfShape& theMapUniq, - TopTools_ListOfShape& theLstEdg); - - Standard_EXPORT Standard_Boolean NextConnexEdge(const TopoDS_Vertex& theVertex, - const TopoDS_Shape& theEdge, - TopoDS_Shape& theEdgeConnex) const; - - Standard_EXPORT Standard_Boolean SameSupport(const TopoDS_Edge& E1, const TopoDS_Edge& E2) const; - - Standard_EXPORT Standard_Boolean UpdatePCurve(const TopoDS_Edge& theOldEdge, - TopoDS_Edge& theNewEdge, - const TopTools_ListOfShape& theLstEdg) const; - - TopoDS_Shape myShape; - Standard_Boolean myShapeDone; - Standard_Boolean myEdgesDone; - Standard_Boolean myResultEdgesDone; - TopTools_IndexedDataMapOfShapeListOfShape myMapVerLstEdg; - TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac; - TopTools_DataMapOfIntegerListOfShape myMapLstEdg; - TopTools_DataMapOfIntegerShape myMapEdg; - TopTools_DataMapOfShapeShape myMapFaces; - Standard_Integer myNbConnexEdge; - TopTools_IndexedMapOfShape myAvoidEdg; - Standard_Boolean myConcatBSpl; + Standard_EXPORT void BuildListConnexEdge( + const TopoDS_Shape& theEdge, + NCollection_Map& theMapUniq, + NCollection_List& theLstEdg); + + Standard_EXPORT bool NextConnexEdge(const TopoDS_Vertex& theVertex, + const TopoDS_Shape& theEdge, + TopoDS_Shape& theEdgeConnex) const; + + Standard_EXPORT bool SameSupport(const TopoDS_Edge& E1, const TopoDS_Edge& E2) const; + + Standard_EXPORT bool UpdatePCurve(const TopoDS_Edge& theOldEdge, + TopoDS_Edge& theNewEdge, + const NCollection_List& theLstEdg) const; + + TopoDS_Shape myShape; + bool myShapeDone; + bool myEdgesDone; + bool myResultEdgesDone; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myMapVerLstEdg; + NCollection_IndexedDataMap, TopTools_ShapeMapHasher> + myMapEdgLstFac; + NCollection_DataMap> myMapLstEdg; + NCollection_DataMap myMapEdg; + NCollection_DataMap myMapFaces; + int myNbConnexEdge; + NCollection_IndexedMap myAvoidEdg; + bool myConcatBSpl; }; #endif // _BRepLib_FuseEdges_HeaderFile diff --git a/opencascade/BRepLib_MakeEdge.hxx b/opencascade/BRepLib_MakeEdge.hxx index 321cec1fa..16fdfc32e 100644 --- a/opencascade/BRepLib_MakeEdge.hxx +++ b/opencascade/BRepLib_MakeEdge.hxx @@ -37,34 +37,34 @@ class TopoDS_Edge; //! Provides methods to build edges. //! -//! The methods have the following syntax, where +//! The methods have the following syntax, where //! TheCurve is one of Lin, Circ, ... //! //! Create(C : TheCurve) //! -//! Makes an edge on the whole curve. Add vertices +//! Makes an edge on the whole curve. Add vertices //! on finite curves. //! //! Create(C : TheCurve; p1,p2 : Real) //! -//! Make an edge on the curve between parameters p1 +//! Make an edge on the curve between parameters p1 //! and p2. if p2 < p1 the edge will be REVERSED. If -//! p1 or p2 is infinite the curve will be open in -//! that direction. Vertices are created for finite +//! p1 or p2 is infinite the curve will be open in +//! that direction. Vertices are created for finite //! values of p1 and p2. //! //! Create(C : TheCurve; P1, P2 : Pnt from gp) //! -//! Make an edge on the curve between the points P1 -//! and P2. The points are projected on the curve -//! and the previous method is used. An error is +//! Make an edge on the curve between the points P1 +//! and P2. The points are projected on the curve +//! and the previous method is used. An error is //! raised if the points are not on the curve. //! //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS) //! -//! Make an edge on the curve between the vertices -//! V1 and V2. Same as the previous but no vertices -//! are created. If a vertex is Null the curve will +//! Make an edge on the curve between the vertices +//! V1 and V2. Same as the previous but no vertices +//! are created. If a vertex is Null the curve will //! be open in this direction. class BRepLib_MakeEdge : public BRepLib_MakeShape { @@ -79,7 +79,7 @@ public: Standard_EXPORT BRepLib_MakeEdge(const gp_Lin& L); - Standard_EXPORT BRepLib_MakeEdge(const gp_Lin& L, const Standard_Real p1, const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const gp_Lin& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge(const gp_Lin& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -89,9 +89,7 @@ public: Standard_EXPORT BRepLib_MakeEdge(const gp_Circ& L); - Standard_EXPORT BRepLib_MakeEdge(const gp_Circ& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const gp_Circ& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge(const gp_Circ& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -101,9 +99,7 @@ public: Standard_EXPORT BRepLib_MakeEdge(const gp_Elips& L); - Standard_EXPORT BRepLib_MakeEdge(const gp_Elips& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const gp_Elips& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge(const gp_Elips& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -113,9 +109,7 @@ public: Standard_EXPORT BRepLib_MakeEdge(const gp_Hypr& L); - Standard_EXPORT BRepLib_MakeEdge(const gp_Hypr& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const gp_Hypr& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge(const gp_Hypr& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -125,9 +119,7 @@ public: Standard_EXPORT BRepLib_MakeEdge(const gp_Parab& L); - Standard_EXPORT BRepLib_MakeEdge(const gp_Parab& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const gp_Parab& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge(const gp_Parab& L, const gp_Pnt& P1, const gp_Pnt& P2); @@ -135,115 +127,116 @@ public: const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L, const gp_Pnt& P1, const gp_Pnt& P2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT BRepLib_MakeEdge(const Handle(Geom2d_Curve)& L, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, const gp_Pnt& P1, const gp_Pnt& P2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const gp_Pnt& P1, - const gp_Pnt& P2, - const Standard_Real p1, - const Standard_Real p2); - - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Handle(Geom_Surface)& S, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const double p1, + const double p2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S, + const double p1, + const double p2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT BRepLib_MakeEdge(const occ::handle& L, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C); + + Standard_EXPORT void Init(const occ::handle& C, const double p1, const double p2); + + Standard_EXPORT void Init(const occ::handle& C, const gp_Pnt& P1, const gp_Pnt& P2); + + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, const occ::handle& S); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const gp_Pnt& P1, + const gp_Pnt& P2, + const double p1, + const double p2); + + Standard_EXPORT void Init(const occ::handle& C, + const occ::handle& S, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); //! Returns the error description when NotDone. Standard_EXPORT BRepLib_EdgeError Error() const; @@ -257,7 +250,6 @@ public: //! Returns the second vertex of the edge. May be Null. Standard_EXPORT const TopoDS_Vertex& Vertex2() const; -protected: private: BRepLib_EdgeError myError; TopoDS_Vertex myVertex1; diff --git a/opencascade/BRepLib_MakeEdge2d.hxx b/opencascade/BRepLib_MakeEdge2d.hxx index c56bc14fb..67fc11528 100644 --- a/opencascade/BRepLib_MakeEdge2d.hxx +++ b/opencascade/BRepLib_MakeEdge2d.hxx @@ -35,34 +35,34 @@ class TopoDS_Edge; //! Provides methods to build edges. //! -//! The methods have the following syntax, where +//! The methods have the following syntax, where //! TheCurve is one of Lin2d, Circ2d, ... //! //! Create(C : TheCurve) //! -//! Makes an edge on the whole curve. Add vertices +//! Makes an edge on the whole curve. Add vertices //! on finite curves. //! //! Create(C : TheCurve; p1,p2 : Real) //! -//! Make an edge on the curve between parameters p1 +//! Make an edge on the curve between parameters p1 //! and p2. if p2 < p1 the edge will be REVERSED. If -//! p1 or p2 is infinite the curve will be open in -//! that direction. Vertices are created for finite +//! p1 or p2 is infinite the curve will be open in +//! that direction. Vertices are created for finite //! values of p1 and p2. //! //! Create(C : TheCurve; P1, P2 : Pnt2d from gp) //! -//! Make an edge on the curve between the points P1 -//! and P2. The points are projected on the curve -//! and the previous method is used. An error is +//! Make an edge on the curve between the points P1 +//! and P2. The points are projected on the curve +//! and the previous method is used. An error is //! raised if the points are not on the curve. //! //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS) //! -//! Make an edge on the curve between the vertices -//! V1 and V2. Same as the previous but no vertices -//! are created. If a vertex is Null the curve will +//! Make an edge on the curve between the vertices +//! V1 and V2. Same as the previous but no vertices +//! are created. If a vertex is Null the curve will //! be open in this direction. class BRepLib_MakeEdge2d : public BRepLib_MakeShape { @@ -75,9 +75,7 @@ public: Standard_EXPORT BRepLib_MakeEdge2d(const gp_Lin2d& L); - Standard_EXPORT BRepLib_MakeEdge2d(const gp_Lin2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const gp_Lin2d& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge2d(const gp_Lin2d& L, const gp_Pnt2d& P1, const gp_Pnt2d& P2); @@ -87,9 +85,7 @@ public: Standard_EXPORT BRepLib_MakeEdge2d(const gp_Circ2d& L); - Standard_EXPORT BRepLib_MakeEdge2d(const gp_Circ2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const gp_Circ2d& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge2d(const gp_Circ2d& L, const gp_Pnt2d& P1, const gp_Pnt2d& P2); @@ -99,9 +95,7 @@ public: Standard_EXPORT BRepLib_MakeEdge2d(const gp_Elips2d& L); - Standard_EXPORT BRepLib_MakeEdge2d(const gp_Elips2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const gp_Elips2d& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge2d(const gp_Elips2d& L, const gp_Pnt2d& P1, const gp_Pnt2d& P2); @@ -111,9 +105,7 @@ public: Standard_EXPORT BRepLib_MakeEdge2d(const gp_Hypr2d& L); - Standard_EXPORT BRepLib_MakeEdge2d(const gp_Hypr2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const gp_Hypr2d& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge2d(const gp_Hypr2d& L, const gp_Pnt2d& P1, const gp_Pnt2d& P2); @@ -123,9 +115,7 @@ public: Standard_EXPORT BRepLib_MakeEdge2d(const gp_Parab2d& L); - Standard_EXPORT BRepLib_MakeEdge2d(const gp_Parab2d& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const gp_Parab2d& L, const double p1, const double p2); Standard_EXPORT BRepLib_MakeEdge2d(const gp_Parab2d& L, const gp_Pnt2d& P1, const gp_Pnt2d& P2); @@ -133,55 +123,55 @@ public: const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L, + const double p1, + const double p2); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2, + const double p1, + const double p2); - Standard_EXPORT BRepLib_MakeEdge2d(const Handle(Geom2d_Curve)& L, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT BRepLib_MakeEdge2d(const occ::handle& L, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C); + Standard_EXPORT void Init(const occ::handle& C); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, const double p1, const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, const gp_Pnt2d& P1, const gp_Pnt2d& P2); + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const gp_Pnt2d& P1, - const gp_Pnt2d& P2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, + const gp_Pnt2d& P1, + const gp_Pnt2d& P2, + const double p1, + const double p2); - Standard_EXPORT void Init(const Handle(Geom2d_Curve)& C, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const Standard_Real p1, - const Standard_Real p2); + Standard_EXPORT void Init(const occ::handle& C, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const double p1, + const double p2); //! Returns the error description when NotDone. Standard_EXPORT BRepLib_EdgeError Error() const; @@ -195,7 +185,6 @@ public: //! Returns the second vertex of the edge. May be Null. Standard_EXPORT const TopoDS_Vertex& Vertex2() const; -protected: private: BRepLib_EdgeError myError; TopoDS_Vertex myVertex1; diff --git a/opencascade/BRepLib_MakeFace.hxx b/opencascade/BRepLib_MakeFace.hxx index 57370dbe6..b91f3f556 100644 --- a/opencascade/BRepLib_MakeFace.hxx +++ b/opencascade/BRepLib_MakeFace.hxx @@ -52,7 +52,7 @@ class Geom_Curve; //! * From a surface and a wire. //! //! - A flag Inside is given, when this flag is True -//! the wire is oriented to bound a finite area on +//! the wire is oriented to bound a finite area on //! the surface. //! //! * From a face and a wire. @@ -86,89 +86,86 @@ public: //! Make a face from a Surface. Accepts tolerance value (TolDegen) //! for resolution of degenerated edges. - Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, const Standard_Real TolDegen); + Standard_EXPORT BRepLib_MakeFace(const occ::handle& S, const double TolDegen); //! Make a face from a plane. - Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a cylinder. - Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a cone. - Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a sphere. - Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a torus. - Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax); + Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, + const double UMin, + const double UMax, + const double VMin, + const double VMax); //! Make a face from a Surface. Accepts min & max parameters //! to construct the face's bounds. Also accepts tolerance value (TolDegen) //! for resolution of degenerated edges. - Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Real TolDegen); + Standard_EXPORT BRepLib_MakeFace(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const double TolDegen); //! Find a surface from the wire and make a face. //! if is true, the computed surface will be //! a plane. If it is not possible to find a plane, the //! flag NotDone will be set. - Standard_EXPORT BRepLib_MakeFace(const TopoDS_Wire& W, - const Standard_Boolean OnlyPlane = Standard_False); + Standard_EXPORT BRepLib_MakeFace(const TopoDS_Wire& W, const bool OnlyPlane = false); //! Make a face from a plane and a wire. - Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, const TopoDS_Wire& W, const bool Inside = true); //! Make a face from a cylinder and a wire. - Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a cone and a wire. - Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a sphere and a wire. - Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a torus and a wire. - Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, + const TopoDS_Wire& W, + const bool Inside = true); //! Make a face from a Surface and a wire. - Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside = Standard_True); + Standard_EXPORT BRepLib_MakeFace(const occ::handle& S, + const TopoDS_Wire& W, + const bool Inside = true); //! Adds the wire in the face Standard_EXPORT BRepLib_MakeFace(const TopoDS_Face& F, const TopoDS_Wire& W); @@ -176,23 +173,23 @@ public: //! Load the face. Standard_EXPORT void Init(const TopoDS_Face& F); - //! Creates the face from the surface. If Bound is + //! Creates the face from the surface. If Bound is //! True a wire is made from the natural bounds. //! Accepts tolerance value (TolDegen) for resolution //! of degenerated edges. - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Boolean Bound, - const Standard_Real TolDegen); + Standard_EXPORT void Init(const occ::handle& S, + const bool Bound, + const double TolDegen); //! Creates the face from the surface and the min-max //! values. Accepts tolerance value (TolDegen) for resolution //! of degenerated edges. - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Real TolDegen); + Standard_EXPORT void Init(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const double TolDegen); //! Adds the wire in the current face. Standard_EXPORT void Add(const TopoDS_Wire& W); @@ -208,13 +205,12 @@ public: //! Returns less than , which shows //! actual tolerance to decide the curve is degenerated. //! Warning: For internal use of BRepLib_MakeFace and BRepLib_MakeShell. - Standard_EXPORT static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve, - const Standard_Real theMaxTol, - Standard_Real& theActTol); + Standard_EXPORT static bool IsDegenerated(const occ::handle& theCurve, + const double theMaxTol, + double& theActTol); -protected: private: - //! Reorient the current face if the boundary is not + //! Reorient the current face if the boundary is not //! finite. Standard_EXPORT void CheckInside(); diff --git a/opencascade/BRepLib_MakePolygon.hxx b/opencascade/BRepLib_MakePolygon.hxx index 053c6944c..cdc23be2f 100644 --- a/opencascade/BRepLib_MakePolygon.hxx +++ b/opencascade/BRepLib_MakePolygon.hxx @@ -38,8 +38,8 @@ class TopoDS_Wire; //! //! - any number of vertices. //! -//! When a point or vertex is added to the polygon if -//! it is identic to the previous point no edge is +//! When a point or vertex is added to the polygon if +//! it is identic to the previous point no edge is //! built. The method added can be used to test it. class BRepLib_MakePolygon : public BRepLib_MakeShape { @@ -51,37 +51,37 @@ public: Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2); - Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, - const gp_Pnt& P2, - const gp_Pnt& P3, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, + const gp_Pnt& P2, + const gp_Pnt& P3, + const bool Close = false); - Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, - const gp_Pnt& P2, - const gp_Pnt& P3, - const gp_Pnt& P4, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepLib_MakePolygon(const gp_Pnt& P1, + const gp_Pnt& P2, + const gp_Pnt& P3, + const gp_Pnt& P4, + const bool Close = false); Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2); - Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + const bool Close = false); - Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2, - const TopoDS_Vertex& V3, - const TopoDS_Vertex& V4, - const Standard_Boolean Close = Standard_False); + Standard_EXPORT BRepLib_MakePolygon(const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + const TopoDS_Vertex& V4, + const bool Close = false); Standard_EXPORT void Add(const gp_Pnt& P); Standard_EXPORT void Add(const TopoDS_Vertex& V); - //! Returns True if the last vertex or point was + //! Returns True if the last vertex or point was //! successfully added. - Standard_EXPORT Standard_Boolean Added() const; + Standard_EXPORT bool Added() const; Standard_EXPORT void Close(); @@ -96,7 +96,6 @@ public: Standard_EXPORT const TopoDS_Wire& Wire(); Standard_EXPORT operator TopoDS_Wire(); -protected: private: TopoDS_Vertex myFirstVertex; TopoDS_Vertex myLastVertex; diff --git a/opencascade/BRepLib_MakeShape.hxx b/opencascade/BRepLib_MakeShape.hxx index 2aef99590..f31d282bb 100644 --- a/opencascade/BRepLib_MakeShape.hxx +++ b/opencascade/BRepLib_MakeShape.hxx @@ -22,23 +22,23 @@ #include #include -#include +#include #include #include class TopoDS_Face; class TopoDS_Edge; -//! This is the root class for all shape -//! constructions. It stores the result. +//! This is the root class for all shape +//! constructions. It stores the result. //! -//! It provides deferred methods to trace the history +//! It provides deferred methods to trace the history //! of sub-shapes. class BRepLib_MakeShape : public BRepLib_Command { public: DEFINE_STANDARD_ALLOC - //! This is called by Shape(). It does nothing but + //! This is called by Shape(). It does nothing but //! may be redefined. Standard_EXPORT void Build(); @@ -50,31 +50,31 @@ public: Standard_EXPORT virtual BRepLib_ShapeModification FaceStatus(const TopoDS_Face& F) const; //! Returns True if the Face generates new topology. - Standard_EXPORT virtual Standard_Boolean HasDescendants(const TopoDS_Face& F) const; + Standard_EXPORT virtual bool HasDescendants(const TopoDS_Face& F) const; //! returns the list of generated Faces. - Standard_EXPORT virtual const TopTools_ListOfShape& DescendantFaces(const TopoDS_Face& F); + Standard_EXPORT virtual const NCollection_List& DescendantFaces( + const TopoDS_Face& F); //! returns the number of surfaces //! after the shape creation. - Standard_EXPORT virtual Standard_Integer NbSurfaces() const; + Standard_EXPORT virtual int NbSurfaces() const; //! Return the faces created for surface I. - Standard_EXPORT virtual const TopTools_ListOfShape& NewFaces(const Standard_Integer I); + Standard_EXPORT virtual const NCollection_List& NewFaces(const int I); //! returns a list of the created faces //! from the edge . - Standard_EXPORT virtual const TopTools_ListOfShape& FacesFromEdges(const TopoDS_Edge& E); + Standard_EXPORT virtual const NCollection_List& FacesFromEdges( + const TopoDS_Edge& E); protected: Standard_EXPORT BRepLib_MakeShape(); - TopoDS_Shape myShape; - TopTools_ListOfShape myGenFaces; - TopTools_ListOfShape myNewFaces; - TopTools_ListOfShape myEdgFaces; - -private: + TopoDS_Shape myShape; + NCollection_List myGenFaces; + NCollection_List myNewFaces; + NCollection_List myEdgFaces; }; #endif // _BRepLib_MakeShape_HeaderFile diff --git a/opencascade/BRepLib_MakeShell.hxx b/opencascade/BRepLib_MakeShell.hxx index 6232fe2e7..947c74238 100644 --- a/opencascade/BRepLib_MakeShell.hxx +++ b/opencascade/BRepLib_MakeShell.hxx @@ -39,24 +39,23 @@ public: //! Not done. Standard_EXPORT BRepLib_MakeShell(); - Standard_EXPORT BRepLib_MakeShell(const Handle(Geom_Surface)& S, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT BRepLib_MakeShell(const occ::handle& S, const bool Segment = false); - Standard_EXPORT BRepLib_MakeShell(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT BRepLib_MakeShell(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const bool Segment = false); - //! Creates the shell from the surface and the min-max + //! Creates the shell from the surface and the min-max //! values. - Standard_EXPORT void Init(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax, - const Standard_Boolean Segment = Standard_False); + Standard_EXPORT void Init(const occ::handle& S, + const double UMin, + const double UMax, + const double VMin, + const double VMax, + const bool Segment = false); Standard_EXPORT BRepLib_ShellError Error() const; @@ -64,7 +63,6 @@ public: Standard_EXPORT const TopoDS_Shell& Shell() const; Standard_EXPORT operator TopoDS_Shell() const; -protected: private: BRepLib_ShellError myError; }; diff --git a/opencascade/BRepLib_MakeSolid.hxx b/opencascade/BRepLib_MakeSolid.hxx index 8d4d30beb..ebdf78104 100644 --- a/opencascade/BRepLib_MakeSolid.hxx +++ b/opencascade/BRepLib_MakeSolid.hxx @@ -27,7 +27,7 @@ class TopoDS_Shell; class TopoDS_Solid; class TopoDS_Face; -//! Makes a solid from compsolid or shells. +//! Makes a solid from compsolid or shells. class BRepLib_MakeSolid : public BRepLib_MakeShape { public: @@ -65,13 +65,10 @@ public: //! returns the status of the Face after //! the shape creation. - Standard_EXPORT virtual BRepLib_ShapeModification FaceStatus(const TopoDS_Face& F) const - Standard_OVERRIDE; + Standard_EXPORT BRepLib_ShapeModification FaceStatus(const TopoDS_Face& F) const override; protected: - TopTools_ListOfShape myDeletedFaces; - -private: + NCollection_List myDeletedFaces; }; #endif // _BRepLib_MakeSolid_HeaderFile diff --git a/opencascade/BRepLib_MakeVertex.hxx b/opencascade/BRepLib_MakeVertex.hxx index a8969ae0d..18e6ddf54 100644 --- a/opencascade/BRepLib_MakeVertex.hxx +++ b/opencascade/BRepLib_MakeVertex.hxx @@ -34,9 +34,6 @@ public: Standard_EXPORT const TopoDS_Vertex& Vertex(); Standard_EXPORT operator TopoDS_Vertex(); - -protected: -private: }; #endif // _BRepLib_MakeVertex_HeaderFile diff --git a/opencascade/BRepLib_MakeWire.hxx b/opencascade/BRepLib_MakeWire.hxx index 1442e9f30..fd2382d9c 100644 --- a/opencascade/BRepLib_MakeWire.hxx +++ b/opencascade/BRepLib_MakeWire.hxx @@ -23,10 +23,12 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include -#include +#include #include #include @@ -34,26 +36,26 @@ class TopoDS_Wire; //! Provides methods to build wires. //! -//! A wire may be built : +//! A wire may be built: //! //! * From a single edge. //! //! * From a wire and an edge. //! -//! - A new wire is created with the edges of the +//! - A new wire is created with the edges of the //! wire + the edge. //! -//! - If the edge is not connected to the wire the -//! flag NotDone is set and the method Wire will +//! - If the edge is not connected to the wire the +//! flag NotDone is set and the method Wire will //! raise an error. //! -//! - The connection may be : +//! - The connection may be: //! //! . Through an existing vertex. The edge is shared. //! //! . Through a geometric coincidence of vertices. -//! The edge is copied and the vertices from the -//! edge are replaced by the vertices from the +//! The edge is copied and the vertices from the +//! edge are replaced by the vertices from the //! wire. //! //! . The new edge and the connection vertices are @@ -61,7 +63,7 @@ class TopoDS_Wire; //! //! * From 2, 3, 4 edges. //! -//! - A wire is created from the first edge, the +//! - A wire is created from the first edge, the //! following edges are added. //! //! * From many edges. @@ -113,9 +115,9 @@ public: Standard_EXPORT void Add(const TopoDS_Wire& W); //! Add the edges of to the current wire. - //! The edges are not to be consecutive. But they are + //! The edges are not to be consecutive. But they are //! to be all connected geometrically or topologically. - Standard_EXPORT void Add(const TopTools_ListOfShape& L); + Standard_EXPORT void Add(const NCollection_List& L); Standard_EXPORT BRepLib_WireError Error() const; @@ -130,61 +132,61 @@ public: Standard_EXPORT const TopoDS_Vertex& Vertex() const; private: - class BRepLib_BndBoxVertexSelector - : public NCollection_UBTree::Selector + class BRepLib_BndBoxVertexSelector : public NCollection_UBTree::Selector { public: - BRepLib_BndBoxVertexSelector(const TopTools_IndexedMapOfShape& theMapOfShape) - : BRepLib_BndBoxVertexSelector::Selector(), - myMapOfShape(theMapOfShape), + BRepLib_BndBoxVertexSelector( + const NCollection_IndexedMap& theMapOfShape) + : myMapOfShape(theMapOfShape), myTolP(0.0), myVInd(0) { } - Standard_Boolean Reject(const Bnd_Box& theBox) const { return theBox.IsOut(myVBox); } + bool Reject(const Bnd_Box& theBox) const override { return theBox.IsOut(myVBox); } - Standard_Boolean Accept(const Standard_Integer& theObj); + bool Accept(const int& theObj) override; - void SetCurrentVertex(const gp_Pnt& theP, Standard_Real theTol, Standard_Integer theVInd); + void SetCurrentVertex(const gp_Pnt& theP, double theTol, int theVInd); - const NCollection_List& GetResultInds() const { return myResultInd; } + const NCollection_List& GetResultInds() const { return myResultInd; } void ClearResInds() { myResultInd.Clear(); } private: - BRepLib_BndBoxVertexSelector(const BRepLib_BndBoxVertexSelector&); - BRepLib_BndBoxVertexSelector& operator=(const BRepLib_BndBoxVertexSelector&); - - const TopTools_IndexedMapOfShape& myMapOfShape; // vertices - gp_Pnt myP; - Standard_Real myTolP; - Standard_Integer myVInd; - Bnd_Box myVBox; - NCollection_List myResultInd; + BRepLib_BndBoxVertexSelector(const BRepLib_BndBoxVertexSelector&) = delete; + BRepLib_BndBoxVertexSelector& operator=(const BRepLib_BndBoxVertexSelector&) = delete; + + const NCollection_IndexedMap& myMapOfShape; // vertices + gp_Pnt myP; + double myTolP; + int myVInd; + Bnd_Box myVBox; + NCollection_List myResultInd; }; - void CollectCoincidentVertices(const TopTools_ListOfShape& theL, + void CollectCoincidentVertices(const NCollection_List& theL, NCollection_List>& theGrVL); - void CreateNewVertices(const NCollection_List>& theGrVL, - TopTools_DataMapOfShapeShape& theO2NV); + void CreateNewVertices( + const NCollection_List>& theGrVL, + NCollection_DataMap& theO2NV); - void CreateNewListOfEdges(const TopTools_ListOfShape& theL, - const TopTools_DataMapOfShapeShape& theO2NV, - TopTools_ListOfShape& theNewEList); + void CreateNewListOfEdges( + const NCollection_List& theL, + const NCollection_DataMap& theO2NV, + NCollection_List& theNewEList); - void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity); + void Add(const TopoDS_Edge& E, bool IsCheckGeometryProximity); -protected: private: - BRepLib_WireError myError; - TopoDS_Edge myEdge; - TopoDS_Vertex myVertex; - TopTools_IndexedMapOfShape myVertices; - TopoDS_Vertex FirstVertex; - TopoDS_Vertex VF; - TopoDS_Vertex VL; + BRepLib_WireError myError; + TopoDS_Edge myEdge; + TopoDS_Vertex myVertex; + NCollection_IndexedMap myVertices; + TopoDS_Vertex FirstVertex; + TopoDS_Vertex VF; + TopoDS_Vertex VL; }; #endif // _BRepLib_MakeWire_HeaderFile diff --git a/opencascade/BRepLib_PointCloudShape.hxx b/opencascade/BRepLib_PointCloudShape.hxx index e73453df7..e29e60452 100644 --- a/opencascade/BRepLib_PointCloudShape.hxx +++ b/opencascade/BRepLib_PointCloudShape.hxx @@ -14,8 +14,10 @@ #ifndef _BRepLib_PointCloudShape_HeaderFile #define _BRepLib_PointCloudShape_HeaderFile -#include -#include +#include +#include +#include +#include #include #include @@ -32,7 +34,7 @@ public: //! Constructor initialized by shape Standard_EXPORT BRepLib_PointCloudShape(const TopoDS_Shape& theShape = TopoDS_Shape(), - const Standard_Real theTol = Precision::Confusion()); + const double theTol = Precision::Confusion()); //! Virtual destructor Standard_EXPORT virtual ~BRepLib_PointCloudShape(); @@ -44,49 +46,49 @@ public: void SetShape(const TopoDS_Shape& theShape) { myShape = theShape; } //! Return tolerance. - Standard_Real Tolerance() const { return myTol; } + double Tolerance() const { return myTol; } //! Set tolerance. - void SetTolerance(Standard_Real theTol) { myTol = theTol; } + void SetTolerance(double theTol) { myTol = theTol; } //! Returns value of the distance to define deflection of points from shape along normal to shape; //! 0.0 by default. - Standard_Real GetDistance() const { return myDist; } + double GetDistance() const { return myDist; } //! Sets value of the distance to define deflection of points from shape along normal to shape. //! Negative values of theDist parameter are ignored. - void SetDistance(const Standard_Real theDist) { myDist = theDist; } + void SetDistance(const double theDist) { myDist = theDist; } //! Returns size of the point cloud for specified density. - Standard_EXPORT Standard_Integer NbPointsByDensity(const Standard_Real theDensity = 0.0); + Standard_EXPORT int NbPointsByDensity(const double theDensity = 0.0); //! Returns size of the point cloud for using triangulation. - Standard_EXPORT Standard_Integer NbPointsByTriangulation() const; + Standard_EXPORT int NbPointsByTriangulation() const; //! Computes points with specified density for initial shape. //! If parameter Density is equal to 0 then density will be computed automatically by criterion: //! - 10 points per minimal unreduced face area. //! //! Note: this function should not be called from concurrent threads without external lock. - Standard_EXPORT Standard_Boolean GeneratePointsByDensity(const Standard_Real theDensity = 0.0); + Standard_EXPORT bool GeneratePointsByDensity(const double theDensity = 0.0); //! Get points from triangulation existing in the shape. - Standard_EXPORT Standard_Boolean GeneratePointsByTriangulation(); + Standard_EXPORT bool GeneratePointsByTriangulation(); protected: //! Compute area of the specified face. - Standard_EXPORT Standard_Real faceArea(const TopoDS_Shape& theShape); + Standard_EXPORT double faceArea(const TopoDS_Shape& theShape); //! Computes default density points per face. - Standard_EXPORT Standard_Real computeDensity(); + Standard_EXPORT double computeDensity(); //! Adds points to face in accordance with the specified density randomly in the specified range //! [0, Dist]. - Standard_EXPORT Standard_Boolean addDensityPoints(const TopoDS_Shape& theFace); + Standard_EXPORT bool addDensityPoints(const TopoDS_Shape& theFace); //! Adds points to face by nodes of the existing triangulation randomly in the specified range [0, //! Dist]. - Standard_EXPORT Standard_Boolean addTriangulationPoints(const TopoDS_Shape& theFace); + Standard_EXPORT bool addTriangulationPoints(const TopoDS_Shape& theFace); protected: //! Method to clear maps. @@ -103,12 +105,12 @@ protected: const TopoDS_Shape& theFace) = 0; protected: - TopoDS_Shape myShape; - Standard_Real myDist; - Standard_Real myTol; - TopTools_DataMapOfShapeReal myFaceArea; - TopTools_DataMapOfShapeInteger myFacePoints; - Standard_Integer myNbPoints; + TopoDS_Shape myShape; + double myDist; + double myTol; + NCollection_DataMap myFaceArea; + NCollection_DataMap myFacePoints; + int myNbPoints; }; #endif // _BRepLib_PointCloudShape_HeaderFile diff --git a/opencascade/BRepLib_ToolTriangulatedShape.hxx b/opencascade/BRepLib_ToolTriangulatedShape.hxx index 9b9c47789..a4d86475b 100644 --- a/opencascade/BRepLib_ToolTriangulatedShape.hxx +++ b/opencascade/BRepLib_ToolTriangulatedShape.hxx @@ -28,7 +28,8 @@ public: //! Does nothing if triangulation already defines normals. //! @param[in] theFace the face //! @param[in] theTris the definition of a face triangulation - static void ComputeNormals(const TopoDS_Face& theFace, const Handle(Poly_Triangulation)& theTris) + static void ComputeNormals(const TopoDS_Face& theFace, + const occ::handle& theTris) { Poly_Connect aPolyConnect; ComputeNormals(theFace, theTris, aPolyConnect); @@ -39,9 +40,9 @@ public: //! @param[in] theFace the face //! @param[in] theTris the definition of a face triangulation //! @param[in,out] thePolyConnect optional, initialized tool for exploring triangulation - Standard_EXPORT static void ComputeNormals(const TopoDS_Face& theFace, - const Handle(Poly_Triangulation)& theTris, - Poly_Connect& thePolyConnect); + Standard_EXPORT static void ComputeNormals(const TopoDS_Face& theFace, + const occ::handle& theTris, + Poly_Connect& thePolyConnect); }; #endif diff --git a/opencascade/BRepLib_ValidateEdge.hxx b/opencascade/BRepLib_ValidateEdge.hxx index a1dae8f44..1fb968971 100644 --- a/opencascade/BRepLib_ValidateEdge.hxx +++ b/opencascade/BRepLib_ValidateEdge.hxx @@ -27,28 +27,28 @@ class BRepLib_ValidateEdge { public: //! Initialization constructor - Standard_EXPORT BRepLib_ValidateEdge(const Handle(Adaptor3d_Curve) theReferenceCurve, - const Handle(Adaptor3d_CurveOnSurface) theOtherCurve, - Standard_Boolean theSameParameter); + Standard_EXPORT BRepLib_ValidateEdge(const occ::handle theReferenceCurve, + const occ::handle theOtherCurve, + bool theSameParameter); //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact //! is false, faster, but possible not correct result) or exact calculating by using //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly). //! Exact method is used only when edge is SameParameter. //! Default method is calculating in finite number of points - void SetExactMethod(Standard_Boolean theIsExact) { myIsExactMethod = theIsExact; } + void SetExactMethod(bool theIsExact) { myIsExactMethod = theIsExact; } //! Returns true if exact method selected - Standard_Boolean IsExactMethod() { return myIsExactMethod; } + bool IsExactMethod() { return myIsExactMethod; } //! Sets parallel flag - void SetParallel(Standard_Boolean theIsMultiThread) { myIsMultiThread = theIsMultiThread; } + void SetParallel(bool theIsMultiThread) { myIsMultiThread = theIsMultiThread; } //! Returns true if parallel flag is set - Standard_Boolean IsParallel() { return myIsMultiThread; } + bool IsParallel() { return myIsMultiThread; } //! Set control points number (if you need a value other than 22) - void SetControlPointsNumber(Standard_Integer theControlPointsNumber) + void SetControlPointsNumber(int theControlPointsNumber) { myControlPointsNumber = theControlPointsNumber; } @@ -56,7 +56,7 @@ public: //! Sets limit to compute a distance in the Process() function. If the distance greater than //! theToleranceForChecking the Process() function stopped. Use this in case checking of //! tolerance for best performcnce. Has no effect in case using exact method. - void SetExitIfToleranceExceeded(Standard_Real theToleranceForChecking); + void SetExitIfToleranceExceeded(double theToleranceForChecking); //! Computes the max distance for the 3d curve //! and curve on surface . If the SetExitIfToleranceExceeded() @@ -66,20 +66,20 @@ public: Standard_EXPORT void Process(); //! Returns true if the distance has been found for all points - Standard_Boolean IsDone() const { return myIsDone; } + bool IsDone() const { return myIsDone; } //! Returns true if computed distance is less than - Standard_EXPORT Standard_Boolean CheckTolerance(Standard_Real theToleranceToCheck); + Standard_EXPORT bool CheckTolerance(double theToleranceToCheck); //! Returns max distance - Standard_EXPORT Standard_Real GetMaxDistance(); + Standard_EXPORT double GetMaxDistance(); //! Increase if max distance is greater than - Standard_EXPORT void UpdateTolerance(Standard_Real& theToleranceToUpdate); + Standard_EXPORT void UpdateTolerance(double& theToleranceToUpdate); private: //! Adds some margin for distance checking - Standard_Real correctTolerance(Standard_Real theTolerance); + double correctTolerance(double theTolerance); //! Calculating in finite number of points void processApprox(); @@ -88,16 +88,16 @@ private: void processExact(); private: - Handle(Adaptor3d_Curve) myReferenceCurve; - Handle(Adaptor3d_CurveOnSurface) myOtherCurve; - Standard_Boolean mySameParameter; - Standard_Integer myControlPointsNumber; - Standard_Real myToleranceForChecking; - Standard_Real myCalculatedDistance; - Standard_Boolean myExitIfToleranceExceeded; - Standard_Boolean myIsDone; - Standard_Boolean myIsExactMethod; - Standard_Boolean myIsMultiThread; + occ::handle myReferenceCurve; + occ::handle myOtherCurve; + bool mySameParameter; + int myControlPointsNumber; + double myToleranceForChecking; + double myCalculatedDistance; + bool myExitIfToleranceExceeded; + bool myIsDone; + bool myIsExactMethod; + bool myIsMultiThread; }; #endif // _BRepLib_ValidateEdge_HeaderFile diff --git a/opencascade/BRepMAT2d_BisectingLocus.hxx b/opencascade/BRepMAT2d_BisectingLocus.hxx index fa151eb8f..86f16e7aa 100644 --- a/opencascade/BRepMAT2d_BisectingLocus.hxx +++ b/opencascade/BRepMAT2d_BisectingLocus.hxx @@ -22,11 +22,12 @@ #include #include -#include #include +#include +#include #include #include -#include +#include class MAT_Graph; class BRepMAT2d_Explorer; class MAT_BasicElt; @@ -41,8 +42,8 @@ class MAT_Arc; //! //! If the set of lines contains closed lines: //! ------------------------------------------ -//! These lines cut the plane in areas. -//! One map can be computed for each area. +//! These lines cut the plane in areas. +//! One map can be computed for each area. //! //! Bisecting locus computes a map in an area. //! The area is defined by a side (MAT_Left,MAT_Right) @@ -52,7 +53,7 @@ class MAT_Arc; //! -------------------------------------------- //! the map recovers all the plane. //! -//! Warning: Assume the orientation of the closed lines are +//! Warning: Assume the orientation of the closed lines are //! compatible. //! //! Assume the explo contains only lines located in the @@ -61,12 +62,12 @@ class MAT_Arc; //! Assume a line don't cross itself or an other line. //! //! Remark: -//! the curves coming from the explorer can be -//! decomposed in different parts. It the case for the +//! the curves coming from the explorer can be +//! decomposed in different parts. It the case for the //! curves other than circles or lines. //! -//! The map of bisecting locus is described by a graph. -//! - The BasicsElements correspond to elements on +//! The map of bisecting locus is described by a graph. +//! - The BasicsElements correspond to elements on //! the figure described by the Explorer from BRepMAT2d. //! - The Arcs correspond to the bisectors. //! - The Nodes are the extremities of the arcs. @@ -82,64 +83,62 @@ public: //! The bisecting locus are computed on the side