Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-23 10:18:57

0001 // Created on: 2008-06-25
0002 // Created by: data exchange team
0003 // Copyright (c) 2008-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 _Draw_ProgressIndicator_HeaderFile
0017 #define _Draw_ProgressIndicator_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <Message_ProgressIndicator.hxx>
0022 #include <Standard_ThreadId.hxx>
0023 #include <Draw_Interpretor.hxx>
0024 
0025 //! Implements ProgressIndicator (interface provided by Message)
0026 //! for DRAW, with possibility to output to TCL window
0027 //! and/or trace file
0028 class Draw_ProgressIndicator : public Message_ProgressIndicator
0029 {
0030 
0031 public:
0032   //! Creates a progress indicator and remembers pointer to Draw_Interpretor
0033   //!
0034   //! @param theUpdateThreshold defines minimal progress (in percents) between
0035   //! updates of the indicator (non-forced updates of the progress bar will be
0036   //! disabled until that progress is reached since last update).
0037   Standard_EXPORT Draw_ProgressIndicator(const Draw_Interpretor& di,
0038                                          double                  theUpdateThreshold = 1.);
0039 
0040   //! Destructor; calls Reset()
0041   Standard_EXPORT ~Draw_ProgressIndicator() override;
0042 
0043   //! Sets tcl output mode (on/off).
0044   Standard_EXPORT void SetTclMode(const bool theTclMode);
0045 
0046   //! Gets tcl output mode (on/off).
0047   Standard_EXPORT bool GetTclMode() const;
0048 
0049   //! Sets console output mode (on/off).
0050   //! If it is on then progress is shown in the standard output.
0051   Standard_EXPORT void SetConsoleMode(const bool theMode);
0052 
0053   //! Gets console output mode (on/off)
0054   Standard_EXPORT bool GetConsoleMode() const;
0055 
0056   //! Sets graphical output mode (on/off)
0057   Standard_EXPORT void SetGraphMode(const bool theGraphMode);
0058 
0059   //! Gets graphical output mode (on/off)
0060   Standard_EXPORT bool GetGraphMode() const;
0061 
0062   //! Clears/erases opened TCL windows if any
0063   //! and sets myBreak to False
0064   Standard_EXPORT void Reset() override;
0065 
0066   //! Defines method Show of Progress Indicator
0067   Standard_EXPORT void Show(const Message_ProgressScope& theScope,
0068                             const bool                   force = true) override;
0069 
0070   //! Redefines method UserBreak of Progress Indicator
0071   Standard_EXPORT bool UserBreak() override;
0072 
0073   //! Get/Set default value for tcl mode
0074   Standard_EXPORT static bool& DefaultTclMode();
0075 
0076   //! Get/Set default value for console mode
0077   Standard_EXPORT static bool& DefaultConsoleMode();
0078 
0079   //! Get/Set default value for graph mode
0080   Standard_EXPORT static bool& DefaultGraphMode();
0081 
0082   //! Internal method for implementation of UserBreak mechanism;
0083   //! note that it uses static variable and thus not thread-safe!
0084   Standard_EXPORT static void*& StopIndicator();
0085 
0086   DEFINE_STANDARD_RTTIEXT(Draw_ProgressIndicator, Message_ProgressIndicator)
0087 
0088 private:
0089   bool              myTclMode;
0090   bool              myConsoleMode;
0091   bool              myGraphMode;
0092   Draw_Interpretor* myDraw;
0093   bool              myShown;
0094   bool              myBreak;
0095   double            myUpdateThreshold;
0096   double            myLastPosition;
0097   size_t            myStartTime;
0098   Standard_ThreadId myGuiThreadId;
0099 };
0100 
0101 #endif // _Draw_ProgressIndicator_HeaderFile