6 #include "IMovableItemCallback.h"
7 #include "ISimGUICallback.h"
11 #include "IPhysicsMovableItem.h"
12 #include "IPhysicsBody.h"
14 #include "MovableItem.h"
44 Materials::Materials()
48 Materials::~Materials()
53 m_aryMaterialTypes.RemoveAll();
56 {
Std_TraceMsg(0,
"Caught Error in desctructor of Materials\r\n",
"", -1,
false,
true);}
61 m_aryMaterialTypes.RemoveAll();
84 m_aryMaterialTypes.Add(lpType);
100 m_aryMaterialTypes.RemoveAt(iPos);
121 int iCount = m_aryMaterialTypes.GetSize();
122 for(
int iIndex=0; iIndex<iCount; iIndex++)
123 if(m_aryMaterialTypes[iIndex]->
ID() == sID)
127 THROW_TEXT_ERROR(Al_Err_lMaterialTypeIDNotFound, Al_Err_strMaterialTypeIDNotFound,
"ID");
137 if(m_aryMaterialTypes.GetSize() == 0)
138 THROW_ERROR(Al_Err_lDefaultMaterialNotFound, Al_Err_strDefaultMaterialNotFound);
141 int iCount = m_aryMaterialTypes.GetSize();
142 for(
int iIndex = 0; iIndex < iCount; iIndex++)
144 lpItem = m_aryMaterialTypes[iIndex];
149 bool Materials::AddItem(
const std::string &strItemType,
const std::string &strXml,
bool bThrowError,
bool bDoNotInit)
153 if(strType ==
"MATERIALTYPE")
161 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
170 if(strType ==
"MATERIALTYPE")
178 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
183 void Materials::CreateDefaultMaterial()
187 m_aryMaterialTypes.RemoveAll();
191 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Material");
193 lpType->
ID(
"DEFAULTMATERIAL");
194 lpType->
Name(
"Default");
196 m_aryMaterialTypes.Add(lpType);
199 void Materials::LoadMaterialTypes(
CStdXml &oXml)
204 std::string strMaterial;
206 bool bDefaultFound =
false;
208 for(
int iIndex=0; iIndex<iCount; iIndex++)
211 lpItem = LoadMaterialType(oXml);
212 m_aryMaterialTypes.Add(lpItem);
214 if(lpItem->
ID() ==
"DEFAULTMATERIAL")
215 bDefaultFound =
true;
221 THROW_ERROR(Al_Err_lDefaultMaterialNotFound, Al_Err_strDefaultMaterialNotFound);
224 void Materials::Load(
CStdXml &oXml)
228 m_aryMaterialTypes.RemoveAll();
234 LoadMaterialTypes(oXml);
239 CreateDefaultMaterial();
245 std::string strModuleName, strType;
256 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Material");
265 if(lpItem)
delete lpItem;
271 if(lpItem)
delete lpItem;
272 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
Base class file for all Animat simulation objects.
Declares the simulation recorder class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Root namespace for the base simulation library for AnimatLab.
Declares the body part class.
virtual void Reset()
Resets this object.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
Information about the standard error.
virtual std::string ID()
Gets the unique GUID ID of this object.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual void Initialize()
Initializes this object.
Declares the key frame class.
Declares the joint class.
Declares the organism class.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
virtual int FindTypeListPos(std::string strID, bool bThrowError=true)
Finds the array index for the material type with the specified ID.
std::string Std_Trim(std::string strVal)
Trims a string.
Declares the activated item class.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
Declares a light manager object.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
Declares the bounding box class.
virtual std::string Name()
Gets the name of this object.
virtual void RemoveMaterialType(std::string strID, bool bThrowError=true)
Removes the material type with the specified ID.
A standard xml manipulation class.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual int NumberOfChildren()
Gets the number of children of the current element.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void Initialize()
Initializes this object.
Declares the sensor class.
Declares the data chart manager class.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Declares the structure class.
Declares the odor type class.
virtual void AddMaterialType(std::string strXml, bool bDoNotInit)
Creates and adds a new material type.
Declares the simulator class.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
Declares the activated item manager class.
Declares the external stimuli manager class.
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
Declares the receptive field class.