All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OsgPointCloudRepresentation.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_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
17 #define SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
18 
19 #include <osg/Array>
20 #include <osg/Geometry>
21 #include <osg/Point>
22 
27 
28 namespace SurgSim
29 {
30 namespace DataStructures
31 {
32 class EmptyData;
33 
34 template<class Data>
35 class Vertices;
36 }
37 
38 namespace Graphics
39 {
40 
41 #if defined(_MSC_VER)
42 #pragma warning(push)
43 #pragma warning(disable:4250)
44 #endif
45 SURGSIM_STATIC_REGISTRATION(OsgPointCloudRepresentation);
46 
49 {
50 public:
53  explicit OsgPointCloudRepresentation(const std::string& name);
54 
57 
59 
62  virtual std::shared_ptr<PointCloud> getVertices() const override;
63 
66  virtual void setPointSize(double val) override;
67 
70  virtual double getPointSize() const override;
71 
74  virtual void doUpdate(double dt) override;
75 
78  virtual void setColor(const SurgSim::Math::Vector4d& color) override;
79 
82  virtual SurgSim::Math::Vector4d getColor() const override;
83 
84 private:
86  std::shared_ptr<PointCloud> m_vertices;
87 
89  osg::ref_ptr<osg::Vec3Array> m_vertexData;
90 
92  osg::ref_ptr<osg::Geometry> m_geometry;
93 
95  osg::ref_ptr<osg::DrawArrays> m_drawArrays;
96 
98  osg::ref_ptr<osg::Point> m_point;
99 
102 };
103 
104 #if defined(_MSC_VER)
105 #pragma warning(pop)
106 #endif
107 
108 }; // Graphics
109 }; // SurgSim
110 
111 #endif // SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
SURGSIM_STATIC_REGISTRATION(OsgBoxRepresentation)
Osg point cloud representation, implementation of a PointCloudRepresenation using OSG...
Definition: OsgPointCloudRepresentation.h:48
virtual std::shared_ptr< PointCloud > getVertices() const override
Gets the vertices.
Definition: OsgPointCloudRepresentation.cpp:98
Graphic representation of a point cloud, hase a very basic interface and is intentionally kept generi...
Definition: PointCloudRepresentation.h:35
osg::ref_ptr< osg::Geometry > m_geometry
OSG Geometry node holding the data.
Definition: OsgPointCloudRepresentation.h:92
osg::ref_ptr< osg::Vec3Array > m_vertexData
OSG vertex data for updating.
Definition: OsgPointCloudRepresentation.h:89
osg::ref_ptr< osg::DrawArrays > m_drawArrays
OSG DrawArrays for local operations.
Definition: OsgPointCloudRepresentation.h:95
OsgPointCloudRepresentation(const std::string &name)
Constructor.
Definition: OsgPointCloudRepresentation.cpp:33
virtual void setColor(const SurgSim::Math::Vector4d &color) override
Sets a color.
Definition: OsgPointCloudRepresentation.cpp:113
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgPointCloudRepresentation)
virtual void doUpdate(double dt) override
Executes the update operation.
Definition: OsgPointCloudRepresentation.cpp:69
virtual SurgSim::Math::Vector4d getColor() const override
Gets the color.
Definition: OsgPointCloudRepresentation.cpp:127
virtual void setPointSize(double val) override
Sets point size.
Definition: OsgPointCloudRepresentation.cpp:103
SurgSim::Math::Vector4d m_color
Color backing variable.
Definition: OsgPointCloudRepresentation.h:101
~OsgPointCloudRepresentation()
Destructor.
Definition: OsgPointCloudRepresentation.cpp:65
virtual double getPointSize() const override
Gets point size.
Definition: OsgPointCloudRepresentation.cpp:108
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:60
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:42
osg::ref_ptr< osg::Point > m_point
OSG::Point for local operations.
Definition: OsgPointCloudRepresentation.h:98
std::shared_ptr< PointCloud > m_vertices
Local pointer to vertices with data.
Definition: OsgPointCloudRepresentation.h:86