00001 00002 // exotkMaterial_Material.cxx 00004 // Copyright (C) 2001 Stephane Routelous 00005 // 00006 // This file is part of exoTK. 00007 // 00008 // exoTK is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // exoTK is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with exoTK; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00029 #include <exotkMaterial_Material.hxx> 00030 00031 #ifndef _Standard_DefineHandle_HeaderFile 00032 #include <Standard_DefineHandle.hxx> 00033 #endif 00034 00035 // 00036 IMPLEMENT_STANDARD_HANDLE(exotkMaterial_Material, MMgt_TShared) 00037 IMPLEMENT_STANDARD_RTTI(exotkMaterial_Material, MMgt_TShared) 00038 // 00039 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 00040 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. 00041 // We must respect the order: from the direct ancestor class 00042 // to the base class. 00043 // 00044 00045 IMPLEMENT_STANDARD_TYPE(exotkMaterial_Material) 00046 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 00047 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) 00048 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() 00049 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) 00050 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) 00051 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() 00052 IMPLEMENT_STANDARD_TYPE_END(exotkMaterial_Material) 00053 00054 00055 //================================================================================== 00056 // Function name : exotkMaterial_Material::exotkMaterial_Material 00057 //================================================================================== 00058 // Written by : Stephane Routelous - 2001-12-29 00:45:53 00059 // Description : 00060 // Return type : 00061 //================================================================================== 00062 // Argument : const Graphic3d_MaterialAspect& aMaterial 00063 // Argument : const TCollection_AsciiString& aName 00064 exotkMaterial_Material::exotkMaterial_Material(const Graphic3d_MaterialAspect& aMaterial,const TCollection_AsciiString& aName) 00065 :myMaterial(aMaterial),myName(aName) 00066 { 00067 } 00068 00069 00070 //================================================================================== 00071 // Function name : exotkMaterial_Material::~exotkMaterial_Material 00072 //================================================================================== 00073 // Written by : Stephane Routelous - 2001-12-29 00:45:55 00074 // Description : 00075 // Return type : 00076 //================================================================================== 00077 exotkMaterial_Material::~exotkMaterial_Material() 00078 { 00079 00080 } 00081 00082 //================================================================================== 00083 // Function name : exotkMaterial_Material::SetMaterial 00084 //================================================================================== 00085 // Written by : Stephane Routelous - 2001-12-29 00:45:57 00086 // Description : 00087 // Return type : void 00088 //================================================================================== 00089 // Argument : const Graphic3d_MaterialAspect& aMaterial 00090 void exotkMaterial_Material::SetMaterial(const Graphic3d_MaterialAspect& aMaterial) 00091 { 00092 myMaterial = aMaterial; 00093 } 00094 00095 //================================================================================== 00096 // Function name : exotkMaterial_Material::Material 00097 //================================================================================== 00098 // Written by : Stephane Routelous - 2001-12-29 00:45:59 00099 // Description : 00100 // Return type : Graphic3d_MaterialAspect 00101 //================================================================================== 00102 Graphic3d_MaterialAspect exotkMaterial_Material::Material() 00103 { 00104 return myMaterial; 00105 } 00106 00107 //================================================================================== 00108 // Function name : exotkMaterial_Material::SetName 00109 //================================================================================== 00110 // Written by : Stephane Routelous - 2001-12-29 00:46:02 00111 // Description : 00112 // Return type : void 00113 //================================================================================== 00114 // Argument : const TCollection_AsciiString& aName 00115 void exotkMaterial_Material::SetName(const TCollection_AsciiString& aName) 00116 { 00117 myName = aName; 00118 } 00119 00120 //================================================================================== 00121 // Function name : exotkMaterial_Material::Name 00122 //================================================================================== 00123 // Written by : Stephane Routelous - 2001-12-29 00:46:04 00124 // Description : 00125 // Return type : TCollection_AsciiString 00126 //================================================================================== 00127 TCollection_AsciiString exotkMaterial_Material::Name() 00128 { 00129 return myName; 00130 } 00131 00132 //================================================================================== 00133 // Function name : exotkMaterial_Material::HashCode 00134 //================================================================================== 00135 // Written by : Stephane Routelous - 2001-12-29 00:46:06 00136 // Description : 00137 // Return type : Standard_Integer 00138 //================================================================================== 00139 // Argument : const Handle_exotkMaterial_Material& aMaterial 00140 // Argument : const Standard_Integer Upper 00141 Standard_Integer exotkMaterial_Material::HashCode(const Handle_exotkMaterial_Material& aMaterial,const Standard_Integer Upper) 00142 { 00143 return ::HashCode(1,Upper); 00144 } 00145 00146 //================================================================================== 00147 // Function name : exotkMaterial_Material::IsEqual 00148 //================================================================================== 00149 // Written by : Stephane Routelous - 2001-12-29 00:46:08 00150 // Description : 00151 // Return type : Standard_Boolean 00152 //================================================================================== 00153 // Argument : const Handle_exotkMaterial_Material& aMaterial1 00154 // Argument : const Handle_exotkMaterial_Material& aMaterial2 00155 Standard_Boolean exotkMaterial_Material::IsEqual(const Handle_exotkMaterial_Material& aMaterial1,const Handle_exotkMaterial_Material& aMaterial2) 00156 { 00157 /* 00158 Quantity_Parameter theOldColorEpsilon = Quantity_Color::Epsilon(); 00159 Quantity_Color::SetEpsilon(0.03); 00160 Standard_Boolean theIsEqual = aMaterial1->Material().IsEqual(aMaterial2->Material()); 00161 Quantity_Color::SetEpsilon(theOldColorEpsilon); 00162 */ 00163 return (aMaterial1->Name() == aMaterial2->Name()); 00164 } 00165 00166 //================================================================================== 00167 // Function name : exotkMaterial_Material::IsModifiable 00168 //================================================================================== 00169 // Written by : Stephane Routelous - 2001-12-29 00:46:11 00170 // Description : 00171 // Return type : Standard_Boolean 00172 //================================================================================== 00173 Standard_Boolean exotkMaterial_Material::IsModifiable() 00174 { 00175 return myIsModifiable; 00176 } 00177 00178 //================================================================================== 00179 // Function name : exotkMaterial_Material::SetModifiable 00180 //================================================================================== 00181 // Written by : Stephane Routelous - 2001-12-29 00:46:13 00182 // Description : 00183 // Return type : void 00184 //================================================================================== 00185 // Argument : const Standard_Boolean On 00186 void exotkMaterial_Material::SetModifiable(const Standard_Boolean On) 00187 { 00188 myIsModifiable = On; 00189 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001