1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _GEOM_BaseObject_HeaderFile
24 #define _GEOM_BaseObject_HeaderFile
26 #include "GEOM_Function.hxx"
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>
37 class GEOM_BaseObject;
40 DEFINE_STANDARD_HANDLE( GEOM_BaseObject, Standard_Transient );
42 class GEOM_BaseObject : public Standard_Transient
44 friend class GEOM_Engine;
47 Standard_EXPORT GEOM_BaseObject(const TDF_Label& theLabel);
51 Standard_EXPORT GEOM_BaseObject(const TDF_Label& theEntry, int theType);
52 Standard_EXPORT ~GEOM_BaseObject();
54 //Finds a GEOM_BaseObject on the label theLabel
55 Standard_EXPORT static Handle(GEOM_BaseObject) GetObject(const TDF_Label& theLabel);
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);
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);
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();
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();
71 //###########################################################
72 //Access to properties
73 //###########################################################
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; }
78 //Returns a label of this GEOM_BaseObject
79 Standard_EXPORT TDF_Label GetEntry() const { return _label; }
81 //Returns an entry of this GEOM_BaseObject
82 Standard_EXPORT TCollection_AsciiString GetEntryString();
84 //Returns a type of this GEOM_BaseObject (GEOM_POINT, GEOM_VECTOR...)
85 Standard_EXPORT int GetType();
87 //Sets the type of this GEOM_BaseObject
88 Standard_EXPORT void SetType(int theType);
90 //Modifications counter management
91 Standard_EXPORT int GetTic();
92 Standard_EXPORT void SetTic(int theTic);
93 Standard_EXPORT void IncrementTic();
95 //Returns an ID of the OCAF document where this GEOM_BaseObject is stored
96 Standard_EXPORT int GetDocID();
98 //Sets a name of this GEOM_BaseObject
99 Standard_EXPORT void SetName(const char* theName);
101 //Returns a name of this GEOM_BaseObject
102 Standard_EXPORT TCollection_AsciiString GetName();
104 //Sets an auxiliary data
105 Standard_EXPORT void SetAuxData(const char* theData);
107 //Returns an auxiliary data
108 Standard_EXPORT TCollection_AsciiString GetAuxData();
110 //Set a notebook variables used for object creation
111 Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
113 //Get a notebook variables used for object creation
114 Standard_EXPORT TCollection_AsciiString GetParameters() const;
116 //###########################################################
117 // CORBA related methods
118 //###########################################################
120 //Sets an IOR of CORBA GEOM_BaseObject_i which refers to this object
121 Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
123 //Returns an IOR of CORBA GEOM_BaseObject_i which refers to this object
124 Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
126 //###########################################################
128 //###########################################################
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);
136 //Returns a number of functions of this GEOM_BaseObject
137 Standard_EXPORT int GetNbFunctions();
139 //Returns a function with given number theFunctionNumber
140 Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
142 //Return the last function of this GEOM_BaseObject
143 Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
145 //Returns all dependencies of the object
146 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency();
148 //Returns the dependencies of the last function
149 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
151 //Returns drivers creators of this object
152 Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver(int funNb);
154 //###########################################################
156 //###########################################################
158 //Returns a label which could be used to store some additional data
159 Standard_EXPORT TDF_Label GetFreeLabel();
162 Handle(TDataStd_TreeNode) _root;
164 TCollection_AsciiString _ior;
165 TCollection_AsciiString _parameters;
169 DEFINE_STANDARD_RTTIEXT(GEOM_BaseObject,Standard_Transient)