1 // Copyright (C) 2007-2021 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, or (at your option) any later version.
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
23 // File : SALOMEDSImpl_AttributeTextHighlightColor.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
29 //=======================================================================
32 //=======================================================================
34 const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
36 static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
37 return SALOMEDSImpl_AttributeTextHighlightColorID;
42 //=======================================================================
43 //function : constructor
45 //=======================================================================
46 SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor()
47 :SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor")
50 myValue.push_back(0.0);
51 myValue.push_back(0.0);
52 myValue.push_back(0.0);
55 //=======================================================================
58 //=======================================================================
60 const std::string& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
63 //=======================================================================
64 //function : SetTextHighlightColor
66 //=======================================================================
67 void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R,
78 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
81 //=======================================================================
82 //function : TextHighlightColor
84 //=======================================================================
85 std::vector<double> SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
90 //=======================================================================
91 //function : ChangeArray
93 //=======================================================================
94 void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const std::vector<double>& newArray)
98 for(int i = 0; i < 3; i++)
99 myValue[i] = newArray[i];
101 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
104 //=======================================================================
105 //function : NewEmpty
107 //=======================================================================
109 DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
111 return new SALOMEDSImpl_AttributeTextHighlightColor();
114 //=======================================================================
117 //=======================================================================
119 void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with)
121 ChangeArray(dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(with)->TextHighlightColor());;
125 //=======================================================================
128 //=======================================================================
130 void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into)
132 dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(into)->ChangeArray (myValue);
135 std::string SALOMEDSImpl_AttributeTextHighlightColor::Save()
137 char *Val = new char[75];
138 sprintf(Val, "%f %f %f", (float)myValue[0],
141 std::string ret(Val);
146 void SALOMEDSImpl_AttributeTextHighlightColor::Load(const std::string& value)
149 sscanf(value.c_str(), "%f %f %f", &r, &g, &b);