https://gitlab.opengeosys.org/ogs/ogs.git
Revision e35ef356ff378abbfa5b767dcfd2db4afc529405 authored by Dmitri Naumov on 09 December 2015, 16:37:53 UTC, committed by Thomas Fischer on 14 December 2015, 09:50:03 UTC
Use reserve and push_back for copy instead of resize
saving initialization of the data.
1 parent b2f4478
Raw File
Tip revision: e35ef356ff378abbfa5b767dcfd2db4afc529405 authored by Dmitri Naumov on 09 December 2015, 16:37:53 UTC
[MeL] Assert materials PropVector. Speedup copy.
Tip revision: e35ef35
writeGeometryToFile.cpp
/**
 *
 * \copyright
 * Copyright (c) 2012-2015, 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 "writeGeometryToFile.h"

#include "BaseLib/FileTools.h"

#include "FileIO/XmlIO/Boost/BoostXmlGmlInterface.h"
#include "FileIO/Legacy/OGSIOVer4.h"

#include "GeoLib/GEOObjects.h"

namespace FileIO
{
void writeGeometryToFile(std::string const& geo_name,
	GeoLib::GEOObjects& geo_objs, std::string const& fname)
{
	std::string const extension(BaseLib::getFileExtension(fname));
	if (extension == "gml" || extension == "GML") {
		FileIO::BoostXmlGmlInterface xml(geo_objs);
		xml.setNameForExport(geo_name);
		xml.writeToFile(fname);
	} else if (extension == "gli" || extension == "GLI") {
		FileIO::Legacy::writeGLIFileV4(fname, geo_name, geo_objs);
	} else {
		ERR("Writing of geometry failed, since it was not possible to determine"
			" the required format from file extension.");
	}
}
}
back to top