OpenLexocad  27.1
PointMapWithTolerance.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <Geom/BSPTree.h>
5 #include <Geom/Pnt2d.h>
6 
7 namespace Geom
8 {
9 class LX_GEOM_EXPORT PointMapWithTolerance
10 {
11 public:
12  PointMapWithTolerance(const double& tol = 1E-06);
13  PointMapWithTolerance(const PointMapWithTolerance& other); // copy constructor
14 
15  int64_t numPoints() const;
16  void clear();
17  int64_t find(const Geom::Pnt& p) const;
18  const Geom::Pnt& getPoint(const int64_t idx) const;
19  int64_t getUserData(int64_t idx) const;
20  void setUserData(int64_t idx, int64_t userData);
21  void* getUserDataVoidPtr(int64_t idx) const;
22  void setUserDataVoidPtr(int64_t idx, void* userData);
23  int64_t addPoint(const Geom::Pnt& p, int64_t userData); // it doesn't check if point exists with tolerance
24  int64_t addPointVoidPtr(const Geom::Pnt& p, void* userData); // it doesn't check if point exists with tolerance
25  int64_t addPointIfNotExists(const Geom::Pnt& p, int64_t userData);
26  int64_t addPointIfNotExistsVoidPtr(const Geom::Pnt& p, void* userData);
27  void removePoint(const int64_t idx);
28 
29  bool operator==(const PointMapWithTolerance& other) const;
30 
31 private:
32  Geom::BSPTree _bsptree;
33  double _tol;
34 };
35 
36 
37 // for convenience
38 class LX_GEOM_EXPORT Point2dMapWithTolerance
39 {
40 public:
41  Point2dMapWithTolerance(const double& tol = 1E-06);
42 
43  int64_t numPoints();
44  void clear();
45  int64_t find(const Geom::Pnt2d& p);
46  const Geom::Pnt2d getPoint(const int64_t idx) const;
47  int64_t getUserData(int64_t idx);
48  void setUserData(int64_t idx, int64_t userData);
49  void addPoint(const Geom::Pnt2d& p, int64_t userData); // it doesn't check if point exists with tolerance
50  void addPointIfNotExists(const Geom::Pnt2d& p, int64_t userData);
51 
52 private:
53  Geom::BSPTree _bsptree;
54  double _tol;
55 };
56 
57 } // namespace Geom
LX_GEOM_EXPORT Point getPoint(const Geom::Pnt &p)
Definition: Variant.h:60
Definition: PointMapWithTolerance.h:9
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:43
Definition: PointMapWithTolerance.h:38
Definition: BSPTree.h:13
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33