Forked from
ogs / ogs
18835 commits behind the upstream repository.
-
Tom Fischer authoredTom Fischer authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
GeoMapper.cpp 20.28 KiB
/**
* \file
* \author Karsten Rink
* \date 2012-09-25
* \brief Implementation of the GeoMapper class.
*
* \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
*
*/
#include "GeoMapper.h"
#include <algorithm>
#include <sstream>
#include <numeric>
#include <logog/include/logog.hpp>
#include "BaseLib/makeVectorUnique.h"
#include "BaseLib/Error.h"
#include "GeoLib/AABB.h"
#include "GeoLib/AnalyticalGeometry.h"
#include "GeoLib/GEOObjects.h"
#include "GeoLib/Raster.h"
#include "GeoLib/StationBorehole.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Elements/Element.h"
#include "MeshLib/Elements/FaceRule.h"
#include "MeshLib/Node.h"
#include "MeshLib/MeshSurfaceExtraction.h"
#include "MeshLib/MeshEditing/projectMeshOntoPlane.h"
#include "MeshLib/MeshSearch/MeshElementGrid.h"
namespace MeshGeoToolsLib {
GeoMapper::GeoMapper(GeoLib::GEOObjects &geo_objects, const std::string &geo_name)
: _geo_objects(geo_objects), _geo_name(const_cast<std::string&>(geo_name)),
_surface_mesh(nullptr), _grid(nullptr), _raster(nullptr)
{
}
GeoMapper::~GeoMapper()
{
delete _surface_mesh;
delete _raster;
}
void GeoMapper::mapOnDEM(GeoLib::Raster *const raster)
{
std::vector<GeoLib::Point*> const* pnts(_geo_objects.getPointVec(_geo_name));
if (! pnts) {
ERR("Geometry \"%s\" does not exist.", _geo_name.c_str());
return;
}
_raster = raster;
if (GeoLib::isStation((*pnts)[0])) {
mapStationData(*pnts);
} else {
mapPointDataToDEM(*pnts);
}
}
void GeoMapper::mapOnMesh(MeshLib::Mesh const*const mesh)