From e23e2719eee8ecf11318e2bdcd47e053787b6a45 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Wed, 6 Apr 2016 11:53:31 +0200 Subject: [PATCH] [GL] removed unused GEOTYPE enum entries --- GeoLib/GEOObjects.cpp | 14 -------------- GeoLib/GEOObjects.h | 3 --- GeoLib/GeoDomain.h | 27 --------------------------- GeoLib/GeoType.cpp | 27 +++++++++++---------------- GeoLib/GeoType.h | 11 +++-------- 5 files changed, 14 insertions(+), 68 deletions(-) delete mode 100644 GeoLib/GeoDomain.h diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp index 71943c61374..2bb2520d3a2 100644 --- a/GeoLib/GEOObjects.cpp +++ b/GeoLib/GEOObjects.cpp @@ -364,13 +364,6 @@ const std::string GEOObjects::getElementNameByID(const std::string &geometry_nam break; case GeoLib::GEOTYPE::SURFACE: this->getSurfaceVecObj(geometry_name)->getNameOfElementByID(id, name); - break; - case GeoLib::GEOTYPE::VOLUME: - case GeoLib::GEOTYPE::GEODOMAIN: - case GeoLib::GEOTYPE::INVALID: - default: - WARN("GEOObjects::getElementNameByID() - No valid GEOTYPE given."); - break; } return name; } @@ -556,10 +549,6 @@ const GeoLib::GeoObject* GEOObjects::getGeoObject(const std::string &geo_name, sfc_vec->getElementByName(geo_obj_name))); break; } - case GeoLib::GEOTYPE::GEODOMAIN: { - geo_obj = const_cast<GeoLib::GeoDomain*>(&_geo_domain); - break; - } default: ERR("GEOObjects::getGeoObject(): geometric type not handled.") return nullptr; @@ -586,9 +575,6 @@ GeoLib::GeoObject const* GEOObjects::getGeoObject( if(!geo_obj) geo_obj = getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name); - if(!geo_obj) - geo_obj = getGeoObject(geo_name, GeoLib::GEOTYPE::GEODOMAIN, geo_obj_name); - if (!geo_obj) { DBUG("GEOObjects::getGeoObject(): Could not find \"%s\" in geometry %s.", geo_obj_name.c_str(), geo_name.c_str()); diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h index 56f42fbb93a..72d50ab8146 100644 --- a/GeoLib/GEOObjects.h +++ b/GeoLib/GEOObjects.h @@ -25,7 +25,6 @@ #include "PolylineVec.h" #include "Surface.h" #include "SurfaceVec.h" -#include "GeoDomain.h" #include "Station.h" @@ -278,8 +277,6 @@ public: /** vector manages pointers to SurfaceVec objects */ std::vector<SurfaceVec*> _sfc_vecs; - GeoDomain _geo_domain; - std::unique_ptr<Callbacks> _callbacks{new Callbacks}; std::function<void(std::string const&)> addPolylineVecCallback = diff --git a/GeoLib/GeoDomain.h b/GeoLib/GeoDomain.h deleted file mode 100644 index 2236fba2ed2..00000000000 --- a/GeoLib/GeoDomain.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * \copyright - * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#ifndef GEODOMAIN_H_ -#define GEODOMAIN_H_ - -#include "GeoType.h" -#include "GeoObject.h" - -namespace GeoLib -{ -class GeoDomain : public GeoObject -{ -public: - virtual ~GeoDomain() = default; - /// return a geometry type - virtual GEOTYPE getGeoType() const {return GEOTYPE::GEODOMAIN; } -}; -} // end namespace GeoLib - -#endif /* GEODOMAIN_H_ */ diff --git a/GeoLib/GeoType.cpp b/GeoLib/GeoType.cpp index ea5c7e73f75..4162b062e83 100644 --- a/GeoLib/GeoType.cpp +++ b/GeoLib/GeoType.cpp @@ -14,27 +14,22 @@ #include "GeoType.h" -namespace GeoLib { +#include <cstdlib> -GEOTYPE convertGeoType (const std::string& geo_type_str) +namespace GeoLib { - if (geo_type_str.compare ("POINT") == 0) return GEOTYPE::POINT; - if (geo_type_str.compare ("POLYLINE") == 0) return GEOTYPE::POLYLINE; - if (geo_type_str.compare ("SURFACE") == 0) return GEOTYPE::SURFACE; - if (geo_type_str.compare ("VOLUME") == 0) return GEOTYPE::VOLUME; - if (geo_type_str.compare ("GEODOMAIN") == 0) return GEOTYPE::GEODOMAIN; - if (geo_type_str.compare ("DOMAIN") == 0) return GEOTYPE::GEODOMAIN; - return GEOTYPE::INVALID; -} std::string convertGeoTypeToString (GEOTYPE geo_type) { - if (geo_type == GEOTYPE::POINT) return "POINT"; - if (geo_type == GEOTYPE::POLYLINE) return "POLYLINE"; - if (geo_type == GEOTYPE::SURFACE) return "SURFACE"; - if (geo_type == GEOTYPE::VOLUME) return "VOLUME"; - if (geo_type == GEOTYPE::GEODOMAIN) return "GEODOMAIN"; - return "INVALID"; + switch (geo_type) + { + case GEOTYPE::POINT: return "POINT"; + case GEOTYPE::POLYLINE: return "POLYLINE"; + case GEOTYPE::SURFACE: return "SURFACE"; + } + + std::abort(); // Cannot happen, because switch covers all cases. + // Used to silence compiler warning. } } // end namespace GeoLib diff --git a/GeoLib/GeoType.h b/GeoLib/GeoType.h index 0c823d35e45..31fbf17529e 100644 --- a/GeoLib/GeoType.h +++ b/GeoLib/GeoType.h @@ -24,16 +24,11 @@ namespace GeoLib { */ enum class GEOTYPE { - INVALID = 0, - POINT, //!< POINT - POLYLINE, //!< POLYLINE - SURFACE, //!< SURFACE - VOLUME, //!< VOLUME - GEODOMAIN //!< GEODOMAIN + POINT, + POLYLINE, + SURFACE }; -GEOTYPE convertGeoType (const std::string& geo_type_str); - std::string convertGeoTypeToString (GEOTYPE geo_type); } // end namespace GeoLib -- GitLab