Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:14

0001 // Copyright (c) 2013 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 _BRepMesh_DiscretFactory_HeaderFile
0015 #define _BRepMesh_DiscretFactory_HeaderFile
0016 
0017 #include <Standard.hxx>
0018 #include <Standard_DefineAlloc.hxx>
0019 #include <Standard_Macro.hxx>
0020 #include <BRepMesh_PluginEntryType.hxx>
0021 #include <BRepMesh_FactoryError.hxx>
0022 #include <TColStd_MapOfAsciiString.hxx>
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Plugin_MapOfFunctions.hxx>
0025 #include <BRepMesh_DiscretRoot.hxx>
0026 
0027 class TopoDS_Shape;
0028 
0029 //! This class intended to setup / retrieve default triangulation algorithm. <br>
0030 //! Use BRepMesh_DiscretFactory::Get() static method to retrieve global Factory instance. <br>
0031 //! Use BRepMesh_DiscretFactory::Discret() method to retrieve meshing tool. <br>
0032 class BRepMesh_DiscretFactory
0033 {
0034 public:
0035 
0036   DEFINE_STANDARD_ALLOC
0037   
0038   //! Returns the global factory instance.
0039   Standard_EXPORT static BRepMesh_DiscretFactory& Get();
0040   
0041   //! Returns the list of registered meshing algorithms.
0042   const TColStd_MapOfAsciiString& Names() const
0043   {
0044     return myNames;
0045   }
0046   
0047   //! Setup meshing algorithm by name. <br>
0048   //! Returns TRUE if requested tool is available. <br>
0049   //! On fail Factory will continue to use previous algo.
0050   Standard_Boolean SetDefaultName(const TCollection_AsciiString& theName)
0051   {
0052     return SetDefault(theName, myFunctionName);
0053   }
0054   
0055   //! Returns name for current meshing algorithm.
0056   const TCollection_AsciiString& DefaultName() const
0057   {
0058     return myDefaultName;
0059   }
0060   
0061   //! Advanced function. Changes function name to retrieve from plugin. <br>
0062   //! Returns TRUE if requested tool is available. <br>
0063   //! On fail Factory will continue to use previous algo.
0064   Standard_Boolean SetFunctionName(const TCollection_AsciiString& theFuncName)
0065   {
0066     return SetDefault(myDefaultName, theFuncName);
0067   }
0068   
0069   //! Returns function name that should be exported by plugin.
0070   const TCollection_AsciiString& FunctionName() const
0071   {
0072     return myFunctionName;
0073   }
0074   
0075   //! Returns error status for last meshing algorithm switch.
0076   BRepMesh_FactoryError ErrorStatus() const
0077   {
0078     return myErrorStatus;
0079   }
0080 
0081   //! Setup meshing algorithm that should be created by this Factory. <br>
0082   //! Returns TRUE if requested tool is available. <br>
0083   //! On fail Factory will continue to use previous algo. <br>
0084   //! Call ::ErrorStatus() method to retrieve fault reason.
0085   Standard_EXPORT Standard_Boolean SetDefault(const TCollection_AsciiString& theName,
0086                                               const TCollection_AsciiString& theFuncName = "DISCRETALGO");
0087 
0088   //! Returns triangulation algorithm instance.
0089   //! @param theShape shape to be meshed.
0090   //! @param theLinDeflection linear deflection to be used for meshing.
0091   //! @param theAngDeflection angular deflection to be used for meshing.
0092   Standard_EXPORT Handle(BRepMesh_DiscretRoot) Discret(const TopoDS_Shape& theShape,
0093                                                        const Standard_Real theLinDeflection,
0094                                                        const Standard_Real theAngDeflection);
0095 
0096 protected:
0097   
0098   //! Constructor
0099   Standard_EXPORT BRepMesh_DiscretFactory();
0100 
0101   //! Destructor
0102   Standard_EXPORT virtual ~BRepMesh_DiscretFactory();
0103 
0104   //! Clears factory data.
0105   Standard_EXPORT void clear();
0106 
0107   BRepMesh_PluginEntryType  myPluginEntry;
0108   BRepMesh_FactoryError     myErrorStatus;
0109   TColStd_MapOfAsciiString  myNames;
0110   TCollection_AsciiString   myDefaultName;
0111   TCollection_AsciiString   myFunctionName;
0112   Plugin_MapOfFunctions     myFactoryMethods;
0113 };
0114 
0115 #endif