23 const std::string&
name, std::unique_ptr<std::vector<Point*>> points,
24 std::unique_ptr<std::map<std::string, std::size_t>> name_id_map,
28 _aabb(_data_vec->begin(), _data_vec->end()),
29 _rel_eps(rel_eps * (_aabb.getMaxPoint() - _aabb.getMinPoint()).
norm()),
31 _aabb.getMinPoint(), _aabb.getMaxPoint(), _rel_eps))
34 std::size_t
const number_of_all_input_pnts(
_data_vec->size());
37 for (std::size_t k(0); k <
_data_vec->size(); ++k)
39 if ((*
_data_vec)[k]->getID() == std::numeric_limits<std::size_t>::max())
41 (*_data_vec)[k]->setID(k);
45 std::vector<std::size_t> rm_pos;
50 for (std::size_t k(0); k <
_data_vec->size(); ++k)
55 assert(ret_pnt !=
nullptr);
58 delete (*_data_vec)[k];
59 (*_data_vec)[k] =
nullptr;
67 auto const data_vec_end =
74 for (std::size_t k(1); k < rm_pos.size(); ++k)
77 for (std::size_t j(rm_pos[k - 1] + 1); j < rm_pos[k]; ++j)
85 for (std::size_t j(rm_pos.back() + 1); j <
_pnt_id_map.size(); ++j)
92 for (std::size_t k(1); k < rm_pos.size(); ++k)
96 cnt < rm_pos.size() &&
_pnt_id_map[rm_pos[k]] > rm_pos[cnt];)
104 for (std::size_t k(0); k <
_data_vec->size(); ++k)
106 (*_data_vec)[k]->setID(k);
109 if (number_of_all_input_pnts >
_data_vec->size())
111 WARN(
"PointVec::PointVec(): there are {:d} double points.",
112 number_of_all_input_pnts -
_data_vec->size());
145 std::map<std::string, std::size_t>::const_iterator it(
150 WARN(
"PointVec::push_back(): two points share the name {:s}.",
157 (*_name_id_map)[*
name] = id;
174 if (ret_pnt ==
nullptr)
182 for (std::size_t k(0); k <
_data_vec->size(); ++k)
198 return ret_pnt->
getID();
204 std::vector<std::string> id_names(
_pnt_id_map.size(), std::string(
""));
207 id_names[id_name_pair.second] = id_name_pair.first;
213 const std::size_t id(it->second);
void WARN(char const *fmt, Args const &... args)
Definition of the PointVec class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Eigen::Vector3d const & getMinPoint() const
Eigen::Vector3d const & getMaxPoint() const
bool update(PNT_TYPE const &p)
std::vector< std::string > _id_to_name_map
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
std::vector< std::size_t > _pnt_id_map
std::size_t uniqueInsert(Point *pnt)
void setNameForElement(std::size_t id, std::string const &name) override
Sets the given name for the element of the given ID.
std::size_t push_back(Point *pnt)
std::string const & getItemNameByID(std::size_t id) const
PointType
Signals if the vector contains object of type Point or Station.
void correctNameIDMapping()
void resetInternalDataStructures()
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
std::unique_ptr< NameIdMap > _name_id_map
virtual void setNameForElement(std::size_t id, std::string const &name)
Sets the given name for the element of the given ID.
std::unique_ptr< std::vector< Point * > > _data_vec
std::size_t getID() const
void setID(std::size_t id)
Sets the ID of a node to the given value.
double norm(MatrixOrVector const &x, MathLib::VecNormType type)