Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / OBJECT / SALOME_InteractiveObject.cxx
1 //  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
2 //
3 //  Copyright (C) 2003  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. 
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 //
24 //  File   : SALOME_InteractiveObject.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 //using namespace std;
30 /*!
31   \class SALOME_InteractiveObject SALOME_InteractiveObject.hxx
32   \brief ...
33 */
34
35 #include "SALOME_InteractiveObject.ixx"
36
37 /*!
38   Default constructor
39 */
40 SALOME_InteractiveObject::SALOME_InteractiveObject()
41 {
42   myEntry = "";
43   myName  = "";
44   myComponentDataType = "";
45   myReference = "";
46 }
47
48 /*!
49   Constructor
50   \param anEntry - entry of object
51   \param aComponentDataType - component data type name
52   \param aName - name of object
53 */
54 SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry, 
55                                                    const char* aComponentDataType,
56                                                    const char* aName):
57   myEntry(anEntry), 
58   myName(aName), 
59   myComponentDataType(aComponentDataType), 
60   myReference("")
61 {}
62
63 /*!
64   Sets entry
65   \param anEntry - new entry of object
66 */
67 void SALOME_InteractiveObject::setEntry(const char* anEntry){
68   myEntry = anEntry;
69 }
70
71 /*!
72   \return entry
73 */
74 const char* SALOME_InteractiveObject::getEntry(){
75   return myEntry.c_str();
76 }
77
78 /*!
79   Sets component data type
80   \param aComponentDataType - component data type name
81 */
82 void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
83   myComponentDataType = aComponentDataType; 
84 }
85
86 /*!
87   \return component data type
88 */
89 const char* SALOME_InteractiveObject::getComponentDataType(){
90   return myComponentDataType.c_str();
91 }
92
93 /*!
94   Sets name
95   \param aName - new name of object
96 */
97 void SALOME_InteractiveObject::setName(const char* aName){
98   myName = aName;
99 }
100
101 /*!
102   \return name
103 */
104 const char* SALOME_InteractiveObject::getName(){
105   return myName.c_str();
106 }
107
108 /*!
109   \return true if entry isn't empty
110 */
111 Standard_Boolean SALOME_InteractiveObject::hasEntry(){
112   return myEntry != "";
113 }
114
115 /*!
116   \return true if objects have same entries
117   \param anIO - other object
118 */
119 Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
120   if ( anIO->hasEntry() && this->hasEntry() ) {
121     if ( myEntry == anIO->getEntry() )
122       return Standard_True;
123   }
124   
125   return Standard_False;
126 }
127
128 /*!
129   \return true if component data types are same
130   \param ComponentDataType - component data type to be checked
131 */
132 Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
133   if ( myComponentDataType == ComponentDataType )
134     return Standard_True;
135   else
136     return Standard_False;
137 }
138
139 /*!
140   \return true if object has reference
141 */
142 Standard_Boolean SALOME_InteractiveObject::hasReference()
143 {
144   return myReference != "";
145 }
146
147 /*!
148   \return reference
149 */
150 const char* SALOME_InteractiveObject::getReference()
151 {
152   return myReference.c_str();
153 }
154
155 /*!
156   Sets reference
157   \param aReference - new reference
158 */
159 void SALOME_InteractiveObject::setReference(const char* aReference)
160 {
161   myReference = aReference;
162 }