1 // Copyright (C) 2007-2014 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>
34 class GEOM_BaseObject;
35 class Handle(TFunction_Driver);
38 DEFINE_STANDARD_HANDLE( GEOM_BaseObject, Standard_Transient );
40 class GEOM_BaseObject : public Standard_Transient
42 friend class GEOM_Engine;
45 Standard_EXPORT GEOM_BaseObject(const TDF_Label& theLabel);
49 Standard_EXPORT GEOM_BaseObject(const TDF_Label& theEntry, int theType);
50 Standard_EXPORT ~GEOM_BaseObject();
52 //Finds a GEOM_BaseObject on the label theLabel
53 Standard_EXPORT static Handle(GEOM_BaseObject) GetObject(const TDF_Label& theLabel);
55 //Finds a GEOM_BaseObject by a reference, stored on the label theLabel
56 Standard_EXPORT static Handle(GEOM_BaseObject) GetReferencedObject(const TDF_Label& theLabel);
58 // Returns type of a object (GEOM_POINT, GEOM_VECTOR...) on theLabel, -1 if no object is there
59 Standard_EXPORT static int GetType(const TDF_Label& theLabel);
61 //Returns a GEOM_BaseObject common GUID.
62 // This GUID marks the label of any object in GEOM module
63 Standard_EXPORT static const Standard_GUID& GetObjectID();
65 //Returns a GUID associated with a sub-shape object
66 // This GUID corresponds to GEOM_SubShapeDriver
67 Standard_EXPORT static const Standard_GUID& GetSubShapeID();
69 //###########################################################
70 //Access to properties
71 //###########################################################
73 //Returns a TreeNode that presents a root of a function tree for this GEOM_BaseObject
74 Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
76 //Returns a label of this GEOM_BaseObject
77 Standard_EXPORT TDF_Label GetEntry() const { return _label; }
79 //Returns an entry of this GEOM_BaseObject
80 Standard_EXPORT TCollection_AsciiString GetEntryString();
82 //Returns a type of this GEOM_BaseObject (GEOM_POINT, GEOM_VECTOR...)
83 Standard_EXPORT int GetType();
85 //Sets the type of this GEOM_BaseObject
86 Standard_EXPORT void SetType(int theType);
88 //Modifications counter management
89 Standard_EXPORT int GetTic();
90 Standard_EXPORT void SetTic(int theTic);
91 Standard_EXPORT void IncrementTic();
93 //Returns an ID of the OCAF document where this GEOM_BaseObject is stored
94 Standard_EXPORT int GetDocID();
96 //Sets a name of this GEOM_BaseObject
97 Standard_EXPORT void SetName(const char* theName);
99 //Returns a name of this GEOM_BaseObject
100 Standard_EXPORT TCollection_AsciiString GetName();
102 //Sets an auxiliary data
103 Standard_EXPORT void SetAuxData(const char* theData);
105 //Returns an auxiliary data
106 Standard_EXPORT TCollection_AsciiString GetAuxData();
108 //Set a notebook variables used for object creation
109 Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
111 //Get a notebook variables used for object creation
112 Standard_EXPORT TCollection_AsciiString GetParameters() const;
114 //###########################################################
115 // CORBA related methods
116 //###########################################################
118 //Sets an IOR of CORBA GEOM_BaseObject_i which refers to this object
119 Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
121 //Returns an IOR of CORBA GEOM_BaseObject_i which refers to this object
122 Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
124 //###########################################################
126 //###########################################################
128 //Adds a function with a driver GUID = theGUID and a type theFunctionType
129 //to the function tree of this GEOM_BaseObject
130 Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID,
132 bool allowSubShape=false);
134 //Returns a number of functions of this GEOM_BaseObject
135 Standard_EXPORT int GetNbFunctions();
137 //Returns a function with given number theFunctionNumber
138 Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
140 //Return the last function of this GEOM_BaseObject
141 Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
143 //Returns all dependencies of the object
144 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency();
146 //Returns the dependencies of the last function
147 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
149 //Returns a driver creator of this object
150 Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver();
152 //###########################################################
154 //###########################################################
156 //Returns a label which could be used to store some additional data
157 Standard_EXPORT TDF_Label GetFreeLabel();
160 Handle(TDataStd_TreeNode) _root;
162 TCollection_AsciiString _ior;
163 TCollection_AsciiString _parameters;
167 DEFINE_STANDARD_RTTI( GEOM_BaseObject );