CompoundShapeToGraphics.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_BLOCKS_COMPOUNDSHAPETOGRAPHICS_H
#define SURGSIM_BLOCKS_COMPOUNDSHAPETOGRAPHICS_H
#include <memory>
#include <vector>
#include <string>
#include "SurgSim/Framework/Behavior.h"
namespace SurgSim
{
namespace Graphics
{
class Representation;
}
namespace Framework
{
class Component;
class Representation;
}
namespace Math
{
class CompoundShape;
class Shape;
}
namespace Blocks
{
SURGSIM_STATIC_REGISTRATION(CompoundShapeToGraphics);
class CompoundShapeToGraphics : public Framework::Behavior
{
public:
explicit CompoundShapeToGraphics(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Blocks::CompoundShapeToGraphics);
~CompoundShapeToGraphics();
void update(double dt) override;
int getTargetManagerType() const override;
bool doInitialize() override;
bool doWakeUp() override;
void setShape(const std::shared_ptr<Math::Shape>& shape);
void setSource(const std::shared_ptr<Framework::Component>& component);
void setTargets(const std::vector<std::shared_ptr<Framework::Component>> components);
void addTarget(const std::shared_ptr<Framework::Component>& component);
std::vector<std::shared_ptr<Framework::Component>> getTargets() const;
std::shared_ptr<Math::CompoundShape> getShape() const;
std::shared_ptr<Framework::Component> getSource() const;
private:
std::shared_ptr<Math::CompoundShape> m_shape;
std::shared_ptr<Framework::Component> m_source;
std::vector<std::shared_ptr<Graphics::Representation>> m_representations;
};
}
}
#endif
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Framework::Component
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:42
SurgSim::Blocks::CompoundShapeToGraphics
Keep a set of Graphics representations in sync with a CompoundShape, the shape can either be set dire...
Definition: CompoundShapeToGraphics.h:52
Behavior.h
SURGSIM_CLASSNAME
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
SurgSim::Math::CompoundShape
Definition: CompoundShape.h:36
SurgSim::Blocks::CompoundShapeToGraphics::m_representations
std::vector< std::shared_ptr< Graphics::Representation > > m_representations
List of graphics targets for updating.
Definition: CompoundShapeToGraphics.h:109
SurgSim::Graphics::Representation
Base graphics representation class, which defines the interface that all graphics representations mus...
Definition: Representation.h:39
SurgSim::Framework::Behavior
Behaviors perform actions.
Definition: Behavior.h:40
SurgSim::Blocks::CompoundShapeToGraphics::m_source
std::shared_ptr< Framework::Component > m_source
Source representation if known.
Definition: CompoundShapeToGraphics.h:106
SurgSim::Framework::Representation
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
SurgSim::Blocks::CompoundShapeToGraphics::m_shape
std::shared_ptr< Math::CompoundShape > m_shape
Source shape used for updating.
Definition: CompoundShapeToGraphics.h:103
SurgSim::Math::Shape
Generic rigid shape class defining a shape.
Definition: Shape.h:65