mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 11:20:21 +00:00
Allow passing buffer to serializers that support it
This commit is contained in:
@@ -50,6 +50,16 @@ plugin::metadata plugin_metadata() {
|
||||
}
|
||||
|
||||
boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serializer_context& context) {
|
||||
if (context.output_temp_stream || context.output_stream) {
|
||||
stream_or_filename obj_filename = context.output_temp_stream
|
||||
? *context.output_temp_stream
|
||||
: stream_or_filename(context.output_temp_filename);
|
||||
stream_or_filename mtl_filename = context.output_stream
|
||||
? *context.output_stream
|
||||
: stream_or_filename(obj_mtl_filename(context.output_filename));
|
||||
return boost::make_shared<WaveFrontOBJSerializer>(
|
||||
obj_filename, mtl_filename, context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
return boost::make_shared<WaveFrontOBJSerializer>(context.output_temp_filename, obj_mtl_filename(context.output_filename), context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ struct SERIALIZERS_API geometry_serializer_context {
|
||||
std::string output_temp_filename;
|
||||
ifcopenshell::geometry::Settings& geometry_settings;
|
||||
const ifcopenshell::geometry::SerializerSettings& serializer_settings;
|
||||
const stream_or_filename* output_stream = nullptr;
|
||||
const stream_or_filename* output_temp_stream = nullptr;
|
||||
};
|
||||
|
||||
class SERIALIZERS_API geometry_serializer_registry {
|
||||
|
||||
@@ -38,6 +38,10 @@ plugin::metadata plugin_metadata() {
|
||||
}
|
||||
|
||||
boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serializer_context& context) {
|
||||
if (context.output_temp_stream) {
|
||||
return boost::make_shared<SvgSerializer>(
|
||||
*context.output_temp_stream, context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
return boost::make_shared<SvgSerializer>(context.output_temp_filename, context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ plugin::metadata plugin_metadata() {
|
||||
}
|
||||
|
||||
boost::shared_ptr<GeometrySerializer> create_serializer(const geometry_serializer_context& context) {
|
||||
if (context.output_temp_stream) {
|
||||
return boost::make_shared<TtlWktSerializer>(
|
||||
*context.output_temp_stream, context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
return boost::make_shared<TtlWktSerializer>(context.output_temp_filename, context.geometry_settings, context.serializer_settings);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user