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