Skip to content
Snippets Groups Projects
Commit 44623fa0 authored by Karsten Rink's avatar Karsten Rink
Browse files

Merge pull request #448 from TomFischer/GeoLibGetGeoObjectsByName

[GeoLib] Another version for GEOObjects::getGeoObjects().
parents 79fb7abb 66cc2f7f
No related branches found
No related tags found
No related merge requests found
...@@ -591,6 +591,27 @@ const GeoLib::GeoObject* GEOObjects::getGeoObject(const std::string &geo_name, ...@@ -591,6 +591,27 @@ const GeoLib::GeoObject* GEOObjects::getGeoObject(const std::string &geo_name,
return geo_obj; return geo_obj;
} }
GeoLib::GeoObject const* GEOObjects::getGeoObject(
const std::string &geo_name,
const std::string &geo_obj_name) const
{
GeoLib::GeoObject const* geo_obj(
getGeoObject(geo_name, GeoLib::GEOTYPE::POINT, geo_obj_name)
);
if(!geo_obj)
geo_obj = getGeoObject(geo_name, GeoLib::GEOTYPE::POLYLINE, geo_obj_name);
if(!geo_obj)
geo_obj = getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name);
if (!geo_obj) {
ERR("GEOObjects::getGeoObject(): Could not find \"%s\" in geometry %s.",
geo_obj_name.c_str(), geo_name.c_str());
}
return geo_obj;
}
int GEOObjects::exists(const std::string &geometry_name) const int GEOObjects::exists(const std::string &geometry_name) const
{ {
std::size_t size (_pnt_vecs.size()); std::size_t size (_pnt_vecs.size());
......
/** /**
* \file
* \author Thomas Fischer / Karsten Rink * \author Thomas Fischer / Karsten Rink
* \date 2010-01-21 * \date 2010-01-21
* \brief Definition of the GeoObjects class. * \brief Definition of the GeoObjects class.
...@@ -257,6 +256,18 @@ public: ...@@ -257,6 +256,18 @@ public:
GeoLib::GEOTYPE type, GeoLib::GEOTYPE type,
const std::string &geo_obj_name) const; const std::string &geo_obj_name) const;
/// Return named (by the tuple geo_name and geo_obj_name) geo object.
// It is required that a tuple is a unique key for a geometric object!
// If there is another geo object with same name one of them is returned.
// In theory different types of geometric objects can have the same name.
// For instance it is possible that a point object and a polyline object
// share the same name. If there exists several objects sharing the same
// name the first object found will be returned.
// @param geo_name name of geometry
// @param geo_obj_name name of the geo object
GeoLib::GeoObject const* getGeoObject(const std::string &geo_name,
const std::string &geo_obj_name) const;
/** constructor */ /** constructor */
GEOObjects(); GEOObjects();
/** destructor */ /** destructor */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment