0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / TObj / TObj_Application.hxx
CommitLineData
b311480e 1// Created on: 2004-11-23
2// Created by: Pavel TELKOV
973c2be1 3// Copyright (c) 2004-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// The original implementation Copyright: (C) RINA S.p.A
17
18#ifndef TObj_Application_HeaderFile
19#define TObj_Application_HeaderFile
20
21#include <TDocStd_Application.hxx>
22#include <TObj_Common.hxx>
23#include <Message_Gravity.hxx>
24#include <Message_Messenger.hxx>
b7c077b9 25#include <TColStd_SequenceOfExtendedString.hxx>
7fd59977 26
7fd59977 27//!
28//! This is a base class for OCAF based TObj models
29//! with declared virtual methods
30//!
7fd59977 31class TObj_Application : public TDocStd_Application
32{
33public:
34 //! Returns static instance of the application
35 Standard_EXPORT static Handle(TObj_Application) GetInstance();
36
37 //! Returns reference to associated messenger handle
38 Standard_EXPORT Handle(Message_Messenger) &Messenger() { return myMessenger; }
39
40 public:
41 /**
42 * Load/Save support
43 */
44
45 //! Saving the OCAF document to a file
be70005c 46 Standard_EXPORT virtual Standard_Boolean SaveDocument
47 (const Handle(TDocStd_Document)& theSourceDoc,
48 const TCollection_ExtendedString& theTargetFile);
7fd59977 49
50 //! Loading the OCAF document from a file
be70005c 51 Standard_EXPORT virtual Standard_Boolean LoadDocument
52 (const TCollection_ExtendedString& theSourceFile,
53 Handle(TDocStd_Document)& theTargetDoc);
7fd59977 54
55 //! Create the OCAF document from scratch
56 virtual Standard_EXPORT Standard_Boolean CreateNewDocument
57 (Handle(TDocStd_Document)& theDoc,
58 const TCollection_ExtendedString& theFormat);
59
60 //! Signal error during Load or Save
61 //! Default imiplementation is empty
62 virtual Standard_EXPORT void ErrorMessage
63 (const TCollection_ExtendedString &theMsg,
64 const Message_Gravity theLevel);
65
66 //! Signal error during Load or Save
67 //! Default imiplementation invoke previous declaration with 0
68 virtual Standard_EXPORT void ErrorMessage
69 (const TCollection_ExtendedString &theMsg)
70 { ErrorMessage( theMsg, Message_Alarm ); }
71
72
73 //! Sets the verbose flag, meaning that load/save models should show
74 //! CPU and elapsed times
75 void SetVerbose (const Standard_Boolean isVerbose)
76 { myIsVerbose = isVerbose; }
77
78 //! Returns the verbose flag
79 Standard_Boolean IsVerbose () const
80 { return myIsVerbose; }
81
82 public:
83 /**
84 * Redefined OCAF methods
85 */
86
87 //! Return name of resource (i.e. "TObj")
79104795 88 virtual Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE;
7fd59977 89
7fd59977 90 protected:
91 /**
92 * Constructor
93 */
94
95 //! Constructor is protected. Use method GetInstance() method to obtain
96 //! the static instance of the object (or derive your own application)
97 Standard_EXPORT TObj_Application();
98
99 private:
100 /**
101 * Fields
102 */
103
104 Standard_Boolean myIsError; //!< error flag
105 Standard_Boolean myIsVerbose; //!< verbose flag
106 Handle(Message_Messenger) myMessenger; //!< messenger
7fd59977 107
108 public:
109 //! CASCADE RTTI
92efcf78 110 DEFINE_STANDARD_RTTIEXT(TObj_Application,TDocStd_Application)
7fd59977 111};
112
113
114//! Define handle class
115DEFINE_STANDARD_HANDLE(TObj_Application,TDocStd_Application)
116
117#endif