8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
14 #include "IPhysicsMovableItem.h"
15 #include "IPhysicsBody.h"
17 #include "MovableItem.h"
80 {
Std_TraceMsg(0,
"Caught Error in desctructor of LineBase\r\n",
"", -1,
false,
true);}
115 void LineBase::Position(CStdFPoint &oPoint,
bool bUseScaling,
bool bFireChangeEvent,
bool bUpdateMatrix)
182 for(
int iIndex=1; iIndex<iCount; iIndex++)
186 CStdFPoint oPos2 = lpAttach2->GetCurrentPosition();
189 lpAttach1 = lpAttach2;
195 void LineBase::AttachedPartMovedOrRotated(std::string strID)
217 #pragma region DataAccesMethods
219 float *LineBase::GetDataPointer(
const std::string &strDataType)
223 float *lpData = NULL;
225 if(strType ==
"MUSCLELENGTH" || strType ==
"LENGTH")
227 else if(strType ==
"ENABLE")
230 lpData = RigidBody::GetDataPointer(strDataType);
235 bool LineBase::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
237 if(RigidBody::SetData(strDataType, strValue,
false))
240 if(strDataType ==
"ATTACHMENTPOINTS")
246 if(strDataType ==
"ENABLED")
252 if(strDataType ==
"ATTACHEDPARTMOVEDORROTATED")
254 AttachedPartMovedOrRotated(strValue);
260 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
265 void LineBase::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
267 RigidBody::QueryProperties(aryProperties);
269 aryProperties.Add(
new TypeProperty(
"Enable", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
270 aryProperties.Add(
new TypeProperty(
"MuscleLength", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
271 aryProperties.Add(
new TypeProperty(
"Length", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
273 aryProperties.Add(
new TypeProperty(
"AttachmentPoints", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
274 aryProperties.Add(
new TypeProperty(
"Enabled", AnimatPropertyType::Boolean, AnimatPropertyDirection::Both));
275 aryProperties.Add(
new TypeProperty(
"AttachedPartMovedOrRotated", AnimatPropertyType::String, AnimatPropertyDirection::Set));
297 for(
int iIndex=0; iIndex<iCount; iIndex++)
322 void LineBase::Load(
CStdXml &oXml)
325 THROW_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined);
361 for(
int iIndex=0; iIndex<iCount; iIndex++)
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
virtual float PrevLength()
Gets the previous length of the line.
Declares the external stimulus base class.
Base class file for all Animat simulation objects.
virtual float CalculateLength()
Calculates the length of the line.
Declares the simulation recorder class.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
virtual void LoadAttachments(CStdXml &oXml)
Loads the attachment points list.
Root namespace for the base simulation library for AnimatLab.
float m_fltPrevLength
Length of the line in the previous timestep.
Declares the body part class.
CStdColor m_vAmbient
The ambient color to apply to this part. It is specified as red, green, blue, and alpha...
void Load(CStdXml &oXml, std::string strParamName, bool bThrowError=true)
Loads the color.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
virtual float Length()
Gets the length of the line.
float m_fltEnabled
This is used for reporting the enabled state in a GetDataPointer call.
virtual CStdFPoint Position()
Gets the local position. (m_oPosition)
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Class that stores information about types for QueryProperty information.
virtual void DistanceUnits(std::string strUnits)
Sets the distance units.
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 bool Enabled()
Tells whether this node is enabled.
virtual void Resize()
Called when this object has been resized.
Declares the activated item class.
Declares a light manager object.
virtual bool IsVisible()
Query if this object is visible.
float m_fltDensity
Uniform density for the rigid body.
Declares the bounding box class.
float m_fltShininess
The shininess of the part. A value between 0 and 128.
virtual CStdFPoint GetCurrentPosition()
Gets the current position of this part.
A standard xml manipulation class.
virtual void Resize()
Called when this object has been resized.
virtual CStdFPoint AbsolutePosition()
Gets the absolute position of this body part.
Specifies a point on a rigid body where a muscle is to be attached.
Declares the line base class.
CStdColor m_vDiffuse
The diffuse color to apply to this part. It is specified as red, green, blue, and alpha...
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual bool AllowMouseManipulation()
Tells if a given part can be manipulated using the mouse and draggers.
bool Std_ToBool(int iVal)
Converts a value toa bool.
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 void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
CStdColor m_vSpecular
The specular color to apply to this part. It is specified as red, green, blue, and alpha...
CStdArray< Attachment * > m_aryAttachmentPoints
A pointer to the primary attachment part.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
virtual int NumberOfChildren()
Gets the number of children of the current element.
virtual void InitializeAttachments()
Initializes the attachments.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
Declares the sensor class.
float m_fltLength
Current length of the line.
Declares the data chart manager class.
virtual ~LineBase()
Destructor.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Joint * m_lpJointToParent
Declares the structure class.
Declares the odor type class.
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
LineBase()
Default constructor.
Declares the simulator class.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
Declares the activated item manager class.
CStdArray< Attachment * > * AttachmentPoints()
Gets the attachment points.
Declares the external stimuli manager class.
virtual RigidBody * FindRigidBody(std::string strBodyID, bool bThrowError=true)
Finds a rigid body with a specified ID within this structure.
virtual void OrientNewPart(float fltXPos, float fltYPos, float fltZPos, float fltXNorm, float fltYNorm, float fltZNorm)
Orients a new part based on where the parent was clicked and the normal of the surface face...
CStdArray< std::string > m_aryAttachmentPointIDs
The ID's of the attachment points for this muscle. This is used during the load/initialization proces...
Declares the attachment class.
Declares the receptive field class.
double Std_CalculateDistance(CStdIPoint &ptA, CStdIPoint &ptB)
Calculates the distance between two points.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.