Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GEOM_BaseObject.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef _GEOM_BaseObject_HeaderFile
24 #define _GEOM_BaseObject_HeaderFile
25 
26 #include "GEOM_Function.hxx"
27 
28 #include <Standard_GUID.hxx>
29 #include <TColStd_HSequenceOfTransient.hxx>
30 #include <TCollection_AsciiString.hxx>
31 #include <TDF_Label.hxx>
32 #include <TDataStd_TreeNode.hxx>
33 #include <TFunction_Driver.hxx>
34 
35 #include <vector>
36 
37 class GEOM_BaseObject;
38 class GEOM_Engine;
39 
41 
43 {
44  friend class GEOM_Engine;
45 
46 protected:
47  Standard_EXPORT GEOM_BaseObject(const TDF_Label& theLabel);
48 
49 public:
50 
51  Standard_EXPORT GEOM_BaseObject(const TDF_Label& theEntry, int theType);
52  Standard_EXPORT ~GEOM_BaseObject();
53 
54  //Finds a GEOM_BaseObject on the label theLabel
55  Standard_EXPORT static Handle(GEOM_BaseObject) GetObject(const TDF_Label& theLabel);
56 
57  //Finds a GEOM_BaseObject by a reference, stored on the label theLabel
58  Standard_EXPORT static Handle(GEOM_BaseObject) GetReferencedObject(const TDF_Label& theLabel);
59 
60  // Returns type of a object (GEOM_POINT, GEOM_VECTOR...) on theLabel, -1 if no object is there
61  Standard_EXPORT static int GetType(const TDF_Label& theLabel);
62 
63  //Returns a GEOM_BaseObject common GUID.
64  // This GUID marks the label of any object in GEOM module
65  Standard_EXPORT static const Standard_GUID& GetObjectID();
66 
67  //Returns a GUID associated with a sub-shape object
68  // This GUID corresponds to GEOM_SubShapeDriver
69  Standard_EXPORT static const Standard_GUID& GetSubShapeID();
70 
71  //###########################################################
72  //Access to properties
73  //###########################################################
74 
75  //Returns a TreeNode that presents a root of a function tree for this GEOM_BaseObject
76  Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
77 
78  //Returns a label of this GEOM_BaseObject
79  Standard_EXPORT TDF_Label GetEntry() const { return _label; }
80 
81  //Returns an entry of this GEOM_BaseObject
82  Standard_EXPORT TCollection_AsciiString GetEntryString();
83 
84  //Returns a type of this GEOM_BaseObject (GEOM_POINT, GEOM_VECTOR...)
85  Standard_EXPORT int GetType();
86 
87  //Sets the type of this GEOM_BaseObject
88  Standard_EXPORT void SetType(int theType);
89 
90  //Modifications counter management
91  Standard_EXPORT int GetTic();
92  Standard_EXPORT void SetTic(int theTic);
93  Standard_EXPORT void IncrementTic();
94 
95  //Returns an ID of the OCAF document where this GEOM_BaseObject is stored
96  Standard_EXPORT int GetDocID();
97 
98  //Sets a name of this GEOM_BaseObject
99  Standard_EXPORT void SetName(const char* theName);
100 
101  //Returns a name of this GEOM_BaseObject
102  Standard_EXPORT TCollection_AsciiString GetName();
103 
104  //Sets an auxiliary data
105  Standard_EXPORT void SetAuxData(const char* theData);
106 
107  //Returns an auxiliary data
108  Standard_EXPORT TCollection_AsciiString GetAuxData();
109 
110  //Set a notebook variables used for object creation
111  Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
112 
113  //Get a notebook variables used for object creation
114  Standard_EXPORT TCollection_AsciiString GetParameters() const;
115 
116  //###########################################################
117  // CORBA related methods
118  //###########################################################
119 
120  //Sets an IOR of CORBA GEOM_BaseObject_i which refers to this object
121  Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
122 
123  //Returns an IOR of CORBA GEOM_BaseObject_i which refers to this object
124  Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
125 
126  //###########################################################
127  //Functions methods
128  //###########################################################
129 
130  //Adds a function with a driver GUID = theGUID and a type theFunctionType
131  //to the function tree of this GEOM_BaseObject
132  Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID,
134  bool allowSubShape=false);
135 
136  //Returns a number of functions of this GEOM_BaseObject
137  Standard_EXPORT int GetNbFunctions();
138 
139  //Returns a function with given number theFunctionNumber
140  Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
141 
142  //Return the last function of this GEOM_BaseObject
143  Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
144 
145  //Returns all dependencies of the object
146  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency();
147 
148  //Returns the dependencies of the last function
149  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
150 
151  //Returns drivers creators of this object
152  Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver(int funNb);
153 
154  //###########################################################
155  // Internal methods
156  //###########################################################
157 
158  //Returns a label which could be used to store some additional data
159  Standard_EXPORT TDF_Label GetFreeLabel();
160 
161  protected:
162  Handle(TDataStd_TreeNode) _root;
163  TDF_Label _label;
164  TCollection_AsciiString _ior;
165  TCollection_AsciiString _parameters;
166  int _docID;
167 
168 public:
170 };
171 
172 #endif