1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_AttributeGraphic.cxx
21 // Author : Sergey LITONIN
24 #include "SALOMEDSImpl_AttributeGraphic.hxx"
25 #include "DF_Attribute.hxx"
30 Class : SALOMEDSImpl_AttributeGraphic
31 Description : This class is intended for storing information about
32 graphic representation of objects in dirrent views
35 //=======================================================================
37 //purpose : Get GUID of this attribute
38 //=======================================================================
39 const std::string& SALOMEDSImpl_AttributeGraphic::GetID()
41 static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
42 return SALOMEDSImpl_AttributeGraphicID;
45 //=======================================================================
46 //function : SALOMEDSImpl_AttributeGraphic
47 //purpose : Empty Constructor
48 //=======================================================================
49 SALOMEDSImpl_AttributeGraphic::SALOMEDSImpl_AttributeGraphic()
50 :SALOMEDSImpl_GenericAttribute("AttributeGraphic")
54 //=======================================================================
55 //function : ~SALOMEDSImpl_AttributeGraphic
56 //purpose : Destructor
57 //=======================================================================
58 SALOMEDSImpl_AttributeGraphic::~SALOMEDSImpl_AttributeGraphic()
62 //=======================================================================
63 //function : SetVisibility
64 //purpose : Set visibility of object in given view
65 //=======================================================================
66 void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId,
69 if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue )
73 myVisibility[ theViewId ] = theValue ? 1 : 0;
77 //=======================================================================
79 //purpose : Get visibility of object in given view
80 //=======================================================================
81 bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId )
83 bool isVisible = false;
84 if(myVisibility.find( theViewId )!=myVisibility.end())
85 isVisible = (bool)myVisibility[theViewId];
93 //=======================================================================
95 //purpose : Get GUID of this attribute
96 //=======================================================================
97 const std::string& SALOMEDSImpl_AttributeGraphic::ID () const
103 //=======================================================================
104 //function : NewEmpty
105 //purpose : Create new empty attribute
106 //=======================================================================
107 DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const
109 return new SALOMEDSImpl_AttributeGraphic ();
112 //=======================================================================
113 //function : SetVisibility
114 //purpose : Set visibility of object in all views
115 //=======================================================================
116 void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map<int, int>& theMap )
118 myVisibility = theMap;
121 //=======================================================================
122 //function : SetVisibility
123 //purpose : Get visibility of object in all views
124 //=======================================================================
125 const map<int, int>& SALOMEDSImpl_AttributeGraphic::GetVisibility()
130 //=======================================================================
132 //purpose : Restore value of attribute with value of theWith one
133 //=======================================================================
134 void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith )
136 SALOMEDSImpl_AttributeGraphic* anAttr =
137 dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theWith );
140 SetVisibility( anAttr->GetVisibility() );
143 //=======================================================================
145 //purpose : Paste value of current attribute to the value of entry one
146 //=======================================================================
147 void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto)
149 SALOMEDSImpl_AttributeGraphic* anAttr =
150 dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theInto );
153 anAttr->SetVisibility( myVisibility );