mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Replaced macros, added basic CGAL definitions
This commit is contained in:
@@ -208,7 +208,7 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
|||||||
node.addMatrix(matrix_array);
|
node.addMatrix(matrix_array);
|
||||||
COLLADASW::InstanceGeometry instanceGeometry(mSW);
|
COLLADASW::InstanceGeometry instanceGeometry(mSW);
|
||||||
instanceGeometry.setUrl ("#" + geom_name);
|
instanceGeometry.setUrl ("#" + geom_name);
|
||||||
foreach(std::string material_name, material_ids) {
|
for (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.
|
/// @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);
|
collada_id(material_name);
|
||||||
COLLADASW::InstanceMaterial material (material_name, "#" + material_name);
|
COLLADASW::InstanceMaterial material (material_name, "#" + material_name);
|
||||||
@@ -276,7 +276,7 @@ bool ColladaSerializer::ColladaExporter::ColladaMaterials::contains(const IfcGeo
|
|||||||
|
|
||||||
void ColladaSerializer::ColladaExporter::ColladaMaterials::write() {
|
void ColladaSerializer::ColladaExporter::ColladaMaterials::write() {
|
||||||
effects.close();
|
effects.close();
|
||||||
foreach(const IfcGeom::Material& material, materials) {
|
for (const IfcGeom::Material& material: materials) {
|
||||||
std::string material_name = (serializer->settings().get(IfcGeom::IteratorSettings::USE_MATERIAL_NAMES)
|
std::string material_name = (serializer->settings().get(IfcGeom::IteratorSettings::USE_MATERIAL_NAMES)
|
||||||
? material.original_name() : material.name());
|
? material.original_name() : material.name());
|
||||||
std::string material_name_unescaped = material_name; // workaround double-escaping that would occur in addInstanceEffect()
|
std::string material_name_unescaped = material_name; // workaround double-escaping that would occur in addInstanceEffect()
|
||||||
@@ -307,7 +307,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
|
|||||||
const std::string representation_id = "representation-" + boost::lexical_cast<std::string>(o->geometry().id());
|
const std::string representation_id = "representation-" + boost::lexical_cast<std::string>(o->geometry().id());
|
||||||
|
|
||||||
std::vector<std::string> material_references;
|
std::vector<std::string> material_references;
|
||||||
foreach(const IfcGeom::Material& material, mesh.materials()) {
|
for (const IfcGeom::Material& material: mesh.materials()) {
|
||||||
if (!materials.contains(material)) {
|
if (!materials.contains(material)) {
|
||||||
materials.add(material);
|
materials.add(material);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,16 +341,16 @@ void XmlSerializer::finalize() {
|
|||||||
ptree root, header, units, decomposition, properties, types, layers;
|
ptree root, header, units, decomposition, properties, types, layers;
|
||||||
|
|
||||||
// Write the SPF header as XML nodes.
|
// Write the SPF header as XML nodes.
|
||||||
foreach(const std::string& s, file->header().file_description().description()) {
|
for (const std::string& s: file->header().file_description().description()) {
|
||||||
header.add_child("file_description.description", ptree(s));
|
header.add_child("file_description.description", ptree(s));
|
||||||
}
|
}
|
||||||
foreach(const std::string& s, file->header().file_name().author()) {
|
for (const std::string& s: file->header().file_name().author()) {
|
||||||
header.add_child("file_name.author", ptree(s));
|
header.add_child("file_name.author", ptree(s));
|
||||||
}
|
}
|
||||||
foreach(const std::string& s, file->header().file_name().organization()) {
|
for (const std::string& s: file->header().file_name().organization()) {
|
||||||
header.add_child("file_name.organization", ptree(s));
|
header.add_child("file_name.organization", ptree(s));
|
||||||
}
|
}
|
||||||
foreach(const std::string& s, file->header().file_schema().schema_identifiers()) {
|
for (const std::string& s: file->header().file_schema().schema_identifiers()) {
|
||||||
header.add_child("file_schema.schema_identifiers", ptree(s));
|
header.add_child("file_schema.schema_identifiers", ptree(s));
|
||||||
}
|
}
|
||||||
header.put("file_description.implementation_level", file->header().file_description().implementation_level());
|
header.put("file_description.implementation_level", file->header().file_description().implementation_level());
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ namespace IfcGeom {
|
|||||||
void include_entity_names(const std::vector<std::string>& names)
|
void include_entity_names(const std::vector<std::string>& names)
|
||||||
{
|
{
|
||||||
names_to_include_or_exclude.clear();
|
names_to_include_or_exclude.clear();
|
||||||
foreach(const std::string &name, names)
|
for (const std::string &name: names)
|
||||||
names_to_include_or_exclude.insert(wildcard_string_to_regex(name));
|
names_to_include_or_exclude.insert(wildcard_string_to_regex(name));
|
||||||
include_names_in_processing_ = true;
|
include_names_in_processing_ = true;
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ namespace IfcGeom {
|
|||||||
void exclude_entity_names(const std::vector<std::string>& names)
|
void exclude_entity_names(const std::vector<std::string>& names)
|
||||||
{
|
{
|
||||||
names_to_include_or_exclude.clear();
|
names_to_include_or_exclude.clear();
|
||||||
foreach(const std::string &name, names)
|
for (const std::string &name: names)
|
||||||
names_to_include_or_exclude.insert(wildcard_string_to_regex(name));
|
names_to_include_or_exclude.insert(wildcard_string_to_regex(name));
|
||||||
include_names_in_processing_ = false;
|
include_names_in_processing_ = false;
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ namespace IfcGeom {
|
|||||||
{
|
{
|
||||||
// Escape all non-"*?" regex special chars
|
// Escape all non-"*?" regex special chars
|
||||||
std::string special_chars = "\\^.$|()[]+/";
|
std::string special_chars = "\\^.$|()[]+/";
|
||||||
foreach(char c, special_chars) {
|
for (char c: special_chars) {
|
||||||
std::string char_str(1, c);
|
std::string char_str(1, c);
|
||||||
boost::replace_all(str, char_str, "\\" + char_str);
|
boost::replace_all(str, char_str, "\\" + char_str);
|
||||||
}
|
}
|
||||||
@@ -540,7 +540,7 @@ namespace IfcGeom {
|
|||||||
IfcSchema::IfcProduct* prod = *jt;
|
IfcSchema::IfcProduct* prod = *jt;
|
||||||
bool type_found = false;
|
bool type_found = false;
|
||||||
// The set is iterated over to able to filter on subtypes.
|
// The set is iterated over to able to filter on subtypes.
|
||||||
foreach(IfcSchema::Type::Enum type, entities_to_include_or_exclude) {
|
for (IfcSchema::Type::Enum type: entities_to_include_or_exclude) {
|
||||||
if (prod->is(type)) {
|
if (prod->is(type)) {
|
||||||
type_found = true;
|
type_found = true;
|
||||||
break;
|
break;
|
||||||
@@ -548,7 +548,7 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!type_found && traverse) {
|
if (!type_found && traverse) {
|
||||||
foreach(IfcSchema::Type::Enum type, entities_to_include_or_exclude) {
|
for (IfcSchema::Type::Enum type: entities_to_include_or_exclude) {
|
||||||
IfcSchema::IfcProduct* parent, * current = prod;
|
IfcSchema::IfcProduct* parent, * current = prod;
|
||||||
while ((parent = static_cast<IfcSchema::IfcProduct*>(kernel->get_decomposing_entity(current))) != 0) {
|
while ((parent = static_cast<IfcSchema::IfcProduct*>(kernel->get_decomposing_entity(current))) != 0) {
|
||||||
if (parent->is(type)) {
|
if (parent->is(type)) {
|
||||||
@@ -564,7 +564,7 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool name_found = false;
|
bool name_found = false;
|
||||||
foreach(const boost::regex& r, names_to_include_or_exclude) {
|
for (const boost::regex& r: names_to_include_or_exclude) {
|
||||||
if (prod->hasName() && boost::regex_match(prod->Name(), r)) {
|
if (prod->hasName() && boost::regex_match(prod->Name(), r)) {
|
||||||
name_found = true;
|
name_found = true;
|
||||||
break;
|
break;
|
||||||
@@ -572,7 +572,7 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!name_found && traverse) {
|
if (!name_found && traverse) {
|
||||||
foreach(const boost::regex& r, names_to_include_or_exclude) {
|
for (const boost::regex& r: names_to_include_or_exclude) {
|
||||||
IfcSchema::IfcProduct* parent, *current = prod;
|
IfcSchema::IfcProduct* parent, *current = prod;
|
||||||
while ((parent = static_cast<IfcSchema::IfcProduct*>(kernel->get_decomposing_entity(current))) != 0) {
|
while ((parent = static_cast<IfcSchema::IfcProduct*>(kernel->get_decomposing_entity(current))) != 0) {
|
||||||
if (parent->hasName() && boost::regex_match(parent->Name(), r)) {
|
if (parent->hasName() && boost::regex_match(parent->Name(), r)) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* *
|
* *
|
||||||
* This file is part of IfcOpenShell. *
|
* This file is part of IfcOpenShell. *
|
||||||
* *
|
* *
|
||||||
@@ -37,12 +37,19 @@ if ( it != cache.T.end() ) { e = it->second; return true; }
|
|||||||
|
|
||||||
#include "../../../ifcgeom/IfcGeom.h"
|
#include "../../../ifcgeom/IfcGeom.h"
|
||||||
|
|
||||||
typedef void* cgal_shape_t;
|
#undef Handle
|
||||||
typedef void* cgal_face_t;
|
|
||||||
typedef void* cgal_wire_t;
|
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||||
typedef void* cgal_curve_t;
|
#include <CGAL/Nef_polyhedron_3.h>
|
||||||
typedef void* cgal_placement_t;
|
|
||||||
typedef void* cgal_point_t;
|
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||||
|
|
||||||
|
typedef CGAL::Nef_polyhedron_3<Kernel> *cgal_shape_t;
|
||||||
|
typedef std::vector<Kernel::Point_3> *cgal_face_t;
|
||||||
|
typedef std::vector<Kernel::Point_3> *cgal_wire_t;
|
||||||
|
typedef std::vector<Kernel::Point_3> *cgal_curve_t;
|
||||||
|
typedef Kernel::Aff_transformation_3 *cgal_placement_t;
|
||||||
|
typedef Kernel::Point_3 *cgal_point_t;
|
||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
|
|
||||||
@@ -90,4 +97,4 @@ namespace IfcGeom {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include <boost/dynamic_bitset.hpp>
|
#include <boost/dynamic_bitset.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#define foreach BOOST_FOREACH
|
//#define foreach BOOST_FOREACH
|
||||||
#define rforeach BOOST_REVERSE_FOREACH
|
#define rforeach BOOST_REVERSE_FOREACH
|
||||||
|
|
||||||
class Argument;
|
class Argument;
|
||||||
|
|||||||
Reference in New Issue
Block a user