0030346: Modeling Algorithms - BRepPrimAPI_MakeRevol throws "BRepSweep_Translation...
[occt.git] / src / BRepTest / BRepTest_Objects.cxx
CommitLineData
4f7d41ea 1// Created on: 2018/03/21
2// Created by: Eugeny MALTCHIKOV
3// Copyright (c) 2018 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#include <BRepTest_Objects.hxx>
17
18//=======================================================================
19//function : BRepTest_Session
20//purpose : Class for the objects in the session
21//=======================================================================
22class BRepTest_Session
23{
24public:
25
26 //! Empty constructor
948fe6ca 27 BRepTest_Session()
28 {
29 SetDefaultValues();
30 }
31
32 //! Sets the default values for the options
33 void SetDefaultValues()
34 {
35 myFillHistory = Standard_True;
36 }
4f7d41ea 37
38 //! Sets the History in the session
39 void SetHistory(const Handle(BRepTools_History)& theHistory)
40 {
41 myHistory = theHistory;
42 }
43
44 //! Add the History to the history in the session
45 void AddHistory(const Handle(BRepTools_History)& theHistory)
46 {
47 if (myHistory.IsNull())
48 myHistory = new BRepTools_History;
49 myHistory->Merge(theHistory);
50 }
51
52 //! Returns the history from the session
53 const Handle(BRepTools_History)& History() const
54 {
55 return myHistory;
56 }
57
948fe6ca 58 //! Enables/Disables the history saving
59 void SetToFillHistory(const Standard_Boolean theFillHist)
60 {
61 myFillHistory = theFillHist;
62 }
63
64 //! Returns the flag controlling the history saving
65 Standard_Boolean IsHistoryNeeded() const { return myFillHistory; }
66
4f7d41ea 67private:
68
69 Handle(BRepTools_History) myHistory;
948fe6ca 70 Standard_Boolean myFillHistory;
4f7d41ea 71};
72
73//=======================================================================
74//function : GetSession
75//purpose :
76//=======================================================================
77static BRepTest_Session& GetSession()
78{
79 static BRepTest_Session* pSession = new BRepTest_Session();
80 return *pSession;
81}
82
83//=======================================================================
84//function : SetHistory
85//purpose :
86//=======================================================================
87void BRepTest_Objects::SetHistory(const Handle(BRepTools_History)& theHistory)
88{
89 GetSession().SetHistory(theHistory);
90}
91
92//=======================================================================
93//function : AddHistory
94//purpose :
95//=======================================================================
96void BRepTest_Objects::AddHistory(const Handle(BRepTools_History)& theHistory)
97{
98 GetSession().AddHistory(theHistory);
99}
100
101//=======================================================================
102//function : History
103//purpose :
104//=======================================================================
105Handle(BRepTools_History) BRepTest_Objects::History()
106{
107 return GetSession().History();
108}
948fe6ca 109
110//=======================================================================
111//function : SetToFillHistory
112//purpose :
113//=======================================================================
114void BRepTest_Objects::SetToFillHistory(const Standard_Boolean theFillHist)
115{
116 return GetSession().SetToFillHistory(theFillHist);
117}
118
119//=======================================================================
120//function : IsHistoryNeeded
121//purpose :
122//=======================================================================
123Standard_Boolean BRepTest_Objects::IsHistoryNeeded()
124{
125 return GetSession().IsHistoryNeeded();
126}