opensurgsim
SegmentMeshShapePlyReaderDelegate.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2016, 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_MATH_SEGMENTMESHSHAPEPLYREADERDELEGATE_H
17 #define SURGSIM_MATH_SEGMENTMESHSHAPEPLYREADERDELEGATE_H
18 
19 #include "SurgSim/DataStructures/TriangleMeshPlyReaderDelegate.h"
20 #include "SurgSim/Math/SegmentMeshShape.h"
21 
22 
23 namespace SurgSim
24 {
25 
26 namespace Math
27 {
28 
31 {
32 public:
35 
36  explicit SegmentMeshShapePlyReaderDelegate(const std::shared_ptr<Math::SegmentMeshShape>& shape);
37 
40 
45  void* beginRadius(const std::string& element, size_t value);
46 
49  void processRadius(const std::string& element);
50 
51  bool registerDelegate(DataStructures::PlyReader* reader) override;
52 
53  bool fileIsAcceptable(const DataStructures::PlyReader& reader) override;
54 
55 private:
56  bool m_hasRadius;
57  double m_radius;
58 
59  std::shared_ptr<Math::SegmentMeshShape> m_shape;
60 };
61 
62 }
63 }
64 
65 #endif
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
void * beginRadius(const std::string &element, size_t value)
Delegate function to begin radius processing.
Definition: SegmentMeshShapePlyReaderDelegate.cpp:46
Wrapper for the C .ply file parser This class wraps the main functionality for the original C ...
Definition: PlyReader.h:85
Implementation of PlyReaderDelegate for simple triangle meshes.
Definition: TriangleMeshPlyReaderDelegate.h:33
Implementation of ply reader for segment meshes, enable to read the radius from the ply file...
Definition: SegmentMeshShapePlyReaderDelegate.h:30
bool registerDelegate(DataStructures::PlyReader *reader) override
Registers the delegate with the reader.
Definition: SegmentMeshShapePlyReaderDelegate.cpp:57
void processRadius(const std::string &element)
Callback function to process the radius.
Definition: SegmentMeshShapePlyReaderDelegate.cpp:52
SegmentMeshShapePlyReaderDelegate()
Constructor.
Definition: SegmentMeshShapePlyReaderDelegate.cpp:24
~SegmentMeshShapePlyReaderDelegate()
Destructor.
Definition: SegmentMeshShapePlyReaderDelegate.cpp:41
bool fileIsAcceptable(const DataStructures::PlyReader &reader) override
Check whether the file in the reader can be used with this delegate, this gives the delegate a chance...
Definition: SegmentMeshShapePlyReaderDelegate.cpp:75