Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2000-08-22
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_ShapeContext_HeaderFile
0017 #define _ShapeProcess_ShapeContext_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TopoDS_Shape.hxx>
0023 #include <TopTools_DataMapOfShapeShape.hxx>
0024 #include <TopAbs_ShapeEnum.hxx>
0025 #include <ShapeProcess_Context.hxx>
0026 #include <Message_Gravity.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 class ShapeExtend_MsgRegistrator;
0029 class ShapeBuild_ReShape;
0030 class BRepTools_Modifier;
0031 class Message_Msg;
0032 
0033 
0034 class ShapeProcess_ShapeContext;
0035 DEFINE_STANDARD_HANDLE(ShapeProcess_ShapeContext, ShapeProcess_Context)
0036 
0037 //! Extends Context to handle shapes
0038 //! Contains map of shape-shape, and messages
0039 //! attached to shapes
0040 class ShapeProcess_ShapeContext : public ShapeProcess_Context
0041 {
0042 
0043 public:
0044 
0045   
0046   Standard_EXPORT ShapeProcess_ShapeContext(const Standard_CString file, const Standard_CString seq = "");
0047   
0048   //! Initializes a tool by resource file and shape
0049   //! to be processed
0050   Standard_EXPORT ShapeProcess_ShapeContext(const TopoDS_Shape& S, const Standard_CString file, const Standard_CString seq = "");
0051   
0052   //! Initializes tool by a new shape and clears all results
0053   Standard_EXPORT void Init (const TopoDS_Shape& S);
0054   
0055   //! Returns shape being processed
0056   Standard_EXPORT const TopoDS_Shape& Shape() const;
0057   
0058   //! Returns current result
0059   Standard_EXPORT const TopoDS_Shape& Result() const;
0060   
0061   //! Returns map of replacements shape -> shape
0062   //! This map is not recursive
0063   Standard_EXPORT const TopTools_DataMapOfShapeShape& Map() const;
0064   
0065   Standard_EXPORT const Handle(ShapeExtend_MsgRegistrator)& Messages() const;
0066   
0067   //! Returns messages recorded during shape processing
0068   //! It can be nullified before processing in order to
0069   //! avoid recording messages
0070   Standard_EXPORT Handle(ShapeExtend_MsgRegistrator)& Messages();
0071   
0072   Standard_EXPORT void SetDetalisation (const TopAbs_ShapeEnum level);
0073   
0074   //! Set and get value for detalisation level
0075   //! Only shapes of types from TopoDS_COMPOUND and until
0076   //! specified detalisation level will be recorded in maps
0077   //! To cancel mapping, use TopAbs_SHAPE
0078   //! To force full mapping, use TopAbs_VERTEX
0079   //! The default level is TopAbs_FACE
0080   Standard_EXPORT TopAbs_ShapeEnum GetDetalisation() const;
0081   
0082   //! Sets a new result shape
0083   //! NOTE: this method should be used very carefully
0084   //! to keep consistency of modifications
0085   //! It is recommended to use RecordModification() methods
0086   //! with explicit definition of mapping from current
0087   //! result to a new one
0088   Standard_EXPORT void SetResult (const TopoDS_Shape& S);
0089   
0090   Standard_EXPORT void RecordModification (const TopTools_DataMapOfShapeShape& repl, const Handle(ShapeExtend_MsgRegistrator)& msg = 0);
0091   
0092   Standard_EXPORT void RecordModification (const Handle(ShapeBuild_ReShape)& repl, const Handle(ShapeExtend_MsgRegistrator)& msg);
0093   
0094   Standard_EXPORT void RecordModification (const Handle(ShapeBuild_ReShape)& repl);
0095   
0096   //! Records modifications and resets result accordingly
0097   //! NOTE: modification of resulting shape should be explicitly
0098   //! defined in the maps along with modifications of subshapes
0099   //!
0100   //! In the last function, sh is the shape on which Modifier
0101   //! was run. It can be different from the whole shape,
0102   //! but in that case result as a whole should be reset later
0103   //! either by call to SetResult(), or by another call to
0104   //! RecordModification() which contains mapping of current
0105   //! result to a new one explicitly
0106   Standard_EXPORT void RecordModification (const TopoDS_Shape& sh, const BRepTools_Modifier& repl, const Handle(ShapeExtend_MsgRegistrator)& msg = 0);
0107   
0108   //! Record a message for shape S
0109   //! Shape S should be one of subshapes of original shape
0110   //! (or whole one), but not one of intermediate shapes
0111   //! Records only if Message() is not Null
0112   Standard_EXPORT void AddMessage (const TopoDS_Shape& S, const Message_Msg& msg, const Message_Gravity gravity = Message_Warning);
0113   
0114   //! Get value of parameter as being of the type GeomAbs_Shape
0115   //! Returns False if parameter is not defined or has a wrong type
0116   Standard_EXPORT Standard_Boolean GetContinuity (const Standard_CString param, GeomAbs_Shape& val) const;
0117   
0118   //! Get value of parameter as being of the type GeomAbs_Shape
0119   //! If parameter is not defined or does not have expected
0120   //! type, returns default value as specified
0121   Standard_EXPORT GeomAbs_Shape ContinuityVal (const Standard_CString param, const GeomAbs_Shape def) const;
0122   
0123   //! Prints statistics on Shape Processing onto the current Messenger.
0124   Standard_EXPORT void PrintStatistics() const;
0125 
0126   //! Set NonManifold flag
0127   void SetNonManifold(Standard_Boolean theNonManifold)
0128   {
0129       myNonManifold = theNonManifold;
0130   }
0131 
0132   //! Get NonManifold flag
0133   Standard_Boolean IsNonManifold()
0134   {
0135       return myNonManifold;
0136   }
0137 
0138 
0139   DEFINE_STANDARD_RTTIEXT(ShapeProcess_ShapeContext,ShapeProcess_Context)
0140 
0141 protected:
0142 
0143 
0144 
0145 
0146 private:
0147 
0148 
0149   TopoDS_Shape myShape;
0150   TopoDS_Shape myResult;
0151   TopTools_DataMapOfShapeShape myMap;
0152   Handle(ShapeExtend_MsgRegistrator) myMsg;
0153   TopAbs_ShapeEnum myUntil;
0154   Standard_Boolean myNonManifold;
0155 
0156 };
0157 
0158 
0159 
0160 
0161 
0162 
0163 
0164 #endif // _ShapeProcess_ShapeContext_HeaderFile