Atoms Crowd  4.1.0
CloneAgentOperator.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsGraph/Ports.h>
11 
12 #include <Atoms/Globals.h>
13 #include <Atoms/Graph/Operator.h>
14 #include <AtomsUtils/Mesh.h>
15 #include <Atoms/AgentGroup.h>
16 
17 namespace Atoms
18 {
19  class AgentGroup;
20 
21  class ATOMS_EXPORT CloneAgentOperator : public Operator
22  {
23  public:
24 
25  NODE_STANDARD_MEMBERS
26 
28 
29  virtual ~CloneAgentOperator();
30 
31  bool compute(const AtomsGraph::ComputeData* computeData);
32 
33  void reset();
34 
35  inline void setOffsetMatrix(const AtomsCore::Matrix& mtx) { m_offsetMatrix = mtx; }
36 
37  inline void setParentAgentId(size_t id) { m_originAgentId = id; }
38 
39  void setParentAgentGroup(Atoms::AgentGroup* ag);
40 
41  void setCopyMetadata(const bool value) { m_copyMetadata = value; }
42 
43  void setMetadataExclusionList(const std::vector<std::string> &value) { m_metadataExclusionList = value; }
44 
45  void setDelay(int delay) { m_delay = delay > 0 ? delay : 0; }
46 
47  private:
48 
49  Atoms::Agent* m_parentAgent;
50 
51  AtomsGraph::DoublePort* m_timePort;
52 
53  size_t m_originAgentId;
54 
55  Atoms::AgentGroup* m_originAgentGroup;
56 
57  AtomsCore::Matrix m_offsetMatrix;
58 
59  int m_delay;
60 
61  std::vector<AtomsCore::Pose> m_poseBuffer;
62 
63  std::vector<std::string> m_metadataExclusionList;
64 
65  int m_currentPoseIndex;
66 
67  bool m_copyMetadata;
68 
69  bool m_first;
70  };
71 }
Atoms::CloneAgentOperator
Definition: CloneAgentOperator.h:22
Atoms::AgentGroup
Agent group.
Definition: AgentGroup.h:35
Atoms::Agent
Agent.
Definition: Agent.h:38
AtomsCore::Matrix
AtomsMath::Matrix Matrix
Matrix class.
Definition: AtomsMath.h:63
AtomsGraph::PortTemplate
Generic node port class.
Definition: PortTemplate.h:24
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::CloneAgentOperator::reset
void reset()
Operator reset function.
Atoms::Operator
Operator node.
Definition: Operator.h:26
AtomsGraph::ComputeData
Definition: Node.h:21
Atoms::CloneAgentOperator::compute
bool compute(const AtomsGraph::ComputeData *computeData)
Compute function.