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_AttributeTextHighlightColor.cxx
23 // Author : Sergey RUIN
26 #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
30 //=======================================================================
33 //=======================================================================
35 const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
37 static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
38 return SALOMEDSImpl_AttributeTextHighlightColorID;
43 //=======================================================================
44 //function : constructor
46 //=======================================================================
47 SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor()
48 :SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor")
51 myValue.push_back(0.0);
52 myValue.push_back(0.0);
53 myValue.push_back(0.0);
56 //=======================================================================
59 //=======================================================================
61 const std::string& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
64 //=======================================================================
65 //function : SetTextHighlightColor
67 //=======================================================================
68 void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R,
79 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
82 //=======================================================================
83 //function : TextHighlightColor
85 //=======================================================================
86 vector<double> SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
91 //=======================================================================
92 //function : ChangeArray
94 //=======================================================================
95 void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const vector<double>& newArray)
99 for(int i = 0; i < 3; i++)
100 myValue[i] = newArray[i];
102 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
105 //=======================================================================
106 //function : NewEmpty
108 //=======================================================================
110 DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
112 return new SALOMEDSImpl_AttributeTextHighlightColor();
115 //=======================================================================
118 //=======================================================================
120 void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with)
122 ChangeArray(dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(with)->TextHighlightColor());;
126 //=======================================================================
129 //=======================================================================
131 void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into)
133 dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(into)->ChangeArray (myValue);
136 string SALOMEDSImpl_AttributeTextHighlightColor::Save()
138 char *Val = new char[75];
139 sprintf(Val, "%f %f %f", (float)myValue[0],
147 void SALOMEDSImpl_AttributeTextHighlightColor::Load(const string& value)
150 sscanf(value.c_str(), "%f %f %f", &r, &g, &b);