Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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 SALOME_InteractiveObject::SALOME_InteractiveObject()
38 {
39   myEntry = "";
40   myName  = "";
41   myComponentDataType = "";
42   myReference = "";
43 }
44
45 SALOME_InteractiveObject::SALOME_InteractiveObject(const Standard_CString anEntry, 
46                                                    const Standard_CString aComponentDataType,
47                                                    const Standard_CString aName)
48 {
49   myEntry = new char [strlen(anEntry)+1];
50   strcpy( myEntry, anEntry);
51
52   myName = new char [strlen(aName)+1];
53   strcpy( myName, aName);
54
55   myComponentDataType = new char [strlen(aComponentDataType)+1];
56   strcpy( myComponentDataType, aComponentDataType);
57
58   myReference = new char [strlen("")+1];
59   strcpy( myReference, "");
60 }
61
62 void SALOME_InteractiveObject::setEntry(const Standard_CString anEntry){
63   myEntry = new char [strlen(anEntry)+1];
64   strcpy( myEntry, anEntry);
65 }
66
67 Standard_CString SALOME_InteractiveObject::getEntry(){
68   return myEntry;
69 }
70
71 void SALOME_InteractiveObject::setComponentDataType(const Standard_CString aComponentDataType){
72   myComponentDataType = new char [strlen(aComponentDataType)+1];
73   strcpy( myComponentDataType, aComponentDataType);
74 }
75
76 Standard_CString SALOME_InteractiveObject::getComponentDataType(){
77   return myComponentDataType;
78 }
79
80 void SALOME_InteractiveObject::setName(const Standard_CString aName){
81   myName = new char [strlen(aName)+1];
82   strcpy( myName, aName);
83 }
84
85 Standard_CString SALOME_InteractiveObject::getName(){
86   return myName;
87 }
88
89 Standard_Boolean SALOME_InteractiveObject::hasEntry(){
90   return !( strcmp(myEntry, "" ) == 0 );
91 }
92
93 Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
94   if ( anIO->hasEntry() && this->hasEntry() ) {
95     if ( strcmp(myEntry, anIO->getEntry() ) == 0 )
96       return Standard_True;
97   }
98   
99   return Standard_False;
100 }
101
102 Standard_Boolean SALOME_InteractiveObject::isComponentType(const Standard_CString ComponentDataType){
103   if ( strcmp( myComponentDataType, ComponentDataType) == 0 )
104     return Standard_True;
105   else
106     return Standard_False;
107 }
108
109 Standard_Boolean SALOME_InteractiveObject::hasReference()
110 {
111   return !( strcmp(myReference, "" ) == 0 );
112 }
113
114 Standard_CString SALOME_InteractiveObject::getReference()
115 {
116   return myReference;
117 }
118
119 void SALOME_InteractiveObject::setReference(const Standard_CString aReference)
120 {
121   myReference = new char [strlen(aReference)+1];
122   strcpy( myReference, aReference);
123 }