OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
point_cloud.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef GEOM_POINT_CLOUD_H
20 #define GEOM_POINT_CLOUD_H
21 
22 #include <vector>
23 #include <map>
24 #include <string>
25 
26 #include <boost/shared_ptr.hpp>
27 
28 #include "vec3.hh"
29 
30 namespace geom {
31 
32 /*
33  the pointcloud and its manager are meant to provide
34  name-based lookup for the selection mechanism. They are
35  defined here in abstract terms, and are then used in e.g.
36  the gfx modules - a graphical object ISA point cloud, and
37  the gfx object manager ISA point cloud manager. This way
38  named graphical objects can be used in a selection statement,
39  when the query is receiving a pointer to a point cloud manager.
40 */
41 
43 {
44 public:
45  virtual ~PointCloud();
46  virtual std::vector<Vec3> GetPoints() const;
47  virtual Vec3 GetCenter() const;
48  virtual Real GetRadius() const;
49 
50 protected:
51 
52  void AddPoint(const Vec3& v);
53 
54 
55 private:
56 
57  std::vector<Vec3> point_list_;
58 };
59 
60 typedef boost::shared_ptr<PointCloud> PointCloudPtr;
61 
62 
64 {
65 public:
66  virtual ~PointCloudManager();
67 
68  PointCloudPtr GetPointCloud(const std::string& name);
69 
70 protected:
71  void AddPointCloud(const std::string& name, const PointCloudPtr& p);
72 
73 private:
74  std::map<std::string, PointCloudPtr> pmap_;
75 };
76 
77 
78 } // ns
79 
80 #endif
float Real
Definition: base.hh:44
void AddPointCloud(const std::string &name, const PointCloudPtr &p)
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
virtual std::vector< Vec3 > GetPoints() const
PointCloudPtr GetPointCloud(const std::string &name)
virtual Vec3 GetCenter() const
void AddPoint(const Vec3 &v)
virtual ~PointCloud()
boost::shared_ptr< PointCloud > PointCloudPtr
Definition: point_cloud.hh:60
virtual Real GetRadius() const