mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
no double/float parametrization anymore
This commit is contained in:
@@ -37,7 +37,6 @@ endforeach()
|
||||
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
|
||||
OPTION(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." ON)
|
||||
OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
|
||||
OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." ON)
|
||||
OPTION(BUILD_PACKAGE "" OFF)
|
||||
OPTION(BUILD_IFCGEOM "Build IfcGeom." ON)
|
||||
OPTION(BUILD_DOCUMENTATION "Build IfcOpenShell Documentation." OFF)
|
||||
@@ -521,10 +520,6 @@ ElSE()
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
if (IFCCONVERT_DOUBLE_PRECISION)
|
||||
SET(CONVERT_PRECISION "-DIFCCONVERT_DOUBLE_PRECISION")
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
@@ -923,7 +923,7 @@ int main(int argc, char** argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
IfcGeom::Iterator<real_t> tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
IfcGeom::Iterator<double> tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
|
||||
time_t start, end;
|
||||
time(&start);
|
||||
@@ -964,7 +964,7 @@ int main(int argc, char** argv) {
|
||||
Logger::Notice(msg.str());
|
||||
}
|
||||
|
||||
IfcGeom::Iterator<real_t> context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
IfcGeom::Iterator<double> context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
if (!context_iterator.initialize()) {
|
||||
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
|
||||
/// and for a case we found no entities that satisfy our filtering criteria.
|
||||
@@ -1077,15 +1077,15 @@ int main(int argc, char** argv) {
|
||||
|
||||
do {
|
||||
|
||||
IfcGeom::Element<real_t> *geom_object = context_iterator.get();
|
||||
IfcGeom::Element<double> *geom_object = context_iterator.get();
|
||||
|
||||
if (is_tesselated)
|
||||
{
|
||||
serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object));
|
||||
serializer->write(static_cast<const IfcGeom::TriangulationElement<double>*>(geom_object));
|
||||
}
|
||||
else
|
||||
{
|
||||
serializer->write(static_cast<const IfcGeom::BRepElement<real_t>*>(geom_object));
|
||||
serializer->write(static_cast<const IfcGeom::BRepElement<double>*>(geom_object));
|
||||
}
|
||||
|
||||
if (!no_progress) {
|
||||
|
||||
@@ -44,7 +44,7 @@ static std::string& collada_id(std::string& s)
|
||||
}
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const std::string& mesh_id,
|
||||
const std::string& suffix, const std::vector<real_t>& floats, const char* coords /* = "XYZ" */)
|
||||
const std::string& suffix, const std::vector<double>& floats, const char* coords /* = "XYZ" */)
|
||||
{
|
||||
COLLADASW::FloatSource source(mSW);
|
||||
source.setId(mesh_id + suffix);
|
||||
@@ -56,7 +56,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const
|
||||
source.getParameterNameList().push_back(std::string(1, coords[i]));
|
||||
}
|
||||
source.prepareToAppendValues();
|
||||
for (std::vector<real_t>::const_iterator it = floats.begin(); it != floats.end(); ++it) {
|
||||
for (std::vector<double>::const_iterator it = floats.begin(); it != floats.end(); ++it) {
|
||||
source.appendValues(*it);
|
||||
}
|
||||
source.finish();
|
||||
@@ -64,10 +64,10 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaGeometries::write(
|
||||
const std::string &mesh_id, const std::string &/**<@todo 'default_material_name' unused, remove? */,
|
||||
const std::vector<real_t>& positions, const std::vector<real_t>& normals,
|
||||
const std::vector<double>& positions, const std::vector<double>& normals,
|
||||
const std::vector<int>& faces, const std::vector<int>& edges,
|
||||
const std::vector<int>& material_ids, const std::vector<IfcGeom::Material>& /**<@todo 'materials' unused, remove? */,
|
||||
const std::vector<real_t>& uvs, const std::vector<std::string>& material_references)
|
||||
const std::vector<double>& uvs, const std::vector<std::string>& material_references)
|
||||
{
|
||||
openMesh(mesh_id);
|
||||
|
||||
@@ -179,7 +179,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::close() {
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
const std::string& node_id, const std::string& node_name, const std::string& geom_name,
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<real_t>& transformation)
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<double>& transformation)
|
||||
{
|
||||
if (!scene_opened) {
|
||||
openVisualScene(scene_id);
|
||||
@@ -194,17 +194,17 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
// The matrix attribute of an entity is basically a 4x3 representation of its ObjectPlacement.
|
||||
// Note that this placement is absolute, ie it is multiplied with all parent placements.
|
||||
|
||||
IfcGeom::Transformation<real_t>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<real_t>* transformation_towrite = &transformation;
|
||||
IfcGeom::Transformation<double>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<double>* transformation_towrite = &transformation;
|
||||
|
||||
// If this is not the first parent, get the relative placement
|
||||
if (parentNodes.size() > 0)
|
||||
{
|
||||
relative_trsf = new IfcGeom::Transformation<real_t>(matrixStack.top().multiplied(transformation));
|
||||
relative_trsf = new IfcGeom::Transformation<double>(matrixStack.top().multiplied(transformation));
|
||||
transformation_towrite = relative_trsf;
|
||||
}
|
||||
|
||||
const std::vector<real_t>& posmatrix = transformation_towrite->matrix().data();
|
||||
const std::vector<double>& posmatrix = transformation_towrite->matrix().data();
|
||||
|
||||
double matrix_array[4][4] = {
|
||||
{ (double)posmatrix[0], (double)posmatrix[3], (double)posmatrix[6], (double)posmatrix[9] },
|
||||
@@ -231,26 +231,26 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
node.end();
|
||||
}
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element<real_t>& parent){
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element<double>& parent){
|
||||
//we open the visual scene tag if it's not.
|
||||
if (!scene_opened) {
|
||||
openVisualScene(scene_id);
|
||||
scene_opened = true;
|
||||
}
|
||||
|
||||
const IfcGeom::Transformation<real_t>& parent_trsf = parent.transformation();
|
||||
const IfcGeom::Transformation<double>& parent_trsf = parent.transformation();
|
||||
|
||||
IfcGeom::Transformation<real_t>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<real_t>* transformation_towrite = &parent_trsf;
|
||||
IfcGeom::Transformation<double>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<double>* transformation_towrite = &parent_trsf;
|
||||
|
||||
// If this is not the first parent, get the relative placement
|
||||
if (parentNodes.size() > 0)
|
||||
{
|
||||
relative_trsf = new IfcGeom::Transformation<real_t>(matrixStack.top().multiplied(parent_trsf));
|
||||
relative_trsf = new IfcGeom::Transformation<double>(matrixStack.top().multiplied(parent_trsf));
|
||||
transformation_towrite = relative_trsf;
|
||||
}
|
||||
|
||||
const std::vector<real_t>& parentMatrix = transformation_towrite->matrix().data();
|
||||
const std::vector<double>& parentMatrix = transformation_towrite->matrix().data();
|
||||
|
||||
double matrix_array[4][4] = {
|
||||
{ (double)parentMatrix[0], (double)parentMatrix[3], (double)parentMatrix[6], (double)parentMatrix[9] },
|
||||
@@ -390,9 +390,9 @@ void ColladaSerializer::ColladaExporter::startDocument(const std::string& unit_n
|
||||
asset.add();
|
||||
}
|
||||
|
||||
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement<real_t>* o)
|
||||
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement<double>* o)
|
||||
{
|
||||
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = o->geometry();
|
||||
|
||||
std::string name = serializer->object_id(o);
|
||||
collada_id(name);
|
||||
@@ -451,7 +451,7 @@ std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEnti
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ColladaSerializer::object_id(const IfcGeom::Element<real_t>* o) /*override*/
|
||||
std::string ColladaSerializer::object_id(const IfcGeom::Element<double>* o) /*override*/
|
||||
{
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_TYPES)) {
|
||||
const std::string slabSuffix = (o->product() && o->product()->declaration().name() == "IfcSlab")
|
||||
@@ -544,7 +544,7 @@ void ColladaSerializer::writeHeader() {
|
||||
exporter.startDocument(unit_name, unit_magnitude);
|
||||
}
|
||||
|
||||
void ColladaSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
|
||||
void ColladaSerializer::write(const IfcGeom::TriangulationElement<double>* o) {
|
||||
exporter.write(o);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ private:
|
||||
, serializer(_serializer)
|
||||
{}
|
||||
void addFloatSource(const std::string& mesh_id, const std::string& suffix,
|
||||
const std::vector<real_t>& floats, const char* coords = "XYZ");
|
||||
const std::vector<double>& floats, const char* coords = "XYZ");
|
||||
/// @todo pass simply DeferredObject?
|
||||
void write(
|
||||
const std::string &mesh_id, const std::string &default_material_name,
|
||||
const std::vector<real_t>& positions, const std::vector<real_t>& normals,
|
||||
const std::vector<double>& positions, const std::vector<double>& normals,
|
||||
const std::vector<int>& faces, const std::vector<int>& edges,
|
||||
const std::vector<int>& material_ids, const std::vector<IfcGeom::Material>& materials,
|
||||
const std::vector<real_t>& uvs, const std::vector<std::string>& material_references);
|
||||
const std::vector<double>& uvs, const std::vector<std::string>& material_references);
|
||||
void close();
|
||||
ColladaSerializer *serializer;
|
||||
};
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
const std::string scene_id;
|
||||
bool scene_opened;
|
||||
std::stack<COLLADASW::Node*> parentNodes;
|
||||
std::stack<IfcGeom::Transformation<real_t> > matrixStack;
|
||||
std::stack<IfcGeom::Transformation<double> > matrixStack;
|
||||
public:
|
||||
ColladaScene(const std::string& scene_id, COLLADASW::StreamWriter& stream, ColladaSerializer *_serializer)
|
||||
: COLLADASW::LibraryVisualScenes(&stream)
|
||||
@@ -97,8 +97,8 @@ private:
|
||||
, serializer(_serializer)
|
||||
{}
|
||||
void add(const std::string& node_id, const std::string& node_name, const std::string& geom_name,
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<real_t>& matrix);
|
||||
void addParent(const IfcGeom::Element<real_t>& parent);
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<double>& matrix);
|
||||
void addParent(const IfcGeom::Element<double>& parent);
|
||||
void closeParent();
|
||||
COLLADASW::Node* GetDirectParent();
|
||||
void write();
|
||||
@@ -158,21 +158,21 @@ private:
|
||||
|
||||
public:
|
||||
std::string unique_id, representation_id, type;
|
||||
IfcGeom::Transformation<real_t> transformation;
|
||||
std::vector<real_t> vertices;
|
||||
std::vector<real_t> normals;
|
||||
IfcGeom::Transformation<double> transformation;
|
||||
std::vector<double> vertices;
|
||||
std::vector<double> normals;
|
||||
std::vector<int> faces;
|
||||
std::vector<int> edges;
|
||||
std::vector<int> material_ids;
|
||||
std::vector<IfcGeom::Material> materials;
|
||||
std::vector<std::string> material_references;
|
||||
std::vector<real_t> uvs;
|
||||
std::vector<const IfcGeom::Element<real_t>*> parents_;
|
||||
std::vector<double> uvs;
|
||||
std::vector<const IfcGeom::Element<double>*> parents_;
|
||||
|
||||
DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation<real_t>& transformation,
|
||||
const std::vector<real_t>& vertices, const std::vector<real_t>& normals, const std::vector<int>& faces,
|
||||
DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation<double>& transformation,
|
||||
const std::vector<double>& vertices, const std::vector<double>& normals, const std::vector<int>& faces,
|
||||
const std::vector<int>& edges, const std::vector<int>& material_ids, const std::vector<IfcGeom::Material>& materials,
|
||||
const std::vector<std::string>& material_references, const std::vector<real_t>& uvs)
|
||||
const std::vector<std::string>& material_references, const std::vector<double>& uvs)
|
||||
: unique_id(unique_id)
|
||||
, representation_id(representation_id)
|
||||
, type(type)
|
||||
@@ -187,8 +187,8 @@ private:
|
||||
, uvs(uvs)
|
||||
{}
|
||||
|
||||
std::vector<const IfcGeom::Element<real_t>*>& parents() { return parents_; }
|
||||
const std::vector<const IfcGeom::Element<real_t>*>& parents() const { return parents_; }
|
||||
std::vector<const IfcGeom::Element<double>*>& parents() { return parents_; }
|
||||
const std::vector<const IfcGeom::Element<double>*>& parents() const { return parents_; }
|
||||
};
|
||||
COLLADABU::NativeString filename;
|
||||
COLLADASW::StreamWriter stream;
|
||||
@@ -211,7 +211,7 @@ private:
|
||||
std::vector<DeferredObject> deferreds;
|
||||
virtual ~ColladaExporter() {}
|
||||
void startDocument(const std::string& unit_name, float unit_magnitude);
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void endDocument();
|
||||
};
|
||||
ColladaExporter exporter;
|
||||
@@ -229,8 +229,8 @@ public:
|
||||
}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
void write(const IfcGeom::BRepElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void finalize();
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
void setFile(IfcParse::IfcFile*) {}
|
||||
|
||||
std::string object_id(const IfcGeom::Element<real_t>* o) /*override*/;
|
||||
std::string object_id(const IfcGeom::Element<double>* o) /*override*/;
|
||||
|
||||
private:
|
||||
static std::string differentiateSlabTypes(const IfcUtil::IfcBaseEntity* slab);
|
||||
|
||||
@@ -20,12 +20,6 @@
|
||||
#ifndef GEOMETRYSERIALIZER_H
|
||||
#define GEOMETRYSERIALIZER_H
|
||||
|
||||
#ifdef IFCCONVERT_DOUBLE_PRECISION
|
||||
typedef double real_t;
|
||||
#else
|
||||
typedef float real_t;
|
||||
#endif
|
||||
|
||||
#include "../serializers/Serializer.h"
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
#include "../ifcgeom/IfcGeomElement.h"
|
||||
@@ -76,15 +70,15 @@ public:
|
||||
virtual ~GeometrySerializer() {}
|
||||
|
||||
virtual bool isTesselated() const = 0;
|
||||
virtual void write(const IfcGeom::TriangulationElement<real_t>* o) = 0;
|
||||
virtual void write(const IfcGeom::BRepElement<real_t>* o) = 0;
|
||||
virtual void write(const IfcGeom::TriangulationElement<double>* o) = 0;
|
||||
virtual void write(const IfcGeom::BRepElement<double>* o) = 0;
|
||||
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0;
|
||||
|
||||
const SerializerSettings& settings() const { return settings_; }
|
||||
SerializerSettings& settings() { return settings_; }
|
||||
|
||||
/// Returns ID for the object depending on the used setting.
|
||||
virtual std::string object_id(const IfcGeom::Element<real_t>* o)
|
||||
virtual std::string object_id(const IfcGeom::Element<double>* o)
|
||||
{
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_GUIDS)) return o->guid();
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_NAMES)) return o->name();
|
||||
|
||||
@@ -157,7 +157,7 @@ size_t write_accessor(json& j, std::ofstream& ofs, It begin, It end) {
|
||||
return j["accessors"].size() - 1;
|
||||
}
|
||||
|
||||
void GltfSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
|
||||
void GltfSerializer::write(const IfcGeom::TriangulationElement<double>* o) {
|
||||
if (o->geometry().material_ids().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
virtual ~GltfSerializer();
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
void write(const IfcGeom::BRepElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void finalize();
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
@@ -54,7 +54,7 @@ void HdfSerializer::writeHeader() {
|
||||
}
|
||||
|
||||
|
||||
void HdfSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
||||
void HdfSerializer::write(const IfcGeom::BRepElement<double>* o) {
|
||||
|
||||
std::string guid = o->guid();
|
||||
|
||||
@@ -72,8 +72,8 @@ void HdfSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
||||
const IfcGeom::Representation::Serialization serialization(brepmesh);
|
||||
std::string brep_data = serialization.brep_data();
|
||||
|
||||
const IfcGeom::TriangulationElement<real_t>triangular_element(*o);
|
||||
const IfcGeom::Representation::Triangulation<real_t>& mesh = triangular_element.geometry();
|
||||
const IfcGeom::TriangulationElement<double>triangular_element(*o);
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = triangular_element.geometry();
|
||||
const int vcount = (int)mesh.verts().size() / 3;
|
||||
const int fcount = (int)mesh.faces().size() / 3;
|
||||
const bool isyup = settings().get(SerializerSettings::USE_Y_UP);
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
virtual ~HdfSerializer() {}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::BRepElement<real_t>* o);
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void finalize() {}
|
||||
bool isTesselated() const { return false; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ bool OpenCascadeBasedSerializer::ready() {
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
||||
void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement<double>* o) {
|
||||
TopoDS_Shape compound = o->geometry().as_compound();
|
||||
gp_Trsf trsf = o->transformation().data();
|
||||
const IfcGeom::ElementSettings& settings = o->geometry().settings();
|
||||
|
||||
@@ -39,8 +39,8 @@ public:
|
||||
void writeHeader() {}
|
||||
bool ready();
|
||||
virtual void writeShape(const std::string& name, const TopoDS_Shape& shape) = 0;
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<real_t>* o);
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
bool isTesselated() const { return false; }
|
||||
void setFile(IfcParse::IfcFile*) {}
|
||||
};
|
||||
|
||||
@@ -339,7 +339,7 @@ SvgSerializer::path_object& SvgSerializer::start_path(const gp_Pln& pln, const s
|
||||
}
|
||||
|
||||
namespace {
|
||||
boost::optional<std::pair<IfcUtil::IfcBaseEntity*, double>> storey_elevation_from_element(const IfcGeom::BRepElement<real_t>* o) {
|
||||
boost::optional<std::pair<IfcUtil::IfcBaseEntity*, double>> storey_elevation_from_element(const IfcGeom::BRepElement<double>* o) {
|
||||
for (const auto& p : o->parents()) {
|
||||
if (p->type() == "IfcBuildingStorey") {
|
||||
try {
|
||||
@@ -503,7 +503,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* brep_obj) {
|
||||
void SvgSerializer::write(const IfcGeom::BRepElement<double>* brep_obj) {
|
||||
|
||||
boost::optional<std::string> object_type;
|
||||
if (!brep_obj->product()->get("ObjectType")->isNull()) {
|
||||
@@ -2052,7 +2052,7 @@ return oss.str();
|
||||
}
|
||||
}
|
||||
|
||||
std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<real_t>* elem) {
|
||||
std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* elem) {
|
||||
auto n = elem->name();
|
||||
IfcUtil::escape_xml(n);
|
||||
|
||||
@@ -2178,7 +2178,7 @@ namespace {
|
||||
std::string SvgSerializer::writeMetadata(const drawing_meta& m) {
|
||||
gp_Trsf trsf;
|
||||
trsf.SetTransformation(m.pln_3d.Position(), gp::XOY());
|
||||
auto m43 = IfcGeom::Matrix<real_t>(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data();
|
||||
auto m43 = IfcGeom::Matrix<double>(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data();
|
||||
std::array<std::array<double, 4>, 4> m4 = {{
|
||||
{{ (double)m43[0], (double)m43[3], (double)m43[6], (double)m43[9] }},
|
||||
{{ (double)m43[1], (double)m43[4], (double)m43[7], (double)m43[10] }},
|
||||
|
||||
@@ -215,8 +215,8 @@ public:
|
||||
void writeHeader();
|
||||
void doWriteHeader();
|
||||
bool ready();
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<real_t>* o);
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
void write(path_object& p, const TopoDS_Wire& wire, boost::optional<std::vector<double>> dash_array=boost::none);
|
||||
void write(const geometry_data& data);
|
||||
path_object& start_path(const gp_Pln& p, IfcUtil::IfcBaseEntity* storey, const std::string& id);
|
||||
@@ -279,10 +279,10 @@ public:
|
||||
void setDrawingCenter(double x, double y) {
|
||||
center_x_ = x; center_y_ = y;
|
||||
}
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<real_t>* elem);
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* elem);
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* elem);
|
||||
std::string idElement(const IfcUtil::IfcBaseEntity* elem);
|
||||
std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<real_t>* o) {
|
||||
std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* o) {
|
||||
if (storey) {
|
||||
return idElement(storey) + "-" + GeometrySerializer::object_id(o);
|
||||
} else {
|
||||
|
||||
@@ -84,19 +84,19 @@ void WaveFrontOBJSerializer::writeMaterial(const IfcGeom::Material& style)
|
||||
}
|
||||
}
|
||||
|
||||
void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<real_t>* o)
|
||||
void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<double>* o)
|
||||
{
|
||||
obj_stream << "g " << object_id(o) << "\n";
|
||||
obj_stream << "s 1" << "\n";
|
||||
const bool isyup = settings().get(SerializerSettings::USE_Y_UP);
|
||||
|
||||
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = o->geometry();
|
||||
|
||||
const int vcount = (int)mesh.verts().size() / 3;
|
||||
for ( std::vector<real_t>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end(); ) {
|
||||
const real_t x = *(it++);
|
||||
const real_t y = *(it++);
|
||||
const real_t z = *(it++);
|
||||
for ( std::vector<double>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end(); ) {
|
||||
const double x = *(it++);
|
||||
const double y = *(it++);
|
||||
const double z = *(it++);
|
||||
|
||||
if (isyup) {
|
||||
obj_stream << "v " << x << " " << z << " " << -y << "\n";
|
||||
@@ -105,16 +105,16 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<real_t>*
|
||||
}
|
||||
}
|
||||
|
||||
for ( std::vector<real_t>::const_iterator it = mesh.normals().begin(); it != mesh.normals().end(); ) {
|
||||
const real_t x = *(it++);
|
||||
const real_t y = *(it++);
|
||||
const real_t z = *(it++);
|
||||
for ( std::vector<double>::const_iterator it = mesh.normals().begin(); it != mesh.normals().end(); ) {
|
||||
const double x = *(it++);
|
||||
const double y = *(it++);
|
||||
const double z = *(it++);
|
||||
obj_stream << "vn " << x << " " << y << " " << z << "\n";
|
||||
}
|
||||
|
||||
for (std::vector<real_t>::const_iterator it = mesh.uvs().begin(); it != mesh.uvs().end();) {
|
||||
const real_t u = *it++;
|
||||
const real_t v = *it++;
|
||||
for (std::vector<double>::const_iterator it = mesh.uvs().begin(); it != mesh.uvs().end();) {
|
||||
const double u = *it++;
|
||||
const double v = *it++;
|
||||
obj_stream << "vt " << u << " " << v << "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void writeMaterial(const IfcGeom::Material& style);
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
void write(const IfcGeom::BRepElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void finalize() {}
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
Reference in New Issue
Block a user