VisualizeContactsBehavior.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_VISUALIZECONTACTSBEHAVIOR_H
17 #define SURGSIM_BLOCKS_VISUALIZECONTACTSBEHAVIOR_H
18 
19 #include <memory>
20 #include <string>
21 
24 
25 namespace SurgSim
26 {
27 
28 namespace Graphics
29 {
30 class VectorFieldRepresentation;
31 }
32 
33 namespace Collision
34 {
35 class Representation;
36 }
37 
38 namespace Blocks
39 {
40 
41 SURGSIM_STATIC_REGISTRATION(VisualizeContactsBehavior);
42 
46 {
47 public:
50  explicit VisualizeContactsBehavior(const std::string& name);
51 
53 
56  std::shared_ptr<SurgSim::Framework::Component> getCollisionRepresentation();
57 
60  void setCollisionRepresentation(std::shared_ptr<SurgSim::Framework::Component> collisionRepresentation);
61 
64  virtual void update(double dt) override;
65 
68  virtual int getTargetManagerType() const override;
69 
71  double getVectorFieldScale();
72 
74  // \param scale The scale of the vector field.
75  void setVectorFieldScale(double scale);
76 
77 protected:
81  virtual bool doInitialize() override;
82 
86  virtual bool doWakeUp() override;
87 
88 private:
90  std::shared_ptr<SurgSim::Collision::Representation> m_collisionRepresentation;
91 
93  std::shared_ptr<SurgSim::Graphics::VectorFieldRepresentation> m_vectorField;
94 };
95 
96 } // namespace Blocks
97 } // namespace SurgSim
98 
99 #endif // SURGSIM_BLOCKS_VISUALIZECONTACTSBEHAVIOR_H
Definition: DriveElementFromInputBehavior.cpp:27
SURGSIM_STATIC_REGISTRATION(OsgBoxRepresentation)
This behavior is used to visualize the contacts on collision representation through vector field...
Definition: VisualizeContactsBehavior.h:45
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::shared_ptr< SurgSim::Graphics::VectorFieldRepresentation > m_vectorField
The osg vector field for visualizing contacts on collision representation.
Definition: VisualizeContactsBehavior.h:93
Behaviors perform actions.
Definition: Behavior.h:40
Wrapper class to use for the collision operation, handles its enclosed shaped and a possible local to...
Definition: Representation.h:52
std::shared_ptr< SurgSim::Collision::Representation > m_collisionRepresentation
The collision representation to get contacts for visualizing.
Definition: VisualizeContactsBehavior.h:90