AnimatLab  2
Test
KeyFrame.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
10 #include "AnimatBase.h"
11 
12 
13 #include "Node.h"
14 #include "IPhysicsMovableItem.h"
15 #include "IPhysicsBody.h"
16 #include "BoundingBox.h"
17 #include "MovableItem.h"
18 #include "BodyPart.h"
19 #include "Joint.h"
20 #include "ReceptiveField.h"
21 #include "ContactSensor.h"
22 #include "RigidBody.h"
23 #include "Structure.h"
24 #include "Organism.h"
25 #include "ActivatedItem.h"
26 #include "ActivatedItemMgr.h"
27 #include "DataChartMgr.h"
28 #include "ExternalStimuliMgr.h"
29 #include "KeyFrame.h"
30 #include "SimulationRecorder.h"
31 #include "KeyFrame.h"
32 #include "OdorType.h"
33 #include "Odor.h"
34 #include "Light.h"
35 #include "LightManager.h"
36 #include "Simulator.h"
37 
38 namespace AnimatSim
39 {
40  namespace Recording
41  {
42 
50 {
52 }
53 
61 {
62 
63 try
64 {
65 }
66 catch(...)
67 {Std_TraceMsg(0, "Caught Error in desctructor of KeyFrame\r\n", "", -1, false, true);}
68 }
69 
79 
89 
96 {
97  KeyFrame *lpFrame = dynamic_cast<KeyFrame *>(lpItem);
98 
99  if(!lpFrame)
100  THROW_ERROR(Al_Err_lItemNotKeyFrameType, Al_Err_strItemNotKeyFrameType);
101 
102  if(m_lStartSlice < lpFrame->m_lStartSlice)
103  return true;
104 
105  if( (m_lStartSlice == lpFrame->m_lStartSlice) && (m_lEndSlice < lpFrame->m_lEndSlice))
106  return true;
107 
108  return false;
109 }
110 
118 {
119  //Lets verify the slice data is setup correctly.
120  Std_IsAboveMin((long) -1, m_lStartSlice, true, "StartSlice");
121  Std_IsAboveMin(m_lStartSlice, m_lEndSlice, true, "EndSlice");
122 
123  m_strID = Type();
124 
125  char strTail[20];
126  sprintf(strTail, "%010d", (int) m_lStartSlice);
127 
128  m_strID += strTail;
130 }
131 
132 void KeyFrame::Load(CStdXml &oXml)
133 {
134  oXml.IntoElem(); //Into Item Element
135 
136  m_lStartSlice = oXml.GetChildLong("StartSlice");
137  m_lEndSlice = oXml.GetChildLong("EndSlice");
138 
139  Std_IsAboveMin((long) -1, m_lStartSlice, true, "StartSlice");
140  Std_IsAboveMin(m_lStartSlice, m_lEndSlice, true, "EndSlice");
141 
142  m_iCollectInterval = oXml.GetChildInt("CollectInterval");
143  Std_IsAboveMin((int) 0, m_iCollectInterval, true, "CollectInterval");
144 
145  GenerateID();
146 
147  oXml.OutOfElem(); //OutOf KeyFrame Element
148 }
149 
150 
151  } //Recording
152 } //AnimatSim
virtual ~KeyFrame()
Destructor.
Definition: KeyFrame.cpp:60
Base class file for all Animat simulation objects.
Declares the simulation recorder class.
long m_lEndSlice
The time slice where this item is deactived.
Definition: ActivatedItem.h:39
Root namespace for the base simulation library for AnimatLab.
Declares the body part class.
virtual std::string Type()
returns the string type name of this object.
Definition: AnimatBase.cpp:221
short m_iCollectInterval
Zero-based index of the collect interval.
Definition: KeyFrame.h:24
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Definition: StdXml.cpp:42
Declares the key frame class.
Base class for all activated items.
Definition: ActivatedItem.h:27
Declares the joint class.
Declares the organism class.
virtual int GetChildInt(std::string strElementName)
Gets an integer value from the element with the specified name.
Definition: StdXml.cpp:456
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
std::string m_strID
The unique Id for this object.
Definition: AnimatBase.h:55
Declares a light object.
Declares the activated item class.
Declares a light manager object.
Declares the bounding box class.
A standard xml manipulation class.
Definition: StdXml.h:19
int CollectInterval()
Gets the collect interval.
Definition: KeyFrame.cpp:78
Declares the node class.
KeyFrame()
Default constructor.
Definition: KeyFrame.cpp:49
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 bool OutOfElem()
Goes out of the element where the cursor is located.
Definition: StdXml.cpp:56
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.
virtual void GenerateID()
Generates an identifier.
Definition: KeyFrame.cpp:117
Declares the structure class.
virtual bool operator<(ActivatedItem *lpItem)
Less than comparison of two activated items.
Definition: KeyFrame.cpp:95
Declares the odor type class.
Declares the odor class.
Declares the simulator class.
Declares the activated item manager class.
Declares the contact sensor class.
Declares the external stimuli manager class.
long m_lStartSlice
The time slice where this item becomes active.
Definition: ActivatedItem.h:36
virtual long GetChildLong(std::string strElementName)
Gets a long value from the element with the specified name.
Definition: StdXml.cpp:371
Declares the receptive field class.