|
|
|||
Warning, file /include/opencascade/XSAlgo_ShapeProcessor.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Copyright (c) 2000-2014 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _XSAlgo_ShapeProcessor_HeaderFile 0015 #define _XSAlgo_ShapeProcessor_HeaderFile 0016 0017 #include <DE_ShapeFixParameters.hxx> 0018 #include <ShapeProcess.hxx> 0019 #include <TopAbs_ShapeEnum.hxx> 0020 #include <TopTools_DataMapOfShapeShape.hxx> 0021 #include <TopoDS_Edge.hxx> 0022 #include <TopoDS_Face.hxx> 0023 0024 class ShapeProcess_ShapeContext; 0025 class ShapeExtend_MsgRegistrator; 0026 class Transfer_TransientProcess; 0027 class Transfer_FinderProcess; 0028 class Transfer_Binder; 0029 0030 //! Shape Processing module. 0031 //! Allows to define and apply general Shape Processing as a customizable sequence of operators. 0032 class XSAlgo_ShapeProcessor 0033 { 0034 public: 0035 using ParameterMap = NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>; 0036 using ProcessingData = std::pair<ParameterMap, ShapeProcess::OperationsFlags>; 0037 // Flags defining operations to be performed on shapes. Since there is no std::optional in C++11, 0038 // we use a pair. The first element is the flags, the second element is a boolean value that 0039 // indicates whether the flags were set. 0040 using ProcessingFlags = std::pair<ShapeProcess::OperationsFlags, bool>; 0041 0042 public: 0043 //! Constructor. 0044 //! @param theParameters Pre-filled parameter map to be used in the processing. 0045 //! @param theShapeFixParameters Shape healing parameters to be used in the processing. 0046 //! If @p theParameters has some shape healing values, they will override the 0047 //! corresponding values from @p theShapeFixParameters. 0048 Standard_EXPORT XSAlgo_ShapeProcessor(const ParameterMap& theParameters, 0049 const DE_ShapeFixParameters& theShapeFixParameters = {}); 0050 0051 //! Constructor. 0052 //! @param theParameters Parameters to be used in the processing. 0053 Standard_EXPORT XSAlgo_ShapeProcessor(const DE_ShapeFixParameters& theParameters); 0054 0055 //! Process the shape by applying the specified operations. 0056 //! @param theShape Shape to process. 0057 //! @param theOperations Operations to be performed. 0058 //! @param theProgress Progress indicator. 0059 //! @return Processed shape. May be the same as the input shape if no modifications were made. 0060 Standard_EXPORT TopoDS_Shape ProcessShape(const TopoDS_Shape& theShape, 0061 const ShapeProcess::OperationsFlags& theOperations, 0062 const Message_ProgressRange& theProgress); 0063 0064 //! Get the context of the last processing. 0065 //! Only valid after the ProcessShape() method was called. 0066 //! @return Shape context. 0067 Handle(ShapeProcess_ShapeContext) GetContext() { return myContext; } 0068 0069 //! Merge the results of the shape processing with the transfer process. 0070 //! @param theTransientProcess Transfer process to merge with. 0071 //! @param theFirstTPItemIndex Index of the first item in the transfer process to merge with. 0072 Standard_EXPORT void MergeTransferInfo( 0073 const Handle(Transfer_TransientProcess)& theTransientProcess, 0074 const Standard_Integer theFirstTPItemIndex) const; 0075 0076 //! Merge the results of the shape processing with the finder process. 0077 //! @param theFinderProcess Finder process to merge with. 0078 Standard_EXPORT void MergeTransferInfo( 0079 const Handle(Transfer_FinderProcess)& theFinderProcess) const; 0080 0081 //! Check quality of pcurve of the edge on the given face, and correct it if necessary. 0082 //! @param theEdge Edge to check. 0083 //! @param theFace Face on which the edge is located. 0084 //! @param thePrecision Precision to use for checking. 0085 //! @param theIsSeam Flag indicating whether the edge is a seam edge. 0086 //! @return True if the pcurve was corrected, false if it was dropped. 0087 Standard_EXPORT static Standard_Boolean CheckPCurve(const TopoDS_Edge& theEdge, 0088 const TopoDS_Face& theFace, 0089 const Standard_Real thePrecision, 0090 const Standard_Boolean theIsSeam); 0091 0092 //! Reads the parameter map from and operation flags from the file specified in static interface. 0093 //! @param theFileResourceName Name of the parameter in interface static that contains the name 0094 //! of the file. For example, parameter "read.iges.resource.name" may contain string 0095 //! "IGES". 0096 //! @param theScopeResourceName Name of the parameter in interface static that contains the name 0097 //! of the scope. For example, parameter "read.iges.sequence" may contain string 0098 //! "FromIGES". 0099 //! @return Read parameter map. 0100 Standard_EXPORT static ProcessingData ReadProcessingData( 0101 const TCollection_AsciiString& theFileResourceName, 0102 const TCollection_AsciiString& theScopeResourceName); 0103 0104 //! Fill the parameter map with the values from the specified parameters. 0105 //! @param theParameters Parameters to be used in the processing. 0106 //! @param theIsForce Flag indicating whether parameter should be replaced if it already exists in 0107 //! the map. 0108 //! @param theMap Map to fill. 0109 Standard_EXPORT static void FillParameterMap(const DE_ShapeFixParameters& theParameters, 0110 const bool theIsReplace, 0111 ParameterMap& theMap); 0112 0113 //! Sets parameters for shape processing. 0114 //! Parameters from @p theParameters are copied to the output map. 0115 //! Parameters from @p theAdditionalParameters are copied to the output map 0116 //! if they are not present in @p theParameters. 0117 //! @param theParameters the parameters for shape processing. 0118 //! @param theAdditionalParameters the additional parameters for shape processing. 0119 //! @param theTargetParameterMap Map to set the parameters in. 0120 Standard_EXPORT static void SetShapeFixParameters(const DE_ShapeFixParameters& theParameters, 0121 const ParameterMap& theAdditionalParameters, 0122 ParameterMap& theTargetParameterMap); 0123 0124 //! Set the parameter in the map. 0125 //! @param theKey Key of the parameter. 0126 //! @param theValue Value of the parameter. 0127 //! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists 0128 //! in the map. 0129 //! @param theMap Map to set the parameter in. 0130 Standard_EXPORT static void SetParameter(const char* theKey, 0131 const DE_ShapeFixParameters::FixMode theValue, 0132 const bool theIsReplace, 0133 XSAlgo_ShapeProcessor::ParameterMap& theMap); 0134 0135 //! Set the parameter in the map. 0136 //! @param theKey Key of the parameter. 0137 //! @param theValue Value of the parameter. 0138 //! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists 0139 //! in the map. 0140 //! @param theMap Map to set the parameter in. 0141 Standard_EXPORT static void SetParameter(const char* theKey, 0142 const double theValue, 0143 const bool theIsReplace, 0144 ParameterMap& theMap); 0145 0146 //! Set the parameter in the map. 0147 //! @param theKey Key of the parameter. 0148 //! @param theValue Value of the parameter. 0149 //! @param theIsReplace Flag indicating whether parameter should be replaced if it already exists 0150 //! in the map. 0151 //! @param theMap Map to set the parameter in. 0152 Standard_EXPORT static void SetParameter(const char* theKey, 0153 const TCollection_AsciiString& theValue, 0154 const bool theIsReplace, 0155 ParameterMap& theMap); 0156 0157 //! The function is designed to set the length unit for the application before performing a 0158 //! transfer operation. It ensures that the length unit is correctly configured based on the 0159 //! value associated with the key "xstep.cascade.unit". 0160 Standard_EXPORT static void PrepareForTransfer(); 0161 0162 //! Merge the results of the shape processing with the finder process. 0163 //! @param theTransientProcess Transfer process to merge with. 0164 //! @param theModifiedShapesMap Map of modified shapes. 0165 //! @param theFirstTPItemIndex Index of the first item in the transfer process to merge with. 0166 //! @param theMessages Messages to add. 0167 Standard_EXPORT static void MergeShapeTransferInfo( 0168 const Handle(Transfer_TransientProcess)& theFinderProcess, 0169 const TopTools_DataMapOfShapeShape& theModifiedShapesMap, 0170 const Standard_Integer theFirstTPItemIndex, 0171 Handle(ShapeExtend_MsgRegistrator) theMessages); 0172 0173 //! Merge the results of the shape processing with the transfer process. 0174 //! @param theTransientProcess Transfer process to merge with. 0175 //! @param theModifiedShapesMap Map of modified shapes. 0176 //! @param theFirstTPItemIndex Index of the first item in the transfer process to merge with. 0177 //! @param theMessages Messages to add. 0178 Standard_EXPORT static void MergeShapeTransferInfo( 0179 const Handle(Transfer_FinderProcess)& theTransientProcess, 0180 const TopTools_DataMapOfShapeShape& theModifiedShapesMap, 0181 Handle(ShapeExtend_MsgRegistrator) theMessages); 0182 0183 private: 0184 //! Initialize the context with the specified shape. 0185 //! @param theShape Shape to process. 0186 void initializeContext(const TopoDS_Shape& theShape); 0187 0188 //! Add messages from the specified shape to the transfer binder. 0189 //! @param theMessages Container with messages. 0190 //! @param theShape Shape to get messages from. 0191 //! @param theBinder Transfer binder to add messages to. 0192 static void addMessages(const Handle(ShapeExtend_MsgRegistrator)& theMessages, 0193 const TopoDS_Shape& theShape, 0194 Handle(Transfer_Binder)& theBinder); 0195 0196 //! Create a new edge with the same geometry as the source edge. 0197 //! @param theSourceEdge Source edge. 0198 //! @return New edge with the same geometry. 0199 static TopoDS_Edge MakeEdgeOnCurve(const TopoDS_Edge& aSourceEdge); 0200 0201 private: 0202 ParameterMap myParameters; //!< Parameters to be used in the processing. 0203 Handle(ShapeProcess_ShapeContext) myContext; //!< Shape context. 0204 }; 0205 0206 #endif // _XSAlgo_ShapeProcessor_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|