1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
42 GetSFieldHandle<SFMaterialPtrMap>::GetSFieldHandle(
43 const GetSFieldHandle &source) :
50 GetSFieldHandle<SFMaterialPtrMap>::GetSFieldHandle(
51 const SFMaterialPtrMap *pField,
52 const FieldDescriptionBase *pDescription,
53 FieldContainer *pContainer ) :
55 Inherited(pField, pDescription, pContainer)
61 GetSFieldHandle<SFMaterialPtrMap>::isPointerField(void) const
67 bool GetSFieldHandle<SFMaterialPtrMap>::empty(void)
69 bool returnValue = true;
71 SFMaterialPtrMap const *pLhs =
72 static_cast<SFMaterialPtrMap const *>(_pField);
76 returnValue = pLhs->getValue().empty();
83 void GetSFieldHandle<SFMaterialPtrMap>::pushValueToStream(
86 FWARNING(("illegal pushValueToStream called for %s\n",
87 this->getName().c_str()));
92 void GetSFieldHandle<SFMaterialPtrMap>::pushSizeToStream(
95 FWARNING(("illegal pushSizeToStream called for %s\n",
96 this->getName().c_str()));
101 bool GetSFieldHandle<SFMaterialPtrMap>::equal(
104 Ptr pOther = boost::dynamic_pointer_cast<GetSFieldHandle>(rhs);
111 SFMaterialPtrMap const *pLhs =
112 static_cast<SFMaterialPtrMap const *>( _pField);
114 SFMaterialPtrMap const *pRhs =
115 static_cast<SFMaterialPtrMap const *>(pOther->_pField);
117 return (*pLhs) == (*pRhs);
121 SFMaterialPtrMap const *
122 GetSFieldHandle<SFMaterialPtrMap>::operator ->(void)
124 return static_cast<SFMaterialPtrMap const *>(_pField);
128 SFMaterialPtrMap const &
129 GetSFieldHandle<SFMaterialPtrMap>::operator * (void)
131 return *(static_cast<SFMaterialPtrMap const *>(_pField));
134 /*---------------------------------------------------------------------*/
137 EditSFieldHandle<SFMaterialPtrMap>::EditSFieldHandle(
138 const EditSFieldHandle &source) :
141 _pContainer(source._pContainer),
142 _fAddMethod(source._fAddMethod)
147 EditSFieldHandle<SFMaterialPtrMap>::EditSFieldHandle(
148 SFMaterialPtrMap *pField,
149 const FieldDescriptionBase *pDescription,
150 FieldContainer *pContainer ) :
162 bool EditSFieldHandle<SFMaterialPtrMap>::isPointerField(void) const
168 bool EditSFieldHandle<SFMaterialPtrMap>::empty(void)
170 bool returnValue = true;
172 SFMaterialPtrMap *pLhs = static_cast<SFMaterialPtrMap *>(_pField);
176 returnValue = pLhs->getValue().empty();
183 void EditSFieldHandle<SFMaterialPtrMap>::pushValueToStream(
184 OutStream &str) const
186 FWARNING(("illegal pushValueToStream called for %s\n",
187 this->getName().c_str()));
192 void EditSFieldHandle<SFMaterialPtrMap>::pushSizeToStream(
193 OutStream &str) const
195 FWARNING(("illegal pushSizeToStream called for %s\n",
196 this->getName().c_str()));
201 bool EditSFieldHandle<SFMaterialPtrMap>::equal(
204 Ptr pOther = boost::dynamic_pointer_cast<EditSFieldHandle>(rhs);
211 SFMaterialPtrMap *pLhs =
212 static_cast<SFMaterialPtrMap *>( _pField);
214 SFMaterialPtrMap *pRhs =
215 static_cast<SFMaterialPtrMap *>(pOther->_pField);
217 return (*pLhs) == (*pRhs);
221 void EditSFieldHandle<SFMaterialPtrMap>::setAddMethod(
224 _fAddMethod = fMethod;
228 void EditSFieldHandle<SFMaterialPtrMap>::pushValueFromCString(
231 FWARNING(("illegal pushValueFromCString called for %s\n",
232 this->getName().c_str()));
237 void EditSFieldHandle<SFMaterialPtrMap>::copyValues(
238 GetFieldHandlePtr source) const
240 FWARNING(("illegal copyValues called for %s\n",
241 this->getName().c_str()));
246 void EditSFieldHandle<SFMaterialPtrMap>::shareValues(
247 GetFieldHandlePtr source) const
249 SFMaterialPtrMap::GetHandlePtr pGetHandle =
250 boost::dynamic_pointer_cast<
251 SFMaterialPtrMap::GetHandle>(source);
253 if(pGetHandle == NULL || pGetHandle->isValid() == false)
256 const SFMaterialPtrMap &pMatMap = **pGetHandle;
258 MaterialMap::const_iterator mapIt = pMatMap.getValue().begin();
259 MaterialMap::const_iterator mapEnd = pMatMap.getValue().end();
261 for(; mapIt != mapEnd; ++mapIt)
263 PrimeMaterial *att = mapIt->second;
264 KeyType uiBinding = mapIt->first;
268 _fAddMethod(att, uiBinding);