From 47d4ea00ca2c4b95600811487161873d5c6bd880 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 28 Jan 2021 16:32:16 +0100 Subject: [PATCH] Include outline in HLR render --- src/serializers/SvgSerializer.cpp | 39 +++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index cc8f3c621c..3aff042ba3 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -988,6 +988,41 @@ std::array, 3> SvgSerializer::resize() { } namespace { + template + TopoDS_Compound occt_join(T t) { + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + if (!t.IsNull()) { + TopoDS_Iterator it(t); + for (; it.More(); it.Next()) { + B.Add(C, it.Value()); + } + } + return C; + } + + template + TopoDS_Compound occt_join(T t, Ts... tss) { + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + if (!t.IsNull()) { + TopoDS_Iterator it(t); + for (; it.More(); it.Next()) { + B.Add(C, it.Value()); + } + } + auto rest = occt_join(tss...); + if (!rest.IsNull()) { + TopoDS_Iterator it(rest); + for (; it.More(); it.Next()) { + B.Add(C, it.Value()); + } + } + return C; + } + class hlr_calc { private: const HLRAlgo_Projector& projector_; @@ -1005,7 +1040,7 @@ namespace { algo->Update(); algo->Hide(); HLRBRep_HLRToShape hlr_shapes(algo); - return hlr_shapes.VCompound(); + return occt_join(hlr_shapes.OutLineVCompound(), hlr_shapes.VCompound()); } TopoDS_Shape operator()(Handle(HLRBRep_PolyAlgo)& algo) { @@ -1013,7 +1048,7 @@ namespace { algo->Update(); HLRBRep_PolyHLRToShape hlr_shapes; hlr_shapes.Update(algo); - return hlr_shapes.VCompound(); + return occt_join(hlr_shapes.OutLineVCompound(), hlr_shapes.VCompound()); } }; }