OGS
writeGeometryToFile.cpp
Go to the documentation of this file.
1
12#include "writeGeometryToFile.h"
13
14#include "BaseLib/FileTools.h"
15#include "GeoLib/GEOObjects.h"
17#include "Legacy/OGSIOVer4.h"
18
19namespace FileIO
20{
21void writeGeometryToFile(std::string const& geo_name,
22 GeoLib::GEOObjects& geo_objs, std::string const& fname)
23{
24 std::string const extension(BaseLib::getFileExtension(fname));
25 if (extension == ".gml" || extension == ".GML")
26 {
28 xml.export_name = geo_name;
30 }
31 else if (extension == "gli" || extension == "GLI")
32 {
33 FileIO::Legacy::writeGLIFileV4(fname, geo_name, geo_objs);
34 }
35 else
36 {
37 ERR("Writing of geometry failed, since it was not possible to determine"
38 " the required format from file extension.");
39 }
40}
41} // namespace FileIO
Definition of the BoostXmlGmlInterface class.
Filename manipulation routines.
Definition of the GEOObjects class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
Definition of the OGSIOVer4 class.
std::string writeToString()
Writes the object to a string.
Definition Writer.cpp:31
Container class for geometric objects.
Definition GEOObjects.h:57
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)
Definition Writer.cpp:45
std::string getFileExtension(const std::string &path)
void writeGLIFileV4(const std::string &fname, const std::string &geo_name, const GeoLib::GEOObjects &geo)
void writeGeometryToFile(std::string const &geo_name, GeoLib::GEOObjects &geo_objs, std::string const &fname)