TransferPhysicsToVerticesBehavior.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_BLOCKS_TRANSFERPHYSICSTOVERTICESBEHAVIOR_H
17 #define SURGSIM_BLOCKS_TRANSFERPHYSICSTOVERTICESBEHAVIOR_H
18 
20 
23 
24 namespace SurgSim
25 {
26 
27 namespace Physics
28 {
29 class DeformableRepresentation;
30 }
31 namespace Graphics
32 {
33 class CurveRepresentation;
34 }
35 
36 namespace Blocks
37 {
38 
42 {
43 public:
44 
47  explicit TransferPhysicsToVerticesBehavior(const std::string& name);
48 
50  std::shared_ptr<Physics::DeformableRepresentation> getSource() const;
51 
55  void setSource(const std::shared_ptr<Framework::Component>& source);
56 
58  std::shared_ptr<Framework::Component> getTarget() const;
59 
64  void setTarget(const std::shared_ptr<Framework::Component>& target);
65 
68  void update(double dt) override;
69 
70  bool doInitialize() override;
71 
72  bool doWakeUp() override;
73 
74 private:
75 
76  std::shared_ptr<Physics::DeformableRepresentation> m_source;
77  std::shared_ptr<Framework::Component> m_target;
78 
81 };
82 }
83 }
84 
85 #endif
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::setSource
void setSource(const std::shared_ptr< Framework::Component > &source)
Sets the source for this behavior, all the positions from the state of the source will be copied into...
Definition: TransferPhysicsToVerticesBehavior.cpp:34
SurgSim::Blocks::TransferPhysicsToVerticesBehavior
Transfer Physics State to any representation that has a Vertices property, the "Vertices" property on...
Definition: TransferPhysicsToVerticesBehavior.h:41
SurgSim::DataStructures::Vertices
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
Vertices.h
SurgSim::Framework::Behavior
Behaviors perform actions.
Definition: Behavior.h:40
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::update
void update(double dt) override
override update
Definition: TransferPhysicsToVerticesBehavior.cpp:59
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::m_vertices
DataStructures::VerticesPlain m_vertices
< Target representation
Definition: TransferPhysicsToVerticesBehavior.h:80
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::m_target
std::shared_ptr< Framework::Component > m_target
< Source representation
Definition: TransferPhysicsToVerticesBehavior.h:77
EmptyData.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::getSource
std::shared_ptr< Physics::DeformableRepresentation > getSource() const
Definition: TransferPhysicsToVerticesBehavior.cpp:49
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::doWakeUp
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: TransferPhysicsToVerticesBehavior.cpp:74
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: TransferPhysicsToVerticesBehavior.cpp:69
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::TransferPhysicsToVerticesBehavior
TransferPhysicsToVerticesBehavior(const std::string &name)
Constructor.
Definition: TransferPhysicsToVerticesBehavior.cpp:28
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::getTarget
std::shared_ptr< Framework::Component > getTarget() const
Definition: TransferPhysicsToVerticesBehavior.cpp:54
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::setTarget
void setTarget(const std::shared_ptr< Framework::Component > &target)
Sets the target for this behavior, it needs to have a "Vertices" property that takes DataStructures::...
Definition: TransferPhysicsToVerticesBehavior.cpp:41
Behavior.h
SurgSim::Blocks::TransferPhysicsToVerticesBehavior::m_source
std::shared_ptr< Physics::DeformableRepresentation > m_source
Definition: TransferPhysicsToVerticesBehavior.h:76