Merge branch 'master' into v0.6.0

# Conflicts:
#	src/ifcconvert/IfcConvert.cpp
#	src/ifcgeom/IfcGeomFilter.h
#	src/ifcgeom/IfcGeomIteratorImplementation.h
#	src/ifcgeom/IfcGeomWires.cpp
#	src/ifcparse/IfcFile.h
#	src/ifcparse/IfcLogger.cpp
#	src/ifcparse/IfcLogger.h
#	src/ifcparse/IfcParse.cpp
#	src/serializers/SvgSerializer.cpp
#	src/serializers/schema_dependent/XmlSerializer.cpp
This commit is contained in:
Thomas Krijnen
2018-07-07 17:15:54 +02:00
33 changed files with 3564 additions and 335 deletions
+5 -3
View File
@@ -21,6 +21,8 @@
#include "ColladaSerializer.h"
#include <boost/foreach.hpp>
#include <COLLADASWPrimitves.h>
#include <COLLADASWSource.h>
#include <COLLADASWScene.h>
@@ -223,7 +225,7 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
node.addMatrix(matrix_array);
COLLADASW::InstanceGeometry instanceGeometry(mSW);
instanceGeometry.setUrl ("#" + geom_name);
foreach(std::string material_name, material_ids) {
BOOST_FOREACH(std::string material_name, material_ids) {
/// @todo This is done 6 times in this file, try to perform this once and be done with the material naming for the export.
collada_id(material_name);
COLLADASW::InstanceMaterial material (material_name, "#" + material_name);
@@ -362,7 +364,7 @@ bool ColladaSerializer::ColladaExporter::ColladaMaterials::contains(const IfcGeo
void ColladaSerializer::ColladaExporter::ColladaMaterials::write() {
effects.close();
foreach(const IfcGeom::Material& material, materials) {
BOOST_FOREACH(const IfcGeom::Material& material, materials) {
std::string material_name = (serializer->settings().get(SerializerSettings::USE_MATERIAL_NAMES)
? material.original_name() : material.name());
std::string material_name_unescaped = material_name; // workaround double-escaping that would occur in addInstanceEffect()
@@ -408,7 +410,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
collada_id(representation_id);
std::vector<std::string> material_references;
foreach(const IfcGeom::Material& material, mesh.materials()) {
BOOST_FOREACH(const IfcGeom::Material& material, mesh.materials()) {
if (!materials.contains(material)) {
materials.add(material);
}
+12 -12
View File
@@ -360,26 +360,26 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* o)
if (pnt.Z() < zmin) { zmin = pnt.Z(); }
if (pnt.Z() > zmax) { zmax = pnt.Z(); }
}}
if (section_height) {
if (zmin > section_height || zmax < section_height) continue;
} else {
if (zmin == inf || (zmax - zmin) < 1.) continue;
}
// Priority:
// 1) section_height
// 2) Storey elevation + 1m
// 3) zmin + 1m
// Empty geometry, no vertices encountered
if (zmin == inf) continue;
// Determine slicing plane z coordinate, priority:
// 1) explicitly set global section height
// 2) containing building storey elevation + 1m
// 3) zmin (from geometry bounding box) + 1m
double cut_z;
if (section_height) {
cut_z = section_height.get();
} else if (storey_elevation) {
} else if (storey_elevation && !(zmin > *storey_elevation || zmax < *storey_elevation)) {
cut_z = storey_elevation.get() + 1.;
} else {
cut_z = zmin + 1.;
}
// No intersection with bounding box, fail early
if (zmin > cut_z || zmax < cut_z) continue;
// Create a horizontal cross section 1 meter above the bottom point of the shape
TopoDS_Shape result = BRepAlgoAPI_Section(subshape, gp_Pln(gp_Pnt(0, 0, cut_z), gp::DZ()));
@@ -22,6 +22,7 @@
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/version.hpp>
#include <boost/foreach.hpp>
#include "XmlSerializer.h"
@@ -279,6 +280,9 @@ ptree& descend(IfcSchema::IfcObjectDefinition* product, ptree& tree) {
if (pset->declaration().is(IfcSchema::IfcElementQuantity::Class())) {
format_entity_instance(pset, child, true);
}
if (pset->declaration().is(IfcSchema::IfcElementQuantity::Class())) {
format_entity_instance(pset, child, true);
}
}
#ifdef USE_IFC4
@@ -358,16 +362,16 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() {
ptree root, header, units, decomposition, properties, quantities, types, layers, materials;
// Write the SPF header as XML nodes.
foreach(const std::string& s, file->header().file_description().description()) {
BOOST_FOREACH(const std::string& s, file->header().file_description().description()) {
header.add_child("file_description.description", ptree(s));
}
foreach(const std::string& s, file->header().file_name().author()) {
BOOST_FOREACH(const std::string& s, file->header().file_name().author()) {
header.add_child("file_name.author", ptree(s));
}
foreach(const std::string& s, file->header().file_name().organization()) {
BOOST_FOREACH(const std::string& s, file->header().file_name().organization()) {
header.add_child("file_name.organization", ptree(s));
}
foreach(const std::string& s, file->header().file_schema().schema_identifiers()) {
BOOST_FOREACH(const std::string& s, file->header().file_schema().schema_identifiers()) {
header.add_child("file_schema.schema_identifiers", ptree(s));
}
header.put("file_description.implementation_level", file->header().file_description().implementation_level());
@@ -450,8 +454,11 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() {
emitted_materials.insert(mat);
ptree node;
node.put("<xmlattr>.id", qualify_unrooted_instance(mat));
if (mat->as<IfcSchema::IfcMaterialLayerSetUsage>()) {
IfcSchema::IfcMaterialLayerSet* layerset = mat->as<IfcSchema::IfcMaterialLayerSetUsage>()->ForLayerSet();
if (mat->as<IfcSchema::IfcMaterialLayerSetUsage>() || mat->as<IfcSchema::IfcMaterialLayerSet>()) {
IfcSchema::IfcMaterialLayerSet* layerset = mat->as<IfcSchema::IfcMaterialLayerSet>();
if (!layerset) {
layerset = mat->as<IfcSchema::IfcMaterialLayerSetUsage>()->ForLayerSet();
}
if (layerset->hasLayerSetName()) {
node.put("<xmlattr>.LayerSetName", layerset->LayerSetName());
}