Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:05

0001 // Created on: 2016-04-07
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
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 _IMeshTools_ModelBuilder_HeaderFile
0017 #define _IMeshTools_ModelBuilder_HeaderFile
0018 
0019 #include <Message_Algorithm.hxx>
0020 #include <Standard_ErrorHandler.hxx>
0021 #include <Standard_Failure.hxx>
0022 #include <Standard_Type.hxx>
0023 #include <IMeshData_Model.hxx>
0024 
0025 struct IMeshTools_Parameters;
0026 
0027 //! Interface class represents API for tool building discrete model.
0028 //! 
0029 //! The following statuses should be used by default:
0030 //! Message_Done1 - model has been successfully built.
0031 //! Message_Fail1 - empty shape.
0032 //! Message_Fail2 - model has not been build due to unexpected reason.
0033 class IMeshTools_ModelBuilder : public Message_Algorithm
0034 {
0035 public:
0036 
0037   //! Destructor.
0038   virtual ~IMeshTools_ModelBuilder()
0039   {
0040   }
0041 
0042   //! Exceptions protected method to create discrete model for the given shape.
0043   //! Returns nullptr in case of failure.
0044   Handle (IMeshData_Model) Perform (
0045     const TopoDS_Shape&          theShape,
0046     const IMeshTools_Parameters& theParameters)
0047   {
0048     ClearStatus ();
0049 
0050     try
0051     {
0052       OCC_CATCH_SIGNALS
0053 
0054       return performInternal (theShape, theParameters);
0055     }
0056     catch (Standard_Failure const&)
0057     {
0058       SetStatus (Message_Fail2);
0059       return NULL;
0060     }
0061   }
0062 
0063   DEFINE_STANDARD_RTTIEXT(IMeshTools_ModelBuilder, Message_Algorithm)
0064 
0065 protected:
0066 
0067   //! Constructor.
0068   IMeshTools_ModelBuilder()
0069   {
0070   }
0071 
0072   //! Creates discrete model for the given shape.
0073   //! Returns nullptr in case of failure.
0074   Standard_EXPORT virtual Handle (IMeshData_Model) performInternal (
0075     const TopoDS_Shape&          theShape,
0076     const IMeshTools_Parameters& theParameters) = 0;
0077 };
0078 
0079 #endif