mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Merge branch 'v0.6.0' into v0.7.0
# Conflicts: # cmake/CMakeLists.txt # src/ifcconvert/IfcConvert.cpp # src/ifcgeom/IfcGeomRepresentation.h # src/ifcgeom/IfcRepresentationShapeItem.h # src/ifcgeom/kernels/opencascade/IfcGeomFunctions.cpp # src/ifcgeom/schema_agnostic/IfcGeomRepresentation.cpp # src/ifcgeom/schema_agnostic/Kernel.cpp # src/ifcgeom/schema_agnostic/Kernel.h # src/ifcgeomserver/IfcGeomServer.cpp # src/serializers/schema_dependent/XmlSerializer.cpp
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
static std::string& collada_id(std::string& s)
|
||||
{
|
||||
IfcUtil::sanitate_material_name(s);
|
||||
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
ColladaExporter(const std::string& scene_name, const std::string& fn, ColladaSerializer *_serializer,
|
||||
bool double_precision)
|
||||
: filename(fn)
|
||||
, stream(filename, double_precision)
|
||||
, stream(COLLADASW::NativeString(filename.c_str(), COLLADASW::NativeString::ENCODING_UTF8), double_precision)
|
||||
, scene(scene_name, stream, _serializer)
|
||||
, materials(stream, _serializer)
|
||||
, geometries(stream, _serializer)
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include "OpenCascadeBasedSerializer.h"
|
||||
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
@@ -24,13 +28,11 @@
|
||||
#include <Standard_Version.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
|
||||
#include "OpenCascadeBasedSerializer.h"
|
||||
|
||||
bool OpenCascadeBasedSerializer::ready() {
|
||||
std::ofstream test_file(out_filename.c_str(), std::ios_base::binary);
|
||||
std::ofstream test_file(IfcUtil::path::from_utf8(out_filename).c_str(), std::ios_base::binary);
|
||||
bool succeeded = test_file.is_open();
|
||||
test_file.close();
|
||||
remove(out_filename.c_str());
|
||||
IfcUtil::path::delete_file(out_filename);
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "../serializers/GeometrySerializer.h"
|
||||
#include "../serializers/util.h"
|
||||
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
@@ -46,7 +48,7 @@ protected:
|
||||
public:
|
||||
SvgSerializer(const std::string& out_filename, const SerializerSettings& settings)
|
||||
: GeometrySerializer(settings)
|
||||
, svg_file(out_filename.c_str())
|
||||
, svg_file(IfcUtil::path::from_utf8(out_filename).c_str())
|
||||
, xmin(+std::numeric_limits<double>::infinity())
|
||||
, ymin(+std::numeric_limits<double>::infinity())
|
||||
, xmax(-std::numeric_limits<double>::infinity())
|
||||
|
||||
@@ -22,9 +22,22 @@
|
||||
|
||||
#include "../ifcgeom/schema_agnostic/IfcGeomRenderStyles.h"
|
||||
|
||||
#include "../ifcparse/utils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iomanip>
|
||||
|
||||
WaveFrontOBJSerializer::WaveFrontOBJSerializer(const std::string& obj_filename, const std::string& mtl_filename, const SerializerSettings& settings)
|
||||
: GeometrySerializer(settings)
|
||||
, mtl_filename(mtl_filename)
|
||||
, obj_stream(IfcUtil::path::from_utf8(obj_filename).c_str())
|
||||
, mtl_stream(IfcUtil::path::from_utf8(mtl_filename).c_str())
|
||||
, vcount_total(1)
|
||||
{
|
||||
obj_stream << std::setprecision(settings.precision);
|
||||
mtl_stream << std::setprecision(settings.precision);
|
||||
}
|
||||
|
||||
bool WaveFrontOBJSerializer::ready() {
|
||||
return obj_stream.is_open() && mtl_stream.is_open();
|
||||
}
|
||||
|
||||
@@ -35,17 +35,7 @@ private:
|
||||
unsigned int vcount_total;
|
||||
std::set<std::string> materials;
|
||||
public:
|
||||
WaveFrontOBJSerializer(const std::string& obj_filename, const std::string& mtl_filename, const SerializerSettings& settings)
|
||||
: GeometrySerializer(settings)
|
||||
, mtl_filename(mtl_filename)
|
||||
, obj_stream(obj_filename.c_str())
|
||||
, mtl_stream(mtl_filename.c_str())
|
||||
, vcount_total(1)
|
||||
{
|
||||
obj_stream << std::setprecision(settings.precision);
|
||||
mtl_stream << std::setprecision(settings.precision);
|
||||
}
|
||||
|
||||
WaveFrontOBJSerializer(const std::string& obj_filename, const std::string& mtl_filename, const SerializerSettings& settings);
|
||||
virtual ~WaveFrontOBJSerializer() {}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <boost/version.hpp>
|
||||
@@ -29,6 +27,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "../../ifcparse/IfcSIPrefix.h"
|
||||
#include "../../ifcparse/utils.h"
|
||||
#include "../../ifcgeom/kernels/opencascade/IfcGeom.h"
|
||||
|
||||
using boost::property_tree::ptree;
|
||||
@@ -36,7 +35,7 @@ using boost::property_tree::ptree;
|
||||
#include "XmlSerializer.h"
|
||||
|
||||
namespace {
|
||||
struct factory_t {
|
||||
struct MAKE_TYPE_NAME(factory_t) {
|
||||
XmlSerializer* operator()(IfcParse::IfcFile* file, const std::string& xml_filename) const {
|
||||
MAKE_TYPE_NAME(XmlSerializer)* s = new MAKE_TYPE_NAME(XmlSerializer)(file, xml_filename);
|
||||
s->setFile(file);
|
||||
@@ -47,7 +46,7 @@ namespace {
|
||||
|
||||
void MAKE_INIT_FN(XmlSerializer)(XmlSerializerFactory::Factory* mapping) {
|
||||
static const std::string schema_name = STRINGIFY(IfcSchema);
|
||||
factory_t factory;
|
||||
MAKE_TYPE_NAME(factory_t) factory;
|
||||
mapping->bind(schema_name, factory);
|
||||
}
|
||||
|
||||
@@ -549,5 +548,7 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() {
|
||||
#else
|
||||
boost::property_tree::xml_writer_settings<char> settings('\t', 1);
|
||||
#endif
|
||||
boost::property_tree::write_xml(xml_filename, root, std::locale(), settings);
|
||||
|
||||
std::ofstream f(IfcUtil::path::from_utf8(xml_filename).c_str());
|
||||
boost::property_tree::write_xml(f, root, settings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user