OsgCylinderRepresentation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, 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_GRAPHICS_OSGCYLINDERREPRESENTATION_H
#define SURGSIM_GRAPHICS_OSGCYLINDERREPRESENTATION_H
#include "SurgSim/Framework/ObjectFactory.h"
#include "SurgSim/Graphics/CylinderRepresentation.h"
#include "SurgSim/Graphics/OsgRepresentation.h"
#include <osg/PositionAttitudeTransform>
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif
namespace SurgSim
{
namespace Graphics
{
class OsgUnitCylinder;
SURGSIM_STATIC_REGISTRATION(OsgCylinderRepresentation);
class OsgCylinderRepresentation : public OsgRepresentation, public CylinderRepresentation
{
public:
explicit OsgCylinderRepresentation(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgCylinderRepresentation);
void setRadius(double radius) override;
double getRadius() const override;
void setHeight(double height) override;
double getHeight() const override;
void setSize(double radius, double height) override;
void getSize(double* radius, double* height) override;
void setSize(const SurgSim::Math::Vector2d& size) override;
SurgSim::Math::Vector2d getSize() const override;
private:
osg::Vec2d m_scale;
std::shared_ptr<OsgUnitCylinder> m_sharedUnitCylinder;
static std::shared_ptr<OsgUnitCylinder> getSharedUnitCylinder();
osg::ref_ptr<osg::PositionAttitudeTransform> m_patCylinder;
};
}; // namespace Graphics
}; // namespace SurgSim
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif // SURGSIM_GRAPHICS_OSGCYLINDERREPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::OsgCylinderRepresentation::m_patCylinder
osg::ref_ptr< osg::PositionAttitudeTransform > m_patCylinder
Definition: OsgCylinderRepresentation.h:88
SurgSim::Graphics::OsgCylinderRepresentation::m_scale
osg::Vec2d m_scale
The OSG Cylinder shape is a unit Cylinder and this transform scales it to the size set...
Definition: OsgCylinderRepresentation.h:81
SurgSim::Graphics::OsgCylinderRepresentation::getSize
SurgSim::Math::Vector2d getSize() const override
Returns the size of the cylinder.
Definition: OsgCylinderRepresentation.cpp:85
CylinderRepresentation.h
ObjectFactory.h
SurgSim::Graphics::OsgCylinderRepresentation::OsgCylinderRepresentation
OsgCylinderRepresentation(const std::string &name)
Constructor.
Definition: OsgCylinderRepresentation.cpp:34
SurgSim::Graphics::OsgCylinderRepresentation
OSG implementation of a graphics Cylinder representation.
Definition: OsgCylinderRepresentation.h:40
SurgSim::Graphics::OsgCylinderRepresentation::setSize
void setSize(double radius, double height) override
Sets the size of the cylinder.
Definition: OsgCylinderRepresentation.cpp:68
SurgSim::Graphics::CylinderRepresentation
Base graphics cylinder representation class, which defines the basic interface for a cylinder that ca...
Definition: CylinderRepresentation.h:31
SurgSim::Math::Vector2d
Eigen::Matrix< double, 2, 1 > Vector2d
A 2D vector of doubles.
Definition: Vector.h:53
SurgSim::Graphics::OsgCylinderRepresentation::getSharedUnitCylinder
static std::shared_ptr< OsgUnitCylinder > getSharedUnitCylinder()
Returns the shared unit cylinder.
Definition: OsgCylinderRepresentation.cpp:90
SurgSim::Graphics::OsgCylinderRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgCylinderRepresentation)
SurgSim::Graphics::OsgCylinderRepresentation::m_sharedUnitCylinder
std::shared_ptr< OsgUnitCylinder > m_sharedUnitCylinder
Shared unit Cylinder, so that the geometry can be instanced rather than having multiple copies...
Definition: OsgCylinderRepresentation.h:84
SurgSim::Graphics::OsgCylinderRepresentation::getHeight
double getHeight() const override
Returns the height of the cylinder.
Definition: OsgCylinderRepresentation.cpp:63
OsgRepresentation.h
SurgSim::Graphics::OsgCylinderRepresentation::setRadius
void setRadius(double radius) override
Sets the radius of the cylinder.
Definition: OsgCylinderRepresentation.cpp:48
SurgSim::Graphics::OsgCylinderRepresentation::getRadius
double getRadius() const override
Returns the radius of the cylinder.
Definition: OsgCylinderRepresentation.cpp:53
SurgSim::Graphics::OsgRepresentation
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:55
SurgSim::Graphics::OsgCylinderRepresentation::setHeight
void setHeight(double height) override
Sets the height of the cylinder.
Definition: OsgCylinderRepresentation.cpp:58