|
|
|||
File indexing completed on 2026-05-02 08:23:27
0001 // Created on: 2000-08-21 0002 // Created by: Andrey BETENEV 0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _ShapeProcess_HeaderFile 0017 #define _ShapeProcess_HeaderFile 0018 0019 #include <Message_ProgressRange.hxx> 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <bitset> 0025 #include <vector> 0026 0027 class ShapeProcess_Operator; 0028 class ShapeProcess_Context; 0029 0030 //! Shape Processing module 0031 //! allows to define and apply general Shape Processing as a 0032 //! customizable sequence of Shape Healing operators. The 0033 //! customization is implemented via user-editable resource 0034 //! file which defines sequence of operators to be executed 0035 //! and their parameters. 0036 class ShapeProcess 0037 { 0038 public: 0039 DEFINE_STANDARD_ALLOC 0040 0041 //! Describes all available operations. 0042 //! C++11 enum class is not used to allow implicit conversion to underlying type. 0043 enum Operation : uint8_t 0044 { 0045 First = 0, // First operation index. 0046 DirectFaces = First, 0047 SameParameter, 0048 SetTolerance, 0049 SplitAngle, 0050 BSplineRestriction, 0051 ElementaryToRevolution, 0052 SweptToElementary, 0053 SurfaceToBSpline, 0054 ToBezier, 0055 SplitContinuity, 0056 SplitClosedFaces, 0057 FixWireGaps, 0058 FixFaceSize, 0059 DropSmallSolids, 0060 DropSmallEdges, 0061 FixShape, 0062 SplitClosedEdges, 0063 SplitCommonVertex, 0064 Last = SplitCommonVertex // Last operation index. 0065 }; 0066 0067 // Bitset of operations. It is used to specify which operations should be performed. 0068 // For example, to perform DirectFaces and SameParameter operations, use: 0069 // ShapeProcess::OperationsFlags flags; 0070 // flags.set(ShapeProcess::Operation::DirectFaces); 0071 // flags.set(ShapeProcess::Operation::SameParameter); 0072 // ShapeProcess::Perform(context, flags); 0073 using OperationsFlags = std::bitset<Operation::Last + 1>; 0074 0075 public: 0076 //! Registers operator to make it visible for Performer 0077 Standard_EXPORT static Standard_Boolean RegisterOperator(const Standard_CString name, 0078 const Handle(ShapeProcess_Operator)& op); 0079 0080 //! Finds operator by its name 0081 Standard_EXPORT static Standard_Boolean FindOperator(const Standard_CString name, 0082 Handle(ShapeProcess_Operator)& op); 0083 0084 //! Performs a specified sequence of operators on Context 0085 //! Resource file and other data should be already loaded 0086 //! to Context (including description of sequence seq) 0087 Standard_EXPORT static Standard_Boolean Perform( 0088 const Handle(ShapeProcess_Context)& context, 0089 const Standard_CString seq, 0090 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0091 0092 //! Performs a specified sequence of operators on @p theContext. 0093 //! @param theContext Context to perform operations on. Contains the shape to process 0094 //! and processing parameters. If processing parameters are not set, default values are 0095 //! used. Parameters should be in a scope of operation, for example, instead of 0096 //! "FromSTEP.FixShape.Tolerance3d" we should use just "FixShape.Tolerance3d". 0097 //! @param theOperations Bitset of operations to perform. 0098 //! @param theProgress Progress indicator. 0099 //! @return true if at least one operation was performed, false otherwise. 0100 Standard_EXPORT static Standard_Boolean Perform( 0101 const Handle(ShapeProcess_Context)& theContext, 0102 const OperationsFlags& theOperations, 0103 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0104 0105 //! Converts operation name to operation flag. 0106 //! @param theName Operation name. 0107 //! @return Operation flag and true if the operation name is valid, false otherwise. 0108 Standard_EXPORT static std::pair<Operation, bool> ToOperationFlag(const char* theName); 0109 0110 private: 0111 //! Returns operators to be performed according to the specified flags. 0112 //! @param theFlags Bitset of operations flags. 0113 //! @return List of operators to perform: pairs of operator name and operator handle. 0114 static std::vector<std::pair<const char*, Handle(ShapeProcess_Operator)>> getOperators( 0115 const OperationsFlags& theFlags); 0116 0117 //! Converts operation flag to its name. 0118 //! @param theOperation Operation flag. 0119 //! @return Operation name. 0120 static const char* toOperationName(const Operation theOperation); 0121 }; 0122 0123 #endif // _ShapeProcess_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|