1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SALOMEDSImpl_AttributeGraphic.cxx
23 // Author : Sergey LITONIN
26 #include "SALOMEDSImpl_AttributeGraphic.hxx"
27 #include "DF_Attribute.hxx"
32 Class : SALOMEDSImpl_AttributeGraphic
33 Description : This class is intended for storing information about
34 graphic representation of objects in dirrent views
37 //=======================================================================
39 //purpose : Get GUID of this attribute
40 //=======================================================================
41 const std::string& SALOMEDSImpl_AttributeGraphic::GetID()
43 static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
44 return SALOMEDSImpl_AttributeGraphicID;
47 //=======================================================================
48 //function : SALOMEDSImpl_AttributeGraphic
49 //purpose : Empty Constructor
50 //=======================================================================
51 SALOMEDSImpl_AttributeGraphic::SALOMEDSImpl_AttributeGraphic()
52 :SALOMEDSImpl_GenericAttribute("AttributeGraphic")
56 //=======================================================================
57 //function : ~SALOMEDSImpl_AttributeGraphic
58 //purpose : Destructor
59 //=======================================================================
60 SALOMEDSImpl_AttributeGraphic::~SALOMEDSImpl_AttributeGraphic()
64 //=======================================================================
65 //function : SetVisibility
66 //purpose : Set visibility of object in given view
67 //=======================================================================
68 void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId,
71 if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue )
75 myVisibility[ theViewId ] = theValue ? 1 : 0;
79 //=======================================================================
81 //purpose : Get visibility of object in given view
82 //=======================================================================
83 bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId )
85 bool isVisible = false;
86 if(myVisibility.find( theViewId )!=myVisibility.end())
87 isVisible = (bool)myVisibility[theViewId];
95 //=======================================================================
97 //purpose : Get GUID of this attribute
98 //=======================================================================
99 const std::string& SALOMEDSImpl_AttributeGraphic::ID () const
105 //=======================================================================
106 //function : NewEmpty
107 //purpose : Create new empty attribute
108 //=======================================================================
109 DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const
111 return new SALOMEDSImpl_AttributeGraphic ();
114 //=======================================================================
115 //function : SetVisibility
116 //purpose : Set visibility of object in all views
117 //=======================================================================
118 void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map<int, int>& theMap )
120 myVisibility = theMap;
123 //=======================================================================
124 //function : SetVisibility
125 //purpose : Get visibility of object in all views
126 //=======================================================================
127 const map<int, int>& SALOMEDSImpl_AttributeGraphic::GetVisibility()
132 //=======================================================================
134 //purpose : Restore value of attribute with value of theWith one
135 //=======================================================================
136 void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith )
138 SALOMEDSImpl_AttributeGraphic* anAttr =
139 dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theWith );
142 SetVisibility( anAttr->GetVisibility() );
145 //=======================================================================
147 //purpose : Paste value of current attribute to the value of entry one
148 //=======================================================================
149 void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto)
151 SALOMEDSImpl_AttributeGraphic* anAttr =
152 dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theInto );
155 anAttr->SetVisibility( myVisibility );