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