OGS
writeGeometryToFile.cpp
Go to the documentation of this file.
1 
11 #include "writeGeometryToFile.h"
12 
13 #include "BaseLib/FileTools.h"
14 #include "GeoLib/GEOObjects.h"
16 #include "Legacy/OGSIOVer4.h"
17 
18 namespace FileIO
19 {
20 void writeGeometryToFile(std::string const& geo_name,
21  GeoLib::GEOObjects& geo_objs, std::string const& fname)
22 {
23  std::string const extension(BaseLib::getFileExtension(fname));
24  if (extension == ".gml" || extension == ".GML")
25  {
27  xml.export_name = geo_name;
29  }
30  else if (extension == "gli" || extension == "GLI")
31  {
32  FileIO::Legacy::writeGLIFileV4(fname, geo_name, geo_objs);
33  }
34  else
35  {
36  ERR("Writing of geometry failed, since it was not possible to determine"
37  " the required format from file extension.");
38  }
39 }
40 } // namespace FileIO
Definition of the BoostXmlGmlInterface class.
Filename manipulation routines.
Definition of the GEOObjects class.
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42
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:61
int writeStringToFile(std::string content, std::filesystem::path const &file_path)
Definition: Writer.cpp:45
std::string getFileExtension(const std::string &path)
Definition: FileTools.cpp:186
void writeGLIFileV4(const std::string &fname, const std::string &geo_name, const GeoLib::GEOObjects &geo)
Definition: OGSIOVer4.cpp:648
void writeGeometryToFile(std::string const &geo_name, GeoLib::GEOObjects &geo_objs, std::string const &fname)