LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
entitycoordinate.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "cad/base/cadentity.h"
5 
6 namespace lc {
13  public:
20  EntityCoordinate(const geo::Coordinate &point, int pointId) : _point(point), _pointId(pointId) {
21  }
22 
29  _point = ec._point;
30  _pointId = ec._pointId;
31  }
32 
34  if (this != &ec) {
35  _point = ec._point;
36  _pointId = ec._pointId;
37  }
38 
39  return *this;
40  }
41 
43  return _point;
44  }
45 
46  int pointId() const {
47  return _pointId;
48  }
49 
50 
51  private:
53  int _pointId;
54  };
55 
57  EntityCoordinateSorter(const geo::Coordinate &reference) : _reference(reference) { }
58 
59  bool operator()(const EntityCoordinate &i1, const EntityCoordinate &i2) {
60  const auto d1 = i1.coordinate().distanceTo(_reference);
61  const auto d2 = i2.coordinate().distanceTo(_reference);
62  return d1 < d2;
63  }
64 
66  };
67 
68 
69 }
70 
71 // ENTITYCOORDINATE_H
geo::Coordinate _point
bool operator()(const EntityCoordinate &i1, const EntityCoordinate &i2)
const geo::Coordinate _reference
Definition: cadentity.h:12
EntityCoordinateSorter(const geo::Coordinate &reference)
geo::Coordinate coordinate() const
EntityCoordinate & operator=(const EntityCoordinate &ec)
EntityCoordinate(const geo::Coordinate &point, int pointId)
Class that represents a Coordinate associated with a distance to a test point and a identifier for th...
double distanceTo(const geo::Coordinate &c) const
EntityCoordinate(const EntityCoordinate &ec)
EntityCoordinate copy constructor.