diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp index 68cbe81417ac1f8db0d53d7e29bd4d05a9ba2275..420caa39ace6bd42fdb90f6f44231d2752b162fb 100644 --- a/GeoLib/GEOObjects.cpp +++ b/GeoLib/GEOObjects.cpp @@ -46,11 +46,31 @@ GEOObjects::~GEOObjects() } } -void GEOObjects::addPointVec(std::unique_ptr<std::vector<Point*>> points, - std::string& name, - std::unique_ptr<std::map<std::string, std::size_t>> - pnt_id_name_map, - double eps) +//void GEOObjects::addPointVec(std::unique_ptr<std::vector<Point*>> points, +// std::string& name, +// std::unique_ptr<std::map<std::string, std::size_t>> +// pnt_id_name_map, +// double eps) +//{ +// isUniquePointVecName(name); +// if (!points || points->empty()) +// { +// DBUG( +// "GEOObjects::addPointVec(): Failed to create PointVec, because " +// "there aren't any points in the given vector."); +// return; +// } +// _pnt_vecs.push_back(new PointVec(name, std::move(points), +// std::move(pnt_id_name_map), +// PointVec::PointType::POINT, eps)); +// _callbacks->addPointVec(name); +//} + +void GEOObjects::addPointVec( + std::unique_ptr<std::vector<Point*>> points, + std::string& name, + std::map<std::string, std::size_t>&& pnt_id_name_map, + double const eps) { isUniquePointVecName(name); if (!points || points->empty()) @@ -442,8 +462,7 @@ bool GEOObjects::mergePoints(std::vector<std::string> const& geo_names, const std::size_t n_geo_names(geo_names.size()); auto merged_points = std::make_unique<std::vector<GeoLib::Point*>>(); - auto merged_pnt_names = - std::make_unique<std::map<std::string, std::size_t>>(); + std::map<std::string, std::size_t> merged_pnt_names; for (std::size_t j(0); j < n_geo_names; ++j) { @@ -473,7 +492,7 @@ bool GEOObjects::mergePoints(std::vector<std::string> const& geo_names, std::string const& item_name(pnt_vec->getItemNameByID(k)); if (!item_name.empty()) { - merged_pnt_names->insert( + merged_pnt_names.insert( std::make_pair(item_name, pnt_offsets[j] + k)); } } diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h index 25e25c94ec73627c2fee0df475e731316ca90aed..a81598a5c5ce85cafd966d9744a04501debdaaa8 100644 --- a/GeoLib/GEOObjects.h +++ b/GeoLib/GEOObjects.h @@ -87,12 +87,17 @@ public: * @param pnt_id_name_map names corresponding to the points * @param eps relative tolerance value for testing of point uniqueness */ + //void addPointVec( + // std::unique_ptr<std::vector<Point*>> points, + // std::string& name, + // std::unique_ptr<std::map<std::string, std::size_t>> pnt_id_name_map = + // nullptr, + // double eps = std::sqrt(std::numeric_limits<double>::epsilon())); void addPointVec( std::unique_ptr<std::vector<Point*>> points, std::string& name, - std::unique_ptr<std::map<std::string, std::size_t>> pnt_id_name_map = - nullptr, - double eps = std::sqrt(std::numeric_limits<double>::epsilon())); + std::map<std::string, std::size_t>&& pnt_id_name_map, + double const eps = std::sqrt(std::numeric_limits<double>::epsilon())); /** * Returns the point vector with the given name.