Commit f5eaf3d8 authored by Christoph Lehmann's avatar Christoph Lehmann

Merge pull request #1128 from chleh/cleanup-geotype

Cleanup GEOTYPE
parents c7b5b8d3 33ec81ec
......@@ -76,11 +76,11 @@ void GEOModels::updateGeometry(const std::string &geo_name)
void GEOModels::removeGeometry(std::string const& geo_name,
GeoLib::GEOTYPE const type)
{
if (type == GeoLib::GEOTYPE::INVALID || type == GeoLib::GEOTYPE::SURFACE)
if (type == GeoLib::GEOTYPE::SURFACE)
_geo_objects.removeSurfaceVec(geo_name);
if (type == GeoLib::GEOTYPE::INVALID || type == GeoLib::GEOTYPE::POLYLINE)
if (type == GeoLib::GEOTYPE::POLYLINE)
_geo_objects.removePolylineVec(geo_name);
if (type == GeoLib::GEOTYPE::INVALID || type == GeoLib::GEOTYPE::POINT)
if (type == GeoLib::GEOTYPE::POINT)
_geo_objects.removePointVec(geo_name);
}
......
......@@ -331,9 +331,6 @@ void GeoTreeModel::setNameForItem(const std::string &name,
case GeoLib::GEOTYPE::SURFACE:
geo_type_str = "Surfaces";
break;
case GeoLib::GEOTYPE::VOLUME:
geo_type_str = "Volumes";
break;
default:
geo_type_str = "";
}
......
......@@ -66,7 +66,7 @@ public:
* Removes a geometry (points, polylines & surfaces) or just a specified subtree indicated by type.
* Note that points cannot be deleted as long as other objects exist that depend on them.
*/
void removeGeoList(const std::string &name, GeoLib::GEOTYPE type = GeoLib::GEOTYPE::INVALID);
void removeGeoList(const std::string &name, GeoLib::GEOTYPE type);
void setNameForItem(const std::string &name, GeoLib::GEOTYPE type, std::size_t id, std::string item_name);
......
......@@ -203,11 +203,14 @@ void GeoTreeView::removeGeometry()
{
TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem(index);
GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item);
if (list)
if (list) {
emit listRemoved((item->parentItem()->data(
0).toString()).toStdString(), list->getType());
else
emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::INVALID);
} else {
emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::SURFACE);
emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::POLYLINE);
emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::POINT);
}
if(this->selectionModel()->selectedIndexes().count() == 0)
{
......
......@@ -314,7 +314,6 @@ void MshView::addDIRECTSourceTerms()
{
QModelIndex const index = this->selectionModel()->currentIndex();
MeshLib::Mesh const*const grid = static_cast<MshModel*>(this->model())->getMesh(index);
emit requestCondSetupDialog(grid->getName(), GeoLib::GEOTYPE::INVALID, 0, false);
}
void MshView::loadDIRECTSourceTerms()
......
......@@ -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());
......
......@@ -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 =
......
/**
* \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_ */
......@@ -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
......@@ -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
......
......@@ -71,11 +71,6 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs(GeoLib::GeoObject cons
case GeoLib::GEOTYPE::SURFACE:
vec_nodes = this->getMeshNodeIDsAlongSurface(*static_cast<const GeoLib::Surface*>(&geoObj));
break;
case GeoLib::GEOTYPE::GEODOMAIN:
vec_nodes.resize(_mesh.getNNodes());
for (std::size_t i=0; i<_mesh.getNNodes(); i++)
vec_nodes[i] = i;
break;
default:
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment