Merge pull request #9 from Tridify/windows_build_scripts

Windows & Visual Studio build scripts continued
This commit is contained in:
Thomas Krijnen
2015-12-01 14:27:34 +01:00
42 changed files with 402 additions and 289 deletions
+2
View File
@@ -3,3 +3,5 @@
/build*/ /build*/
/install*/ /install*/
/win/BuildDepsCache*.txt /win/BuildDepsCache*.txt
/src/ifcexpressparser/__pycache__
/src/ifcexpressparser/express_parser.py
+8 -6
View File
@@ -14,7 +14,7 @@ Prerequisites
Dependencies Dependencies
============ ============
* [Boost](http://www.boost.org/) * [Boost](http://www.boost.org/)
* Open Cascade *optional*, but required for building IfcGeom) * Open Cascade *optional*, but required for building IfcGeom
[Official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce) [Official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce)
For converting IFC representation items into BRep solids and tesselated meshes For converting IFC representation items into BRep solids and tesselated meshes
* [ICU](http://site.icu-project.org/) *optional* * [ICU](http://site.icu-project.org/) *optional*
@@ -34,14 +34,16 @@ the cmake/ folder.
The preferred way to fetch and build this project's dependencies is to use the build scripts The preferred way to fetch and build this project's dependencies is to use the build scripts
in win/ folder. See [win/readme.md] for more information. Instructions in a nutshell in win/ folder. See [win/readme.md] for more information. Instructions in a nutshell
(assuming Visual Studio x64 environment variables set): (**assuming Visual Studio 2015 x64 environment variables set**):
> git clone https://github.com/IfcOpenShell/IfcOpenShell.git > git clone https://github.com/IfcOpenShell/IfcOpenShell.git
> cd oce\win > cd oce\win
> build-deps.cmd (defaults to using VS 2015 x64 RelWithDebInfo build) > build-deps.cmd (defaults to RelWithDebInfo build)
> run-cmake.bat (defaults to using VS 2015 x64) > run-cmake.bat
> ..\build-vs2015-x64\IfcOpenShell.sln > ..\build-vs2015-x64\IfcOpenShell.sln
You can now build the solution using the RelWithDebInfo configuration (freshly created solution by CMake defaults to Debug).
Build the INSTALL project to deploy the headers and binaries into a single location if wanted/needed. You can now build the solution using the `RelWithDebInfo` configuration (freshly created solution by CMake defaults to `Debug`).
Build the `INSTALL` project to deploy the headers and binaries into a single location if wanted/needed.
Alternatively, the old Visual Studio solution and project files requiring manual work can Alternatively, the old Visual Studio solution and project files requiring manual work can
be found from the win/sln folder. be found from the win/sln folder.
+10 -3
View File
@@ -25,7 +25,7 @@ OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)."
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON) OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF) OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
#TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF) #TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF)
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3" OFF) OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3 (full rebuild recommended when switching this)" OFF)
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON) OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
OPTION(BUILD_EXAMPLES "Build example applications." ON) OPTION(BUILD_EXAMPLES "Build example applications." ON)
# TODO QtViewer is deprecated ATM as it uses the 0.4 API # TODO QtViewer is deprecated ATM as it uses the 0.4 API
@@ -217,10 +217,17 @@ if(ENABLE_BUILD_OPTIMIZATIONS)
endif() endif()
IF(MSVC) IF(MSVC)
# Enforce Unicode for CRT and Win32 API calls
ADD_DEFINITIONS(-D_UNICODE -DUNICODE)
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers. # Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
ADD_DEFINITIONS(-D_UNICODE -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx ADD_DEFINITIONS(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx
# Bump up the warning level from the default 3 to 4.
ADD_DEFINITIONS(-W4)
IF(MSVC_VERSION GREATER 1800) # > 2013
# Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now.
ADD_DEFINITIONS(-wd4458)
ENDIF()
# Link against the static VC runtime # Link against the static VC runtime
FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+1 -1
View File
@@ -50,7 +50,7 @@ boost::none_t const null = boost::none;
// The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron // The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron
void createGroundShape(TopoDS_Shape& shape); void createGroundShape(TopoDS_Shape& shape);
int main(int argc, char** argv) { int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
// convenience functions for working with geometry in IFC files. // convenience functions for working with geometry in IFC files.
+1 -1
View File
@@ -128,7 +128,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::write(const std::str
lines.setMaterial(materials[it->first].name()); lines.setMaterial(materials[it->first].name());
lines.setCount((unsigned long)it->second.size()); lines.setCount((unsigned long)it->second.size());
int offset = 0; int offset = 0;
lines.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::VERTEX, "#" + mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, 0)); lines.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::VERTEX, "#" + mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++));
lines.prepareToAppendValues(); lines.prepareToAppendValues();
lines.appendValues(it->second); lines.appendValues(it->second);
lines.finish(); lines.finish();
+18 -1
View File
@@ -22,6 +22,10 @@
#ifndef COLLADASERIALIZER_H #ifndef COLLADASERIALIZER_H
#define COLLADASERIALIZER_H #define COLLADASERIALIZER_H
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4201 4512)
#endif
#include <COLLADASWStreamWriter.h> #include <COLLADASWStreamWriter.h>
#include <COLLADASWPrimitves.h> #include <COLLADASWPrimitves.h>
#include <COLLADASWLibraryGeometries.h> #include <COLLADASWLibraryGeometries.h>
@@ -34,6 +38,9 @@
#include <COLLADASWLibraryMaterials.h> #include <COLLADASWLibraryMaterials.h>
#include <COLLADASWBaseInputElement.h> #include <COLLADASWBaseInputElement.h>
#include <COLLADASWAsset.h> #include <COLLADASWAsset.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "../ifcgeom/IfcGeomIterator.h" #include "../ifcgeom/IfcGeomIterator.h"
@@ -41,12 +48,15 @@
class ColladaSerializer : public GeometrySerializer class ColladaSerializer : public GeometrySerializer
{ {
// TODO The vast amount of implement details of ColladaSerializer could be hidden to the cpp file.
private: private:
class ColladaExporter class ColladaExporter
{ {
private: private:
class ColladaGeometries : public COLLADASW::LibraryGeometries class ColladaGeometries : public COLLADASW::LibraryGeometries
{ {
ColladaGeometries(const ColladaGeometries&); //N/A
ColladaGeometries& operator =(const ColladaGeometries&); //N/A
public: public:
explicit ColladaGeometries(COLLADASW::StreamWriter& stream) explicit ColladaGeometries(COLLADASW::StreamWriter& stream)
: COLLADASW::LibraryGeometries(&stream) : COLLADASW::LibraryGeometries(&stream)
@@ -58,6 +68,9 @@ private:
class ColladaScene : public COLLADASW::LibraryVisualScenes class ColladaScene : public COLLADASW::LibraryVisualScenes
{ {
private: private:
ColladaScene(const ColladaScene&); //N/A
ColladaScene& operator =(const ColladaScene&); //N/A
const std::string scene_id; const std::string scene_id;
bool scene_opened; bool scene_opened;
public: public:
@@ -71,9 +84,13 @@ private:
}; };
class ColladaMaterials : public COLLADASW::LibraryMaterials class ColladaMaterials : public COLLADASW::LibraryMaterials
{ {
ColladaMaterials(const ColladaMaterials&); //N/A
ColladaMaterials& operator =(const ColladaMaterials&); //N/A
private: private:
class ColladaEffects : public COLLADASW::LibraryEffects class ColladaEffects : public COLLADASW::LibraryEffects
{ {
ColladaEffects(const ColladaEffects&); //N/A
ColladaEffects& operator =(const ColladaEffects&); //N/A
public: public:
explicit ColladaEffects(COLLADASW::StreamWriter& stream) explicit ColladaEffects(COLLADASW::StreamWriter& stream)
: COLLADASW::LibraryEffects(&stream) : COLLADASW::LibraryEffects(&stream)
@@ -148,7 +165,7 @@ public:
bool ready(); bool ready();
void writeHeader(); void writeHeader();
void write(const IfcGeom::TriangulationElement<double>* o); void write(const IfcGeom::TriangulationElement<double>* o);
void write(const IfcGeom::BRepElement<double>* o) {} void write(const IfcGeom::BRepElement<double>* /*o*/) {}
void finalize(); void finalize();
bool isTesselated() const { return true; } bool isTesselated() const { return true; }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) { void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
+4 -6
View File
@@ -42,6 +42,8 @@
#include "../ifcconvert/XmlSerializer.h" #include "../ifcconvert/XmlSerializer.h"
#include "../ifcconvert/SvgSerializer.h" #include "../ifcconvert/SvgSerializer.h"
#include <IGESControl_Controller.hxx>
static std::string DEFAULT_EXTENSION = "obj"; static std::string DEFAULT_EXTENSION = "obj";
void printVersion() { void printVersion() {
@@ -198,9 +200,7 @@ int main(int argc, char** argv) {
std::set<std::string> entities; std::set<std::string> entities;
for (std::vector<std::string>::const_iterator it = entity_vector.begin(); it != entity_vector.end(); ++it) { for (std::vector<std::string>::const_iterator it = entity_vector.begin(); it != entity_vector.end(); ++it) {
std::string lowercase_type = *it; std::string lowercase_type = *it;
for (std::string::iterator c = lowercase_type.begin(); c != lowercase_type.end(); ++c) { std::transform(lowercase_type.begin(), lowercase_type.end(), lowercase_type.begin(), ::tolower);
*c = tolower(*c);
}
entities.insert(lowercase_type); entities.insert(lowercase_type);
} }
@@ -217,9 +217,7 @@ int main(int argc, char** argv) {
} }
std::string output_extension = output_filename.substr(output_filename.size()-4); std::string output_extension = output_filename.substr(output_filename.size()-4);
for (std::string::iterator c = output_extension.begin(); c != output_extension.end(); ++c) { std::transform(output_extension.begin(), output_extension.end(), output_extension.begin(), ::tolower);
*c = tolower(*c);
}
// If no entities are specified these are the defaults to skip from output // If no entities are specified these are the defaults to skip from output
if (entity_vector.empty()) { if (entity_vector.empty()) {
+1 -2
View File
@@ -20,7 +20,6 @@
#ifndef IGESSERIALIZER_H #ifndef IGESSERIALIZER_H
#define IGESSERIALIZER_H #define IGESSERIALIZER_H
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx> #include <IGESControl_Writer.hxx>
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
@@ -43,7 +42,7 @@ public:
void finalize() { void finalize() {
writer.Write(out_filename.c_str()); writer.Write(out_filename.c_str());
} }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) { void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) {
const char* symbol = getSymbolForUnitMagnitude(magnitude); const char* symbol = getSymbolForUnitMagnitude(magnitude);
if (symbol) { if (symbol) {
Interface_Static::SetCVal("write.iges.unit", symbol); Interface_Static::SetCVal("write.iges.unit", symbol);
+4 -3
View File
@@ -25,8 +25,10 @@
#include "../ifcconvert/GeometrySerializer.h" #include "../ifcconvert/GeometrySerializer.h"
class OpenCascadeBasedSerializer : public GeometrySerializer { class OpenCascadeBasedSerializer : public GeometrySerializer {
OpenCascadeBasedSerializer(const OpenCascadeBasedSerializer&); //N/A
OpenCascadeBasedSerializer& operator =(const OpenCascadeBasedSerializer&); //N/A
protected: protected:
const std::string& out_filename; const std::string out_filename;
const char* getSymbolForUnitMagnitude(float mag); const char* getSymbolForUnitMagnitude(float mag);
public: public:
explicit OpenCascadeBasedSerializer(const std::string& out_filename) explicit OpenCascadeBasedSerializer(const std::string& out_filename)
@@ -35,10 +37,9 @@ public:
{} {}
virtual ~OpenCascadeBasedSerializer() {} virtual ~OpenCascadeBasedSerializer() {}
void writeHeader() {} void writeHeader() {}
void writeMaterial(const IfcGeom::SurfaceStyle& style) {}
bool ready(); bool ready();
virtual void writeShape(const TopoDS_Shape& shape) = 0; virtual void writeShape(const TopoDS_Shape& shape) = 0;
void write(const IfcGeom::TriangulationElement<double>* o) {} void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
void write(const IfcGeom::BRepElement<double>* o); void write(const IfcGeom::BRepElement<double>* o);
bool isTesselated() const { return false; } bool isTesselated() const { return false; }
void setFile(IfcParse::IfcFile*) {} void setFile(IfcParse::IfcFile*) {}
+1 -2
View File
@@ -20,7 +20,6 @@
#ifndef STEPSERIALIZER_H #ifndef STEPSERIALIZER_H
#define STEPSERIALIZER_H #define STEPSERIALIZER_H
#include <STEPControl_Controller.hxx>
#include <STEPControl_Writer.hxx> #include <STEPControl_Writer.hxx>
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
@@ -49,7 +48,7 @@ public:
writer.Write(out_filename.c_str()); writer.Write(out_filename.c_str());
std::cout.rdbuf(sb); std::cout.rdbuf(sb);
} }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) { void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) {
const char* symbol = getSymbolForUnitMagnitude(magnitude); const char* symbol = getSymbolForUnitMagnitude(magnitude);
if (symbol) { if (symbol) {
Interface_Static::SetCVal("write.step.unit", symbol); Interface_Static::SetCVal("write.step.unit", symbol);
+1 -1
View File
@@ -178,7 +178,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement<double>* o) {
typedef IfcSchema::IfcRelAggregates decomposition_element; typedef IfcSchema::IfcRelAggregates decomposition_element;
#endif #endif
while (true) { for (;;) {
// Iterate over the decomposing element to find the parent IfcBuildingStorey // Iterate over the decomposing element to find the parent IfcBuildingStorey
decomposition_element::list::ptr decomposes = obdef->Decomposes(); decomposition_element::list::ptr decomposes = obdef->Decomposes();
if (!decomposes->size()) { if (!decomposes->size()) {
+2 -4
View File
@@ -35,7 +35,6 @@ class SvgSerializer : public GeometrySerializer {
public: public:
typedef std::pair<std::string, std::vector<util::string_buffer> > path_object; typedef std::pair<std::string, std::vector<util::string_buffer> > path_object;
protected: protected:
const char* getSymbolForUnitMagnitude(float mag);
std::ofstream svg_file; std::ofstream svg_file;
double xmin, ymin, xmax, ymax, width, height; double xmin, ymin, xmax, ymax, width, height;
boost::optional<double> section_height; boost::optional<double> section_height;
@@ -62,15 +61,14 @@ public:
virtual void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; } virtual void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; }
virtual ~SvgSerializer() {} virtual ~SvgSerializer() {}
virtual void writeHeader(); virtual void writeHeader();
virtual void writeMaterial(const IfcGeom::SurfaceStyle& style) {}
virtual bool ready(); virtual bool ready();
virtual void write(const IfcGeom::TriangulationElement<double>* o) {} virtual void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
virtual void write(const IfcGeom::BRepElement<double>* o); virtual void write(const IfcGeom::BRepElement<double>* o);
virtual void write(path_object& p, const TopoDS_Wire& wire); virtual void write(path_object& p, const TopoDS_Wire& wire);
virtual path_object& start_path(IfcSchema::IfcBuildingStorey* storey, const std::string& id); virtual path_object& start_path(IfcSchema::IfcBuildingStorey* storey, const std::string& id);
virtual bool isTesselated() const { return false; } virtual bool isTesselated() const { return false; }
virtual void finalize(); virtual void finalize();
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) {} virtual void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
virtual void setFile(IfcParse::IfcFile* f) { file = f; } virtual void setFile(IfcParse::IfcFile* f) { file = f; }
virtual void setBoundingRectangle(double width, double height); virtual void setBoundingRectangle(double width, double height);
virtual void setSectionHeight(double h) { section_height = h; } virtual void setSectionHeight(double h) { section_height = h; }
+2 -2
View File
@@ -46,10 +46,10 @@ public:
void writeHeader(); void writeHeader();
void writeMaterial(const IfcGeom::Material& style); void writeMaterial(const IfcGeom::Material& style);
void write(const IfcGeom::TriangulationElement<double>* o); void write(const IfcGeom::TriangulationElement<double>* o);
void write(const IfcGeom::BRepElement<double>* o) {} void write(const IfcGeom::BRepElement<double>* /*o*/) {}
void finalize() {} void finalize() {}
bool isTesselated() const { return true; } bool isTesselated() const { return true; }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {} void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
void setFile(IfcParse::IfcFile*) {} void setFile(IfcParse::IfcFile*) {}
}; };
+23 -1
View File
@@ -1,3 +1,22 @@
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
* IfcOpenShell is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as published by *
* the Free Software Foundation, either version 3.0 of the License, or *
* (at your option) any later version. *
* *
* IfcOpenShell is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the Lesser GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
#include <map> #include <map>
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
@@ -7,6 +26,8 @@
#include "XmlSerializer.h" #include "XmlSerializer.h"
#include <algorithm>
using boost::property_tree::ptree; using boost::property_tree::ptree;
using namespace IfcSchema; using namespace IfcSchema;
@@ -58,7 +79,8 @@ boost::optional<std::string> format_attribute(const Argument* argument, IfcUtil:
unit_name = unit->Name(); unit_name = unit->Name();
} }
for (std::string::iterator c = unit_name.begin(); c != unit_name.end(); ++c) *c = tolower(*c); // TODO add toLower() and toUpper() string helper functions for the project
std::transform(unit_name.begin(), unit_name.end(), unit_name.begin(), ::tolower);
value = unit_name; value = unit_name;
} }
+3 -1
View File
@@ -4,6 +4,8 @@ the IFC schema and will most likely fail on any other Express schema.
The code can be invoked in the following way and results in two header files The code can be invoked in the following way and results in two header files
and a single implementation file named according to the schema name in the and a single implementation file named according to the schema name in the
Express file. A python 3 interpreter with the pyparsing library is required. Express file. A python 3 interpreter with the pyparsing [1] library is required.
$ python bootstrap.py express.bnf > express_parser.py && python express_parser.py IFC2X3_TC1.exp $ python bootstrap.py express.bnf > express_parser.py && python express_parser.py IFC2X3_TC1.exp
[1] http://pyparsing.wikispaces.com/Download+and+Installation
+35 -25
View File
@@ -23,7 +23,6 @@ header = """
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@@ -31,6 +30,11 @@ header = """
#include "../ifcparse/IfcException.h" #include "../ifcparse/IfcException.h"
#include "../ifcparse/%(schema_name)senum.h" #include "../ifcparse/%(schema_name)senum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema %(schema_name)s #define IfcSchema %(schema_name)s
namespace %(schema_name)s { namespace %(schema_name)s {
@@ -47,6 +51,10 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0); IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif #endif
""" """
@@ -107,6 +115,8 @@ implementation= """
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h" #include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace %(schema_name)s; using namespace %(schema_name)s;
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
@@ -261,49 +271,49 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
} }
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) { std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
while (true) { for(;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
jt = it->second.find(a); jt = it->second.find(a);
if (jt != it->second.end()) { if (jt != it->second.end()) {
return jt->second; return jt->second;
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
throw IfcException("Attribute not found"); throw IfcException("Attribute not found");
} }
std::set<std::string> Type::GetInverseAttributeNames(Enum t) { std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value; std::set<std::string> return_value;
while (true) { for (;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) { for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first); return_value.insert(jt->first);
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
return return_value; return return_value;
} }
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type()); std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) { if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) { for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it); e->setArgumentDerived(*it);
} }
} }
} }
""" """
+4 -5
View File
@@ -101,7 +101,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
IfcSchema::IfcFaceBound::list::ptr bounds = l->Bounds(); IfcSchema::IfcFaceBound::list::ptr bounds = l->Bounds();
Handle(Geom_Surface) face_surface; Handle(Geom_Surface) face_surface;
bool reversed_face_surface = false;
const bool is_face_surface = l->is(IfcSchema::Type::IfcFaceSurface); const bool is_face_surface = l->is(IfcSchema::Type::IfcFaceSurface);
if (is_face_surface) { if (is_face_surface) {
@@ -237,9 +236,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
// If the wires are reversed the face needs to be reversed as well in order // If the wires are reversed the face needs to be reversed as well in order
// to maintain the counter-clock-wise ordering of the bounding wire's vertices. // to maintain the counter-clock-wise ordering of the bounding wire's vertices.
bool all_reversed = true; bool all_reversed = true;
TopoDS_Iterator it(outer_face_bound, false); TopoDS_Iterator jt(outer_face_bound, false);
for (; it.More(); it.Next()) { for (; jt.More(); jt.Next()) {
const TopoDS_Wire& w = TopoDS::Wire(it.Value()); const TopoDS_Wire& w = TopoDS::Wire(jt.Value());
if ((w.Orientation() != TopAbs_REVERSED) == same_sense) { if ((w.Orientation() != TopAbs_REVERSED) == same_sense) {
all_reversed = false; all_reversed = false;
} }
@@ -856,7 +855,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCompositeProfileDef* l, TopoDS
builder.MakeCompound(compound); builder.MakeCompound(compound);
IfcSchema::IfcProfileDef::list::ptr profiles = l->Profiles(); IfcSchema::IfcProfileDef::list::ptr profiles = l->Profiles();
bool first = true; //bool first = true;
for (IfcSchema::IfcProfileDef::list::it it = profiles->begin(); it != profiles->end(); ++it) { for (IfcSchema::IfcProfileDef::list::it it = profiles->begin(); it != profiles->end(); ++it) {
TopoDS_Face f; TopoDS_Face f;
if (convert_face(*it, f)) { if (convert_face(*it, f)) {
+10 -12
View File
@@ -208,12 +208,11 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
? BRepBuilderAPI_GTransform(opening_shape_unlocated,opening_shape_gtrsf,true).Shape() ? BRepBuilderAPI_GTransform(opening_shape_unlocated,opening_shape_gtrsf,true).Shape()
: opening_shape_unlocated.Moved(opening_shape_gtrsf.Trsf()); : opening_shape_unlocated.Moved(opening_shape_gtrsf.Trsf());
double opening_volume, original_shape_volume; double opening_volume;
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) { if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
opening_volume = shape_volume(opening_shape); opening_volume = shape_volume(opening_shape);
if ( opening_volume <= ALMOST_ZERO ) if ( opening_volume <= ALMOST_ZERO )
Logger::Message(Logger::LOG_WARNING,"Empty opening for:",entity->entity); Logger::Message(Logger::LOG_WARNING,"Empty opening for:",entity->entity);
original_shape_volume = shape_volume(entity_shape);
} }
if (entity_shape.ShapeType() == TopAbs_COMPSOLID) { if (entity_shape.ShapeType() == TopAbs_COMPSOLID) {
@@ -235,9 +234,9 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
BRepCheck_Analyzer analyser(brep_cut_result); BRepCheck_Analyzer analyser(brep_cut_result);
bool is_valid = analyser.IsValid() != 0; bool is_valid = analyser.IsValid() != 0;
if (is_valid) { if (is_valid) {
TopExp_Explorer exp(brep_cut_result, TopAbs_SOLID); TopExp_Explorer exp2(brep_cut_result, TopAbs_SOLID);
for (; exp.More(); exp.Next()) { for (; exp2.More(); exp2.Next()) {
builder.Add(compound, exp.Current()); builder.Add(compound, exp2.Current());
added = true; added = true;
} }
} }
@@ -272,7 +271,7 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
entity_shape = brep_cut_result; entity_shape = brep_cut_result;
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) { if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
const double volume_after_subtraction = shape_volume(entity_shape); const double volume_after_subtraction = shape_volume(entity_shape);
double original_shape_volume = shape_volume(entity_shape);
if ( ALMOST_THE_SAME(original_shape_volume,volume_after_subtraction) ) if ( ALMOST_THE_SAME(original_shape_volume,volume_after_subtraction) )
Logger::Message(Logger::LOG_WARNING,"Subtraction yields unchanged volume:",entity->entity); Logger::Message(Logger::LOG_WARNING,"Subtraction yields unchanged volume:",entity->entity);
} }
@@ -615,11 +614,11 @@ IfcSchema::IfcProductDefinitionShape* IfcGeom::tesselate(TopoDS_Shape& shape, do
IfcSchema::IfcFaceOuterBound* bound = new IfcSchema::IfcFaceOuterBound(loop, face.Orientation() != TopAbs_REVERSED); IfcSchema::IfcFaceOuterBound* bound = new IfcSchema::IfcFaceOuterBound(loop, face.Orientation() != TopAbs_REVERSED);
IfcSchema::IfcFaceBound::list::ptr bounds (new IfcSchema::IfcFaceBound::list); IfcSchema::IfcFaceBound::list::ptr bounds (new IfcSchema::IfcFaceBound::list);
bounds->push(bound); bounds->push(bound);
IfcSchema::IfcFace* face = new IfcSchema::IfcFace(bounds); IfcSchema::IfcFace* face2 = new IfcSchema::IfcFace(bounds);
es->push(loop); es->push(loop);
es->push(bound); es->push(bound);
es->push(face); es->push(face2);
faces->push(face); faces->push(face2);
} }
} }
} }
@@ -703,7 +702,6 @@ bool IfcGeom::Kernel::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& sha
// Now loop over all the vertices that are part of the wire(s) to be filled // Now loop over all the vertices that are part of the wire(s) to be filled
for (int i = 1; i <= num_verts; ++i) { for (int i = 1; i <= num_verts; ++i) {
first = current = TopoDS::Vertex(vertex_to_edges.FindKey(i)); first = current = TopoDS::Vertex(vertex_to_edges.FindKey(i));
const bool isSame = first.IsSame(current);
// We keep track of the vertices we already used // We keep track of the vertices we already used
if (visited.find(vertex_to_edges.FindIndex(current)) != visited.end()) { if (visited.find(vertex_to_edges.FindIndex(current)) != visited.end()) {
continue; continue;
@@ -711,7 +709,7 @@ bool IfcGeom::Kernel::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& sha
// Given these vertices, try to find closed loops and create new // Given these vertices, try to find closed loops and create new
// wires out of them. // wires out of them.
BRepBuilderAPI_MakeWire w; BRepBuilderAPI_MakeWire w;
while (true) { for (;;) {
visited.insert(vertex_to_edges.FindIndex(current)); visited.insert(vertex_to_edges.FindIndex(current));
// Find the edge that the current vertex is part of and points // Find the edge that the current vertex is part of and points
// away from the previous vertex (null for the first vertex). // away from the previous vertex (null for the first vertex).
@@ -822,7 +820,7 @@ void IfcGeom::Kernel::remove_redundant_points_from_loop(TColgp_SequenceOfPnt& po
if (tol <= 0.) tol = getValue(GV_POINT_EQUALITY_TOLERANCE); if (tol <= 0.) tol = getValue(GV_POINT_EQUALITY_TOLERANCE);
tol *= tol; tol *= tol;
while (true) { for (;;) {
bool removed = false; bool removed = false;
int n = polygon.Length() - (closed ? 0 : 1); int n = polygon.Length() - (closed ? 0 : 1);
for (int i = 1; i <= n; ++i) { for (int i = 1; i <= n; ++i) {
+1 -1
View File
@@ -287,7 +287,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& t
return false; return false;
} }
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l; IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
while (1) { for (;;) {
gp_Trsf trsf2; gp_Trsf trsf2;
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement(); IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) { if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) {
+6 -8
View File
@@ -182,9 +182,7 @@ namespace IfcGeom {
} }
if (context->hasContextType()) { if (context->hasContextType()) {
std::string context_type_lc = context->ContextType(); std::string context_type_lc = context->ContextType();
for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) { std::transform(context_type_lc.begin(), context_type_lc.end(), context_type_lc.begin(), ::tolower);
*c = tolower(*c);
}
if (context_types.find(context_type_lc) != context_types.end()) { if (context_types.find(context_type_lc) != context_types.end()) {
filtered_contexts->push(context); filtered_contexts->push(context);
} }
@@ -287,7 +285,7 @@ namespace IfcGeom {
} }
BRepElement<P>* create_shape_model_for_next_entity() { BRepElement<P>* create_shape_model_for_next_entity() {
while ( true ) { for (;;) {
IfcSchema::IfcRepresentation* representation; IfcSchema::IfcRepresentation* representation;
// Have we reached the end of our list of representations? // Have we reached the end of our list of representations?
@@ -320,16 +318,16 @@ namespace IfcGeom {
// Filter the products based on the set of entities being included or excluded for // Filter the products based on the set of entities being included or excluded for
// processing. The set is iterated over te able to filter on subtypes. // processing. The set is iterated over te able to filter on subtypes.
for ( IfcSchema::IfcProduct::list::it it = unfiltered_products->begin(); it != unfiltered_products->end(); ++it ) { for ( IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt ) {
bool found = false; bool found = false;
for (std::set<IfcSchema::Type::Enum>::const_iterator jt = entities_to_include_or_exclude.begin(); jt != entities_to_include_or_exclude.end(); ++jt) { for (std::set<IfcSchema::Type::Enum>::const_iterator kt = entities_to_include_or_exclude.begin(); kt != entities_to_include_or_exclude.end(); ++kt) {
if ((*it)->is(*jt)) { if ((*jt)->is(*kt)) {
found = true; found = true;
break; break;
} }
} }
if (found == include_entities_in_processing) { if (found == include_entities_in_processing) {
ifcproducts->push(*it); ifcproducts->push(*jt);
} }
} }
+16 -14
View File
@@ -41,6 +41,8 @@ namespace IfcGeom {
namespace Representation { namespace Representation {
class Representation { class Representation {
Representation(const Representation&); //N/A
Representation& operator =(const Representation&); //N/A
protected: protected:
const ElementSettings _settings; const ElementSettings _settings;
public: public:
@@ -116,11 +118,11 @@ namespace IfcGeom {
: Representation(shape_model.settings()) : Representation(shape_model.settings())
, _id(shape_model.getId()) , _id(shape_model.getId())
{ {
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it = shape_model.begin(); it != shape_model.end(); ++ it ) { for ( IfcGeom::IfcRepresentationShapeItems::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++ iit ) {
int surface_style_id = -1; int surface_style_id = -1;
if (it->hasStyle()) { if (iit->hasStyle()) {
Material adapter(&it->Style()); Material adapter(&iit->Style());
std::vector<Material>::const_iterator jt = std::find(_materials.begin(), _materials.end(), adapter); std::vector<Material>::const_iterator jt = std::find(_materials.begin(), _materials.end(), adapter);
if (jt == _materials.end()) { if (jt == _materials.end()) {
surface_style_id = (int)_materials.size(); surface_style_id = (int)_materials.size();
@@ -132,17 +134,17 @@ namespace IfcGeom {
if (settings().apply_default_materials() && surface_style_id == -1) { if (settings().apply_default_materials() && surface_style_id == -1) {
Material material(IfcGeom::get_default_style(settings().element_type())); Material material(IfcGeom::get_default_style(settings().element_type()));
std::vector<Material>::const_iterator it = std::find(_materials.begin(), _materials.end(), material); std::vector<Material>::const_iterator mit = std::find(_materials.begin(), _materials.end(), material);
if (it == _materials.end()) { if (mit == _materials.end()) {
surface_style_id = (int)_materials.size(); surface_style_id = (int)_materials.size();
_materials.push_back(material); _materials.push_back(material);
} else { } else {
surface_style_id = (int)(it - _materials.begin()); surface_style_id = (int)(mit - _materials.begin());
} }
} }
const TopoDS_Shape& s = it->Shape(); const TopoDS_Shape& s = iit->Shape();
const gp_GTrsf& trsf = it->Placement(); const gp_GTrsf& trsf = iit->Placement();
// Triangulate the shape // Triangulate the shape
try { try {
@@ -233,11 +235,11 @@ namespace IfcGeom {
addEdge(dict[n2], dict[n3], edgecount, edges_temp); addEdge(dict[n2], dict[n3], edgecount, edges_temp);
addEdge(dict[n3], dict[n1], edgecount, edges_temp); addEdge(dict[n3], dict[n1], edgecount, edges_temp);
} }
for ( std::vector<std::pair<int,int> >::const_iterator it = edges_temp.begin(); it != edges_temp.end(); ++it ) { for ( std::vector<std::pair<int,int> >::const_iterator jt = edges_temp.begin(); jt != edges_temp.end(); ++jt ) {
if (edgecount[*it] == 1) { if (edgecount[*jt] == 1) {
// non manifold edge, face boundary // non manifold edge, face boundary
_edges.push_back(it->first); _edges.push_back(jt->first);
_edges.push_back(it->second); _edges.push_back(jt->second);
} }
} }
} }
@@ -247,8 +249,8 @@ namespace IfcGeom {
// Edges are only emitted if there are no faces. A mixed representation of faces // Edges are only emitted if there are no faces. A mixed representation of faces
// and loose edges is discouraged by the standard. An alternative would be to use // and loose edges is discouraged by the standard. An alternative would be to use
// TopExp::MapShapesAndAncestors() to find edges that do not belong to any face. // TopExp::MapShapesAndAncestors() to find edges that do not belong to any face.
for (TopExp_Explorer exp(s, TopAbs_EDGE); exp.More(); exp.Next()) { for (TopExp_Explorer texp(s, TopAbs_EDGE); texp.More(); texp.Next()) {
BRepAdaptor_Curve crv(TopoDS::Edge(exp.Current())); BRepAdaptor_Curve crv(TopoDS::Edge(texp.Current()));
GCPnts_QuasiUniformDeflection tessellater(crv, settings().deflection_tolerance()); GCPnts_QuasiUniformDeflection tessellater(crv, settings().deflection_tolerance());
int n = tessellater.NbPoints(); int n = tessellater.NbPoints();
int start = (int)_verts.size() / 3; int start = (int)_verts.size() / 3;
+4 -4
View File
@@ -627,9 +627,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCurveBoundedPlane* l, TopoDS_S
BRepBuilderAPI_MakeFace mf (outer); BRepBuilderAPI_MakeFace mf (outer);
mf.Add(outer); mf.Add(outer);
IfcSchema::IfcCurve::list::ptr inner = l->InnerBoundaries(); IfcSchema::IfcCurve::list::ptr boundaries = l->InnerBoundaries();
for (IfcSchema::IfcCurve::list::it it = inner->begin(); it != inner->end(); ++it) { for (IfcSchema::IfcCurve::list::it it = boundaries->begin(); it != boundaries->end(); ++it) {
TopoDS_Wire inner; TopoDS_Wire inner;
convert_wire(*it, inner); convert_wire(*it, inner);
@@ -762,8 +762,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap
// Subtraction of pipes with small radii is unstable. // Subtraction of pipes with small radii is unstable.
hasInnerRadius = false; hasInnerRadius = false;
} else { } else {
Handle(Geom_Circle) circle = new Geom_Circle(directrix, r2); Handle(Geom_Circle) circle2 = new Geom_Circle(directrix, r2);
section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle)); section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle2));
} }
} }
+3 -5
View File
@@ -184,8 +184,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire&
bool trim_cartesian = l->MasterRepresentation() == IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN; bool trim_cartesian = l->MasterRepresentation() == IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN;
IfcEntityList::ptr trims1 = l->Trim1(); IfcEntityList::ptr trims1 = l->Trim1();
IfcEntityList::ptr trims2 = l->Trim2(); IfcEntityList::ptr trims2 = l->Trim2();
bool trimmed1 = false;
bool trimmed2 = false;
unsigned sense_agreement = l->SenseAgreement() ? 0 : 1; unsigned sense_agreement = l->SenseAgreement() ? 0 : 1;
double flts[2]; double flts[2];
gp_Pnt pnts[2]; gp_Pnt pnts[2];
@@ -411,9 +409,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcEdgeLoop* l, TopoDS_Wire& resu
TopoDS_Wire w; TopoDS_Wire w;
if (convert_wire(*it, w)) { if (convert_wire(*it, w)) {
if (!(*it)->Orientation()) w.Reverse(); if (!(*it)->Orientation()) w.Reverse();
TopoDS_Iterator it(w, false); TopoDS_Iterator topoit(w, false);
for (; it.More(); it.Next()) { for (; topoit.More(); topoit.Next()) {
const TopoDS_Edge& e = TopoDS::Edge(it.Value()); const TopoDS_Edge& e = TopoDS::Edge(topoit.Value());
mw.Add(e); mw.Add(e);
} }
// mw.Add(w); // mw.Add(w);
+16 -20
View File
@@ -156,16 +156,16 @@ public:
class Get : public Command { class Get : public Command {
protected: protected:
void read_content(std::istream& s) {} void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) {} void write_content(std::ostream& /*s*/) {}
public: public:
Get() : Command(GET) {}; Get() : Command(GET) {};
}; };
class GetLog : public Command { class GetLog : public Command {
protected: protected:
void read_content(std::istream& s) {} void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) {} void write_content(std::ostream& /*s*/) {}
public: public:
GetLog() : Command(GET_LOG) {}; GetLog() : Command(GET_LOG) {};
}; };
@@ -189,7 +189,7 @@ private:
const IfcGeom::TriangulationElement<float>* geom; const IfcGeom::TriangulationElement<float>* geom;
bool append_line_data; bool append_line_data;
protected: protected:
void read_content(std::istream& s) {} void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) { void write_content(std::ostream& s) {
swrite<int32_t>(s, geom->id()); swrite<int32_t>(s, geom->id());
swrite(s, geom->guid()); swrite(s, geom->guid());
@@ -238,9 +238,9 @@ protected:
} }
{ std::vector<float> diffuse_color_array; { std::vector<float> diffuse_color_array;
for (std::vector<IfcGeom::Material>::const_iterator it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) { for (std::vector<IfcGeom::Material>::const_iterator it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) {
const IfcGeom::Material& m = *it; const IfcGeom::Material& mat = *it;
if (m.hasDiffuse()) { if (mat.hasDiffuse()) {
const double* color = m.diffuse(); const double* color = mat.diffuse();
diffuse_color_array.push_back(static_cast<float>(color[0])); diffuse_color_array.push_back(static_cast<float>(color[0]));
diffuse_color_array.push_back(static_cast<float>(color[1])); diffuse_color_array.push_back(static_cast<float>(color[1]));
diffuse_color_array.push_back(static_cast<float>(color[2])); diffuse_color_array.push_back(static_cast<float>(color[2]));
@@ -249,8 +249,8 @@ protected:
diffuse_color_array.push_back(0.f); diffuse_color_array.push_back(0.f);
diffuse_color_array.push_back(0.f); diffuse_color_array.push_back(0.f);
} }
if (m.hasTransparency()) { if (mat.hasTransparency()) {
diffuse_color_array.push_back(static_cast<float>(1. - m.transparency())); diffuse_color_array.push_back(static_cast<float>(1. - mat.transparency()));
} else { } else {
diffuse_color_array.push_back(1.f); diffuse_color_array.push_back(1.f);
} }
@@ -268,25 +268,21 @@ public:
class Next : public Command { class Next : public Command {
protected: protected:
void read_content(std::istream& s) {} void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) {} void write_content(std::ostream& /*s*/) {}
public: public:
Next() : Command(NEXT) {}; Next() : Command(NEXT) {};
}; };
class Bye : public Command { class Bye : public Command {
protected: protected:
void read_content(std::istream& s) {} void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) {} void write_content(std::ostream& /*s*/) {}
public: public:
Bye() : Command(BYE) {}; Bye() : Command(BYE) {};
}; };
int main (int argc, char** argv) { int main () {
if (sizeof(float) != 4 || sizeof(int32_t) != 4) {
return 1;
}
// Redirect stdout to this stream, so that involuntary // Redirect stdout to this stream, so that involuntary
// writes to stdout do not interfere with our protocol. // writes to stdout do not interfere with our protocol.
std::ostringstream oss; std::ostringstream oss;
@@ -308,7 +304,7 @@ int main (int argc, char** argv) {
Hello().write(std::cout); Hello().write(std::cout);
int exit_code = 0; int exit_code = 0;
while (1) { for (;;) {
const int32_t msg_type = sread<int32_t>(std::cin); const int32_t msg_type = sread<int32_t>(std::cin);
switch (msg_type) { switch (msg_type) {
case IFC_MODEL: { case IFC_MODEL: {
+24 -24
View File
@@ -4247,48 +4247,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
} }
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) { std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
while (true) { for(;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
jt = it->second.find(a); jt = it->second.find(a);
if (jt != it->second.end()) { if (jt != it->second.end()) {
return jt->second; return jt->second;
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
throw IfcException("Attribute not found"); throw IfcException("Attribute not found");
} }
std::set<std::string> Type::GetInverseAttributeNames(Enum t) { std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value; std::set<std::string> return_value;
while (true) { for (;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) { for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first); return_value.insert(jt->first);
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
return return_value; return return_value;
} }
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type()); std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) { if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) { for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it); e->setArgumentDerived(*it);
} }
} }
} }
#endif #endif
+2
View File
@@ -31,6 +31,8 @@
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h" #include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace Ifc2x3; using namespace Ifc2x3;
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
+9 -1
View File
@@ -29,7 +29,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@@ -37,6 +36,11 @@
#include "../ifcparse/IfcException.h" #include "../ifcparse/IfcException.h"
#include "../ifcparse/Ifc2x3enum.h" #include "../ifcparse/Ifc2x3enum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema Ifc2x3 #define IfcSchema Ifc2x3
namespace Ifc2x3 { namespace Ifc2x3 {
@@ -41583,4 +41587,8 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0); IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif #endif
+24 -24
View File
@@ -4941,48 +4941,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
} }
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) { std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
while (true) { for(;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
jt = it->second.find(a); jt = it->second.find(a);
if (jt != it->second.end()) { if (jt != it->second.end()) {
return jt->second; return jt->second;
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
throw IfcException("Attribute not found"); throw IfcException("Attribute not found");
} }
std::set<std::string> Type::GetInverseAttributeNames(Enum t) { std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap(); if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it; inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt; inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value; std::set<std::string> return_value;
while (true) { for (;;) {
it = inverse_map.find(t); it = inverse_map.find(t);
if (it != inverse_map.end()) { if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) { for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first); return_value.insert(jt->first);
} }
} }
if ((t = Parent(t)) == -1) break; if ((t = Parent(t)) == -1) break;
} }
return return_value; return return_value;
} }
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type()); std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) { if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) { for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it); e->setArgumentDerived(*it);
} }
} }
} }
#endif #endif
+2
View File
@@ -31,6 +31,8 @@
#include "../ifcparse/IfcWrite.h" #include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h" #include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace Ifc4; using namespace Ifc4;
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
+9 -1
View File
@@ -29,7 +29,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@@ -37,6 +36,11 @@
#include "../ifcparse/IfcException.h" #include "../ifcparse/IfcException.h"
#include "../ifcparse/Ifc4enum.h" #include "../ifcparse/Ifc4enum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema Ifc4 #define IfcSchema Ifc4
namespace Ifc4 { namespace Ifc4 {
@@ -55147,4 +55151,8 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0); IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif #endif
+4 -4
View File
@@ -130,7 +130,7 @@ IfcCharacterDecoder::operator std::string() {
#ifdef HAVE_ICU #ifdef HAVE_ICU
unsigned int old_hex = 0; // for compatibility_mode unsigned int old_hex = 0; // for compatibility_mode
#endif #endif
while ( current_char = file->Peek() ) { while ( (current_char = file->Peek()) != 0 ) {
if ( EXPECTS_CHARACTER(parse_state) ) { if ( EXPECTS_CHARACTER(parse_state) ) {
#ifdef HAVE_ICU #ifdef HAVE_ICU
if ( previous_codepage != codepage ) { if ( previous_codepage != codepage ) {
@@ -227,7 +227,7 @@ void IfcCharacterDecoder::dryRun() {
unsigned int parse_state = 0; unsigned int parse_state = 0;
char current_char; char current_char;
unsigned int hex_count = 0; unsigned int hex_count = 0;
while ( current_char = file->Peek() ) { while ((current_char = file->Peek()) != 0) {
if ( EXPECTS_CHARACTER(parse_state) ) { if ( EXPECTS_CHARACTER(parse_state) ) {
parse_state = 0; parse_state = 0;
} else if ( current_char == '\'' && ! parse_state ) { } else if ( current_char == '\'' && ! parse_state ) {
@@ -340,8 +340,8 @@ IfcCharacterEncoder::operator std::string() {
oss << "\\X" << num_bytes_str << "\\"; oss << "\\X" << num_bytes_str << "\\";
} }
if ( within_spf_range ) { if ( within_spf_range ) {
oss.put(ch); oss.put((char)ch);
if ( ch == '\\' || ch == '\'' ) oss.put(ch); if ( ch == '\\' || ch == '\'' ) oss.put((char)ch);
} else { } else {
oss << std::hex << std::setw(num_bytes*2) << std::uppercase << std::setfill('0') << (int) ch; oss << std::hex << std::setw(num_bytes*2) << std::uppercase << std::setfill('0') << (int) ch;
} }
+2 -2
View File
@@ -38,7 +38,7 @@ std::string base64(unsigned v, int l) {
r.push_back(chars[v%64]); r.push_back(chars[v%64]);
v /= 64; v /= 64;
} }
while ( r.size() != l ) r.push_back('0'); while ( (int)r.size() != l ) r.push_back('0');
std::reverse(r.begin(),r.end()); std::reverse(r.begin(),r.end());
return r; return r;
} }
@@ -70,7 +70,7 @@ std::string compress(unsigned char* v) {
// Expands the base64 representation into a UUID byte array // Expands the base64 representation into a UUID byte array
void expand(const std::string& s, std::vector<unsigned char>& v) { void expand(const std::string& s, std::vector<unsigned char>& v) {
v.push_back(from_base64(s.substr(0,2))); v.push_back((unsigned char)from_base64(s.substr(0,2)));
for( unsigned i = 0; i < 5; ++i ) { for( unsigned i = 0; i < 5; ++i ) {
unsigned d = from_base64(s.substr(2+4*i,4)); unsigned d = from_base64(s.substr(2+4*i,4));
for ( unsigned j = 0; j < 3; ++ j ) { for ( unsigned j = 0; j < 3; ++ j ) {
+5 -5
View File
@@ -290,7 +290,7 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
IfcSchema::IfcAxis2Placement2D* place, IfcSchema::IfcAxis2Placement3D* place2, IfcSchema::IfcAxis2Placement2D* place, IfcSchema::IfcAxis2Placement3D* place2,
IfcSchema::IfcDirection* dir, IfcSchema::IfcRepresentationContext* context) IfcSchema::IfcDirection* dir, IfcSchema::IfcRepresentationContext* context)
{ {
if (false) { if (false) { // TODO What's this?
IfcSchema::IfcRectangleProfileDef* profile = new IfcSchema::IfcRectangleProfileDef( IfcSchema::IfcRectangleProfileDef* profile = new IfcSchema::IfcRectangleProfileDef(
IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, boost::none, place ? place : addPlacement2d(), w, d); IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, boost::none, place ? place : addPlacement2d(), w, d);
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile, IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
@@ -303,10 +303,10 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
rep->setItems(items); rep->setItems(items);
} else { } else {
std::vector<std::pair<double, double> > points; std::vector<std::pair<double, double> > points;
points.push_back(std::pair<double, double>(-w/2, -d/2)); points.push_back(std::make_pair(-w/2, -d/2));
points.push_back(std::pair<double, double>(w/2, -d/2)); points.push_back(std::make_pair(w/2, -d/2));
points.push_back(std::pair<double, double>(w/2, d/2)); points.push_back(std::make_pair(w/2, d/2));
points.push_back(std::pair<double, double>(-w/2, d/2)); points.push_back(std::make_pair(-w/2, d/2));
// The call to addExtrudedPolyline() closes the polyline // The call to addExtrudedPolyline() closes the polyline
addExtrudedPolyline(rep, points, h, place, place2, dir, context); addExtrudedPolyline(rep, points, h, place, place2, dir, context);
} }
+21 -21
View File
@@ -87,35 +87,35 @@ unsigned int IfcParse::IfcLateBoundEntity::getArgumentCount() const {
return IfcSchema::Type::GetAttributeCount(_type); return IfcSchema::Type::GetAttributeCount(_type);
} }
IfcUtil::ArgumentType IfcParse::IfcLateBoundEntity::getArgumentType(unsigned int i) const { IfcUtil::ArgumentType IfcParse::IfcLateBoundEntity::getArgumentType(unsigned int i) const {
return IfcSchema::Type::GetAttributeDerived(_type, i) return IfcSchema::Type::GetAttributeDerived(_type, (unsigned char)i)
? IfcUtil::Argument_DERIVED ? IfcUtil::Argument_DERIVED
: IfcSchema::Type::GetAttributeType(_type,i); : IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
} }
IfcSchema::Type::Enum IfcParse::IfcLateBoundEntity::getArgumentEntity(unsigned int i) const { IfcSchema::Type::Enum IfcParse::IfcLateBoundEntity::getArgumentEntity(unsigned int i) const {
return IfcSchema::Type::GetAttributeEntity(_type, i); return IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
} }
Argument* IfcParse::IfcLateBoundEntity::getArgument(unsigned int i) const { Argument* IfcParse::IfcLateBoundEntity::getArgument(unsigned int i) const {
return entity->getArgument(i); return entity->getArgument(i);
} }
const char* IfcParse::IfcLateBoundEntity::getArgumentName(unsigned int i) const { const char* IfcParse::IfcLateBoundEntity::getArgumentName(unsigned int i) const {
return IfcSchema::Type::GetAttributeName(_type,i).c_str(); return IfcSchema::Type::GetAttributeName(_type, (unsigned char)i).c_str();
} }
bool IfcParse::IfcLateBoundEntity::getArgumentOptionality(unsigned int i) const { bool IfcParse::IfcLateBoundEntity::getArgumentOptionality(unsigned int i) const {
return IfcSchema::Type::GetAttributeOptional(_type, i); return IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
} }
void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::string& t) { void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::string& t) {
const std::string arg_name = IfcSchema::Type::GetAttributeName(_type,i); const std::string arg_name = IfcSchema::Type::GetAttributeName(_type, (unsigned char)i);
throw IfcException(t + " is not a valid type for '" + arg_name + "'"); throw IfcException(t + " is not a valid type for '" + arg_name + "'");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsNull(unsigned int i) { void IfcParse::IfcLateBoundEntity::setArgumentAsNull(unsigned int i) {
bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, i); bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
if (is_optional) { if (is_optional) {
writable_entity()->setArgument(i); writable_entity()->setArgument(i);
} else invalid_argument(i,"NULL"); } else invalid_argument(i,"NULL");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) { void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_INT) { if (arg_type == Argument_INT) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else if ( (arg_type == Argument_BOOL) && ( (v == 0) || (v == 1) ) ) { } else if ( (arg_type == Argument_BOOL) && ( (v == 0) || (v == 1) ) ) {
@@ -123,23 +123,23 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
} else invalid_argument(i,"INTEGER"); } else invalid_argument(i,"INTEGER");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsBool(unsigned int i, bool v) { void IfcParse::IfcLateBoundEntity::setArgumentAsBool(unsigned int i, bool v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_BOOL) { if (arg_type == Argument_BOOL) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"BOOLEAN"); } else invalid_argument(i,"BOOLEAN");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsDouble(unsigned int i, double v) { void IfcParse::IfcLateBoundEntity::setArgumentAsDouble(unsigned int i, double v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_DOUBLE) { if (arg_type == Argument_DOUBLE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"REAL"); } else invalid_argument(i,"REAL");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std::string& a) { void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std::string& a) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_STRING) { if (arg_type == Argument_STRING) {
writable_entity()->setArgument(i,a); writable_entity()->setArgument(i,a);
} else if (arg_type == Argument_ENUMERATION) { } else if (arg_type == Argument_ENUMERATION) {
std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, i), a); std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i), a);
writable_entity()->setArgument(i, enum_data.second, enum_data.first); writable_entity()->setArgument(i, enum_data.second, enum_data.first);
} else if (arg_type == Argument_BINARY) { } else if (arg_type == Argument_BINARY) {
if (valid_binary_string(a)) { if (valid_binary_string(a)) {
@@ -151,19 +151,19 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std
} else invalid_argument(i,"STRING"); } else invalid_argument(i,"STRING");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfInt(unsigned int i, const std::vector<int>& v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfInt(unsigned int i, const std::vector<int>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_INT) { if (arg_type == Argument_AGGREGATE_OF_INT) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF INT"); } else invalid_argument(i,"AGGREGATE OF INT");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfDouble(unsigned int i, const std::vector<double>& v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfDouble(unsigned int i, const std::vector<double>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_DOUBLE) { if (arg_type == Argument_AGGREGATE_OF_DOUBLE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF DOUBLE"); } else invalid_argument(i,"AGGREGATE OF DOUBLE");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i, const std::vector<std::string>& v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i, const std::vector<std::string>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_STRING) { if (arg_type == Argument_AGGREGATE_OF_STRING) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else if (arg_type == Argument_AGGREGATE_OF_BINARY) { } else if (arg_type == Argument_AGGREGATE_OF_BINARY) {
@@ -180,31 +180,31 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i
} else invalid_argument(i,"AGGREGATE OF STRING"); } else invalid_argument(i,"AGGREGATE OF STRING");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsEntityInstance(unsigned int i, IfcParse::IfcLateBoundEntity* v) { void IfcParse::IfcLateBoundEntity::setArgumentAsEntityInstance(unsigned int i, IfcParse::IfcLateBoundEntity* v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_ENTITY_INSTANCE) { if (arg_type == Argument_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"ENTITY INSTANCE"); } else invalid_argument(i,"ENTITY INSTANCE");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfEntityInstance(unsigned int i, IfcEntityList::ptr v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfEntityInstance(unsigned int i, IfcEntityList::ptr v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_ENTITY_INSTANCE) { if (arg_type == Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF ENTITY INSTANCE"); } else invalid_argument(i,"AGGREGATE OF ENTITY INSTANCE");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfInt(unsigned int i, const std::vector< std::vector<int> >& v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfInt(unsigned int i, const std::vector< std::vector<int> >& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_INT) { if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_INT) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF INT"); } else invalid_argument(i,"AGGREGATE OF AGGREGATE OF INT");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfDouble(unsigned int i, const std::vector< std::vector<double> >& v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfDouble(unsigned int i, const std::vector< std::vector<double> >& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE) { if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF DOUBLE"); } else invalid_argument(i,"AGGREGATE OF AGGREGATE OF DOUBLE");
} }
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, IfcEntityListList::ptr v) { void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, IfcEntityListList::ptr v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i); IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) { if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v); writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF ENTITY INSTANCE"); } else invalid_argument(i,"AGGREGATE OF AGGREGATE OF ENTITY INSTANCE");
@@ -230,7 +230,7 @@ bool IfcParse::IfcLateBoundEntity::is_valid() {
const Argument& arg = *getArgument(i); const Argument& arg = *getArgument(i);
is_null = arg.isNull(); is_null = arg.isNull();
} catch(IfcException) {} } catch(IfcException) {}
if (!IfcSchema::Type::GetAttributeOptional(_type,i) && is_null) { if (!IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i) && is_null) {
if (!valid) { if (!valid) {
oss << ", "; oss << ", ";
} }
+26 -25
View File
@@ -143,6 +143,8 @@ void IfcSpfStream::ReadBuffer(bool inc) {
offset += len; offset += len;
fseek(stream, offset, SEEK_SET); fseek(stream, offset, SEEK_SET);
} }
#else
(void)inc;
#endif #endif
eof = feof(stream) != 0; eof = feof(stream) != 0;
if ( eof ) return; if ( eof ) return;
@@ -308,7 +310,7 @@ Token IfcSpfLexer::Next() {
while ( ! stream->eof ) { while ( ! stream->eof ) {
// Read character and increment pointer if not starting a new token // Read character and increment pointer if not starting a new token
char c = stream->Peek(); c = stream->Peek();
if ( len && (c == '(' || c == ')' || c == '=' || c == ',' || c == ';' || c == '/') ) break; if ( len && (c == '(' || c == ')' || c == '=' || c == ',' || c == ';' || c == '/') ) break;
stream->Inc(); stream->Inc();
len ++; len ++;
@@ -363,7 +365,7 @@ bool TokenFunc::startsWith(const Token& t, char c) {
} }
bool TokenFunc::isOperator(const Token& t, char op) { bool TokenFunc::isOperator(const Token& t, char op) {
return (!t.first) && (!op || op == t.second); return (!t.first) && (!op || (unsigned)op == t.second);
} }
bool TokenFunc::isIdentifier(const Token& t) { bool TokenFunc::isIdentifier(const Token& t) {
@@ -394,8 +396,8 @@ bool TokenFunc::isInt(const Token& t) {
const std::string str = asString(t); const std::string str = asString(t);
const char* start = str.c_str(); const char* start = str.c_str();
char* end; char* end;
long result = strtol(start,&end,10); /*long result =*/ strtol(start,&end,10);
return ((end - start) == str.length()); return ((end - start) == (ptrdiff_t)str.length());
} }
bool TokenFunc::isBool(const Token& t) { bool TokenFunc::isBool(const Token& t) {
@@ -412,11 +414,11 @@ bool TokenFunc::isFloat(const Token& t) {
const char* start = str.c_str(); const char* start = str.c_str();
char* end; char* end;
#ifdef _MSC_VER #ifdef _MSC_VER
double result = _strtod_l(start,&end,locale); /*double result =*/ _strtod_l(start,&end,locale);
#else #else
double result = strtod_l(start,&end,locale); double result = strtod_l(start,&end,locale);
#endif #endif
return ((end - start) == str.length()); return ((end - start) == (ptrdiff_t)str.length());
} }
int TokenFunc::asInt(const Token& t) { int TokenFunc::asInt(const Token& t) {
@@ -508,8 +510,7 @@ EntityArgument::EntityArgument(const Token& t) {
// Aditionally, stores the ids (i.e. #[\d]+) in a vector // Aditionally, stores the ids (i.e. #[\d]+) in a vector
// //
void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) { void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
IfcParse::IfcFile* file = t->file; //IfcParse::IfcFile* file = t->file;
Token next = t->Next(); Token next = t->Next();
while( next.second || next.first ) { while( next.second || next.first ) {
if ( TokenFunc::isOperator(next,',') ) { if ( TokenFunc::isOperator(next,',') ) {
@@ -517,9 +518,9 @@ void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
} else if ( TokenFunc::isOperator(next,')') ) { } else if ( TokenFunc::isOperator(next,')') ) {
break; break;
} else if ( TokenFunc::isOperator(next,'(') ) { } else if ( TokenFunc::isOperator(next,'(') ) {
ArgumentList* list = new ArgumentList(); ArgumentList* alist = new ArgumentList();
list->read(t, ids); alist->read(t, ids);
push(list); push(alist);
} else { } else {
if ( TokenFunc::isIdentifier(next) ) { if ( TokenFunc::isIdentifier(next) ) {
ids.push_back(TokenFunc::asInt(next)); ids.push_back(TokenFunc::asInt(next));
@@ -640,7 +641,7 @@ ArgumentList::operator IfcEntityListList::ptr() const {
for ( it = list.begin(); it != list.end(); ++ it ) { for ( it = list.begin(); it != list.end(); ++ it ) {
const Argument* arg = *it; const Argument* arg = *it;
const ArgumentList* arg_list; const ArgumentList* arg_list;
if ((arg_list = dynamic_cast<const ArgumentList*>(arg))) { if ((arg_list = dynamic_cast<const ArgumentList*>(arg)) != 0) {
IfcEntityList::ptr e = *arg_list; IfcEntityList::ptr e = *arg_list;
l->push(e); l->push(e);
} }
@@ -732,7 +733,7 @@ TokenArgument::operator std::vector< std::vector<int> >() const { throw IfcExcep
TokenArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); } TokenArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
TokenArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); } TokenArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
unsigned int TokenArgument::size() const { return 1; } unsigned int TokenArgument::size() const { return 1; }
Argument* TokenArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of attributes"); } Argument* TokenArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of attributes"); }
std::string TokenArgument::toString(bool upper) const { std::string TokenArgument::toString(bool upper) const {
if ( upper && TokenFunc::isString(token) ) { if ( upper && TokenFunc::isString(token) ) {
return IfcWrite::IfcCharacterEncoder(TokenFunc::asString(token)); return IfcWrite::IfcCharacterEncoder(TokenFunc::asString(token));
@@ -764,7 +765,7 @@ EntityArgument::operator std::vector< std::vector<int> >() const { throw IfcExce
EntityArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); } EntityArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
EntityArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); } EntityArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
unsigned int EntityArgument::size() const { return 1; } unsigned int EntityArgument::size() const { return 1; }
Argument* EntityArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of arguments"); } Argument* EntityArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of arguments"); }
std::string EntityArgument::toString(bool upper) const { std::string EntityArgument::toString(bool upper) const {
return entity->entity->toString(upper); return entity->entity->toString(upper);
} }
@@ -1070,9 +1071,9 @@ void IfcFile::addEntities(IfcEntityList::ptr es) {
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) { IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
// If this instance has been inserted before, return // If this instance has been inserted before, return
// a reference to the copy that was created from it. // a reference to the copy that was created from it.
entity_entity_map_t::iterator it = entity_file_map.find(entity); entity_entity_map_t::iterator mit = entity_file_map.find(entity);
if (it != entity_file_map.end()) { if (mit != entity_file_map.end()) {
return it->second; return mit->second;
} }
// Obtain all forward references by a depth-first // Obtain all forward references by a depth-first
@@ -1272,8 +1273,8 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) {
// moment, inversely related instances affected by the removal of the // moment, inversely related instances affected by the removal of the
// entity being deleted are not deleted themselves. // entity being deleted are not deleted themselves.
if (references) { if (references) {
for (IfcEntityList::it it = references->begin(); it != references->end(); ++it) { for (IfcEntityList::it iit = references->begin(); iit != references->end(); ++iit) {
IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *it; IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *iit;
for (unsigned i = 0; i < related_instance->getArgumentCount(); ++i) { for (unsigned i = 0; i < related_instance->getArgumentCount(); ++i) {
Argument* attr = related_instance->getArgument(i); Argument* attr = related_instance->getArgument(i);
if (attr->isNull()) continue; if (attr->isNull()) continue;
@@ -1495,21 +1496,21 @@ std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitE
if (named_unit->UnitType() != type) { if (named_unit->UnitType() != type) {
continue; continue;
} }
IfcSchema::IfcSIUnit* unit = 0; IfcSchema::IfcSIUnit* siunit = 0;
if (named_unit->is(IfcSchema::Type::IfcConversionBasedUnit)) { if (named_unit->is(IfcSchema::Type::IfcConversionBasedUnit)) {
IfcSchema::IfcConversionBasedUnit* u = (IfcSchema::IfcConversionBasedUnit*)named_unit; IfcSchema::IfcConversionBasedUnit* u = (IfcSchema::IfcConversionBasedUnit*)named_unit;
IfcSchema::IfcMeasureWithUnit* mu = u->ConversionFactor(); IfcSchema::IfcMeasureWithUnit* mu = u->ConversionFactor();
return_value.second *= static_cast<double>(*mu->ValueComponent()->entity->getArgument(0)); return_value.second *= static_cast<double>(*mu->ValueComponent()->entity->getArgument(0));
return_value.first = named_unit; return_value.first = named_unit;
if (mu->UnitComponent()->is(IfcSchema::Type::IfcSIUnit)) { if (mu->UnitComponent()->is(IfcSchema::Type::IfcSIUnit)) {
unit = (IfcSchema::IfcSIUnit*) mu->UnitComponent(); siunit = (IfcSchema::IfcSIUnit*) mu->UnitComponent();
} }
} else if (named_unit->is(IfcSchema::Type::IfcSIUnit)) { } else if (named_unit->is(IfcSchema::Type::IfcSIUnit)) {
return_value.first = unit = (IfcSchema::IfcSIUnit*) named_unit; return_value.first = siunit = (IfcSchema::IfcSIUnit*) named_unit;
} }
if (unit) { if (siunit) {
if (unit->hasPrefix()) { if (siunit->hasPrefix()) {
return_value.second *= IfcSIPrefixToValue(unit->Prefix()); return_value.second *= IfcSIPrefixToValue(siunit->Prefix());
} }
} }
} }
+5 -2
View File
@@ -29,6 +29,9 @@ class HeaderEntity : public IfcAbstractEntity {
private: private:
ArgumentList* _list; ArgumentList* _list;
const char * const _datatype; const char * const _datatype;
HeaderEntity(const HeaderEntity&); //N/A
HeaderEntity& operator =(const HeaderEntity&); //N/A
protected: protected:
HeaderEntity(const char * const datatype, IfcSpfLexer* lexer) HeaderEntity(const char * const datatype, IfcSpfLexer* lexer)
: _datatype(datatype), _list(0) : _datatype(datatype), _list(0)
@@ -65,7 +68,7 @@ public:
return (*_list)[i]; return (*_list)[i];
} }
IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) { IfcEntityList::ptr getInverse(IfcSchema::Type::Enum /*type*/, int /*attribute_index*/) {
return IfcEntityList::ptr(new IfcEntityList); return IfcEntityList::ptr(new IfcEntityList);
} }
@@ -81,7 +84,7 @@ public:
return (IfcSchema::Type::Enum) -1; return (IfcSchema::Type::Enum) -1;
} }
bool is(IfcSchema::Type::Enum v) const { bool is(IfcSchema::Type::Enum /*v*/) const {
return false; return false;
} }
+1 -1
View File
@@ -100,7 +100,7 @@ namespace IfcUtil {
unsigned int getArgumentCount() const; unsigned int getArgumentCount() const;
Argument* getArgument(unsigned int i) const; Argument* getArgument(unsigned int i) const;
const char* getArgumentName(unsigned int i) const; const char* getArgumentName(unsigned int i) const;
IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const { return IfcSchema::Type::UNDEFINED; } IfcSchema::Type::Enum getArgumentEntity(unsigned int /*i*/) const { return IfcSchema::Type::UNDEFINED; }
}; };
bool valid_binary_string(const std::string& s); bool valid_binary_string(const std::string& s);
+16 -15
View File
@@ -104,7 +104,6 @@ std::string IfcWritableEntity::toString(bool upper) const {
ss << dt << "("; ss << dt << "(";
for (std::map<int,Argument*>::const_iterator it = args.begin(); it != args.end(); ++ it) { for (std::map<int,Argument*>::const_iterator it = args.begin(); it != args.end(); ++ it) {
if ( it != args.begin() ) ss << ","; if ( it != args.begin() ) ss << ",";
const Argument* a = it->second;
ss << it->second->toString(upper); ss << it->second->toString(upper);
} }
ss << ")"; ss << ")";
@@ -140,7 +139,6 @@ void IfcWritableEntity::setArgument(int i) {
} }
void IfcWritableEntity::setArgument(int i, Argument* a) { void IfcWritableEntity::setArgument(int i, Argument* a) {
IfcWrite::IfcWriteArgument* wa = new IfcWrite::IfcWriteArgument(this);
IfcUtil::ArgumentType attr_type = a->type(); IfcUtil::ArgumentType attr_type = a->type();
switch(attr_type) { switch(attr_type) {
case IfcUtil::Argument_NULL: case IfcUtil::Argument_NULL:
@@ -182,7 +180,7 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
this->setArgument(i, attr_value); } this->setArgument(i, attr_value); }
break; break;
case IfcUtil::Argument_ENUMERATION: { case IfcUtil::Argument_ENUMERATION: {
IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, i); IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
std::string enum_literal = a->toString(); std::string enum_literal = a->toString();
// Remove leading and trailing '.' // Remove leading and trailing '.'
enum_literal = enum_literal.substr(1, enum_literal.size() - 2); enum_literal = enum_literal.substr(1, enum_literal.size() - 2);
@@ -291,27 +289,30 @@ void IfcWritableEntity::setArgument(int i,const std::vector< boost::dynamic_bits
class SizeVisitor : public boost::static_visitor<int> { class SizeVisitor : public boost::static_visitor<int> {
public: public:
int operator()(const boost::none_t& i) const { return -1; } int operator()(const boost::none_t& /*i*/) const { return -1; }
int operator()(const IfcWriteArgument::Derived& i) const { return -1; } int operator()(const IfcWriteArgument::Derived& /*i*/) const { return -1; }
int operator()(const int& i) const { return -1; } int operator()(const int& /*i*/) const { return -1; }
int operator()(const bool& i) const { return -1; } int operator()(const bool& /*i*/) const { return -1; }
int operator()(const double& i) const { return -1; } int operator()(const double& /*i*/) const { return -1; }
int operator()(const std::string& i) const { return -1; } int operator()(const std::string& /*i*/) const { return -1; }
int operator()(const boost::dynamic_bitset<>& i) const { return -1; } int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
int operator()(const std::vector<int>& i) const { return (int)i.size(); } int operator()(const std::vector<int>& i) const { return (int)i.size(); }
int operator()(const std::vector<double>& i) const { return (int)i.size(); } int operator()(const std::vector<double>& i) const { return (int)i.size(); }
int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); } int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); }
int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); } int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); }
int operator()(const std::vector<std::string>& i) const { return (int)i.size(); } int operator()(const std::vector<std::string>& i) const { return (int)i.size(); }
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); } int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); }
int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; } int operator()(const IfcWriteArgument::EnumerationReference& /*i*/) const { return -1; }
int operator()(const IfcUtil::IfcBaseClass* const& i) const { return -1; } int operator()(const IfcUtil::IfcBaseClass* const& /*i*/) const { return -1; }
int operator()(const IfcEntityList::ptr& i) const { return i->size(); } int operator()(const IfcEntityList::ptr& i) const { return i->size(); }
int operator()(const IfcEntityListList::ptr& i) const { return i->size(); } int operator()(const IfcEntityListList::ptr& i) const { return i->size(); }
}; };
class StringBuilderVisitor : public boost::static_visitor<void> { class StringBuilderVisitor : public boost::static_visitor<void> {
private: private:
StringBuilderVisitor(const StringBuilderVisitor&); //N/A
StringBuilderVisitor& operator =(const StringBuilderVisitor&); //N/A
std::ostringstream& data; std::ostringstream& data;
template <typename T> void serialize(const std::vector<T>& i) { template <typename T> void serialize(const std::vector<T>& i) {
data << "("; data << "(";
@@ -370,8 +371,8 @@ private:
public: public:
StringBuilderVisitor(std::ostringstream& stream, bool upper = false) StringBuilderVisitor(std::ostringstream& stream, bool upper = false)
: data(stream), upper(upper) {} : data(stream), upper(upper) {}
void operator()(const boost::none_t& i) { data << "$"; } void operator()(const boost::none_t& /*i*/) { data << "$"; }
void operator()(const IfcWriteArgument::Derived& i) { data << "*"; } void operator()(const IfcWriteArgument::Derived& /*i*/) { data << "*"; }
void operator()(const int& i) { data << i; } void operator()(const int& i) { data << i; }
void operator()(const bool& i) { data << (i ? ".T." : ".F."); } void operator()(const bool& i) { data << (i ? ".T." : ".F."); }
void operator()(const double& i) { data << format_double(i); } void operator()(const double& i) { data << format_double(i); }
@@ -501,7 +502,7 @@ IfcWriteArgument::operator std::vector< std::vector<int> >() const { return as<s
IfcWriteArgument::operator std::vector< std::vector<double> >() const { return as<std::vector< std::vector<double> > >(); } IfcWriteArgument::operator std::vector< std::vector<double> >() const { return as<std::vector< std::vector<double> > >(); }
IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; } IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; }
bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; } bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; }
Argument* IfcWriteArgument::operator [] (unsigned int i) const { throw IfcParse::IfcException("Invalid cast"); } Argument* IfcWriteArgument::operator [] (unsigned int /*i*/) const { throw IfcParse::IfcException("Invalid cast"); }
std::string IfcWriteArgument::toString(bool upper) const { std::string IfcWriteArgument::toString(bool upper) const {
std::ostringstream str; std::ostringstream str;
str.imbue(std::locale::classic()); str.imbue(std::locale::classic());
+9
View File
@@ -36,6 +36,15 @@
# include <time.h> # include <time.h>
# include <wchar.h> # include <wchar.h>
#endif #endif
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4127 4244 4702 4510 4512 4610)
# if _MSC_VER > 1800
# pragma warning(disable : 4456 4459)
# endif
#endif
// TODO add '# pragma warning(pop)' to the very end of the file
%} %}
%include "std_string.i" %include "std_string.i"
+11 -12
View File
@@ -14,22 +14,21 @@ the requirements for a successful execution. The script allows a few user-config
which are listed in the usage instructions. Either edit the script file or set these values before which are listed in the usage instructions. Either edit the script file or set these values before
running the script. running the script.
`build-deps.cmd` expects a CMake generator as `%1` and a build configuration type as `%2`. If the parameters `build-deps.cmd` expects a CMake generator as `%1` and a build configuration type (`RelWithDebInfo/Release/MinSizeRel/Debug`,
are not provided, the default values are used (`"Visual Studio 14 2015 Win64"` and `RelWithDebInfo` respectively). defaults to `RelWithDebInfo`) as `%2`. If the generator is not provided, the generator is deduced from the Visual Studio
A build type (`Build/Rebuild/Clean`) can be provided as `%3`, if wanted (defaults to `Build`). See `vs-cfg.cmd` environment variables. A build type (`Build/Rebuild/Clean`, defaults to `Build`) can be provided as `%3`. See `vs-cfg.cmd`
if you want to change the defaults. The batch file will create `deps\` and `deps-vs<VERSION>-<ARCHITECTURE>-installed\` if you wish to change the defaults. The batch file will create `deps\` and `deps-vs<VERSION>-<ARCHITECTURE>-installed\`
directories to the project root. Debug and release builds of the depedencies can co-exist by simply running directories to the project root. Debug and release builds of the depedencies can co-exist by simply running
`build-deps.cmd <GENERATOR> Debug` and `build-deps.cmd <GENERATOR> <Release|RelWithDebInfo|MinSizeRel>`. `build-deps.cmd <GENERATOR> Debug` and `build-deps.cmd <GENERATOR> <Release|RelWithDebInfo|MinSizeRel>`.
After the dependencies are build, execute `run-cmake.bat`. The batch file expects a CMake generator as After the dependencies are build, execute `run-cmake.bat`. The batch file expects always a CMake generator as `%1`
`%1` (if not provided, the same default value as above is used), or alternatively, if more parameters are provided, `%*` is passed for the CMake invokation, i.e., if one (if not provided, the same default value as above is used), and the rest of possible parameters are passed as is.
wants to pass custom build options, the generator must be passed also using CMake's syntax: **If you wish to use any library from a custom location, modify the paths in `run-cmake.bat` accordingly**. The batch
script will create a folder of form `build-vs<VERSION>-<ARCHITECTURE>\` which will contain the solution and project
files for Visual Studio.
`run-cmake.bat -G "Visual Studio 14 2015 Win64" -DBUILD_IFCPYTHON=0`. Note that building IfcOpenShell as 64-bit is recommended as many of real life IFC files has been observed to take
easily more than 2 GBs of RAM while converting.
The batch script will create a folder of form `build-vs<VERSION>-<ARCHITECTURE>\` which will contain the solution and project files for Visual Studio.
**If you wish to use any library from a custom location, modify the paths in run-cmake.bat
accordingly**.
After this, one can build the project using the `IfcOpenShell.sln` file in the build folder. Build the `INSTALL` project After this, one can build the project using the `IfcOpenShell.sln` file in the build folder. Build the `INSTALL` project
if wanted. The project will be installed to `installed-vs<VERSION>-<ARCHITECTURE>\` folder in the project's root if wanted. The project will be installed to `installed-vs<VERSION>-<ARCHITECTURE>\` folder in the project's root
+2 -1
View File
@@ -26,6 +26,7 @@ set PROJECT_NAME=IfcOpenShell
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
:: TODO Getting warning print in vs-cfg.cmd for missing build type although this script doesn't need it specified :: TODO Getting warning print in vs-cfg.cmd for missing build type although this script doesn't need it specified
call vs-cfg.cmd %1 call vs-cfg.cmd %1
IF NOT %ERRORLEVEL%==0 GOTO :Error
:: Read Python related variables from BuildDepsCache.txt :: Read Python related variables from BuildDepsCache.txt
for /f "delims== tokens=1,2" %%G in (BuildDepsCache-%TARGET_ARCH%.txt) do set %%G=%%H for /f "delims== tokens=1,2" %%G in (BuildDepsCache-%TARGET_ARCH%.txt) do set %%G=%%H
@@ -103,7 +104,7 @@ goto :Finish
:Error :Error
echo. echo.
cecho {0C}An error occurred! Aborting!" call %~dp0\utils\cecho.cmd 0 12 "An error occurred! Aborting!"
goto :Finish goto :Finish
:Finish :Finish
+51 -20
View File
@@ -19,6 +19,12 @@
:: This script initializes various Visual Studio -related environment variables needed for building :: This script initializes various Visual Studio -related environment variables needed for building
:: This batch file expects CMake generator as %1 and build configuration type as %2. :: This batch file expects CMake generator as %1 and build configuration type as %2.
:: If %1 is not provided, it is deduced from the VisualStudioVersion environment variable and from the location of cl.exe.
:: NOTE This batch file expects the generator string to be CMake 3.0.0 and newer format, i.e.
:: "Visual Studio 10 2010" instead of "Visual Studio 10". However, one can use this batch file
:: also with CMake 2 as the generator will be converted into the older format if necessary.
:: NOTE: The delayed environment variable expansion needs to be enabled before calling this. :: NOTE: The delayed environment variable expansion needs to be enabled before calling this.
@echo off @echo off
@@ -28,33 +34,46 @@ set GENERATOR=%1
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones? :: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
:: F.ex. "vs2013-32" and/or "vc14-64" :: F.ex. "vs2013-32" and/or "vc14-64"
:: TODO Print CMake and VS versions. Maybe in build-deps.cmd would be better than here.
:: Supported Visual Studio versions: :: Supported Visual Studio versions:
set GENERATORS[0]="Visual Studio 14 2015" set GENERATORS[0]="Visual Studio 9 2008 Win64"
set GENERATORS[1]="Visual Studio 14 2015 Win64" set GENERATORS[1]="Visual Studio 9 2008"
:: TODO Check CMake version and convert possible new format (>= 3.0) generator names set GENERATORS[2]="Visual Studio 10 2010 Win64"
:: to the old versions if using older CMake for VS <= 2013, set GENERATORS[3]="Visual Studio 10 2010"
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes set GENERATORS[4]="Visual Studio 11 2012 Win64"
set GENERATORS[2]="Visual Studio 12" set GENERATORS[5]="Visual Studio 11 2012"
set GENERATORS[3]="Visual Studio 12 Win64" set GENERATORS[6]="Visual Studio 12 2013 Win64"
set GENERATORS[4]="Visual Studio 11" set GENERATORS[7]="Visual Studio 12 2013"
set GENERATORS[5]="Visual Studio 11 Win64" set GENERATORS[8]="Visual Studio 14 2015 Win64"
set GENERATORS[6]="Visual Studio 10" set GENERATORS[9]="Visual Studio 14 2015"
set GENERATORS[7]="Visual Studio 10 Win64" set LAST_GENERATOR_IDX=9
set GENERATORS[8]="Visual Studio 9 2008"
set GENERATORS[9]="Visual Studio 9 2008 Win64"
set GENERATOR_DEFAULT=%GENERATORS[1]%
IF "!GENERATOR!"=="" ( REM Deduce desired architecture from the location of cl.exe
set GENERATOR=%GENERATOR_DEFAULT% where cl.exe | findstr /r /c:"amd64" >nul
call utils\cecho.cmd 0 14 "%~nx0: Warning: Generator not passed - using the default '`"%GENERATOR_DEFAULT%`'`t set START=%ERRORLEVEL%
set STEP=2
IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" (
set VC_VER=%VisualStudioVersion:.0=%
FOR /l %%i in (%START%,%STEP%,%LAST_GENERATOR_IDX%) DO (
REM http://stackoverflow.com/a/8758579
REM NOTE add space before VC_VER so that e.g. "12" doesn't match with "2012"
echo(!GENERATORS[%%i]! | findstr /r /c:" !VC_VER!" >nul && (
set GENERATOR=!GENERATORS[%%i]!
call utils\cecho.cmd black cyan "Generator not passed, but VisualStudioVersion=%VisualStudioVersion% environment variable detected:"
call utils\cecho.cmd black cyan "using '`"!GENERATOR!`'" as the generator."
GOTO :GeneratorValid
)
)
) )
FOR /l %%i in (0,1,9) DO ( FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
) )
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!" call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
echo Supported CMake generator strings:
FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
echo !GENERATORS[%%i]!
)
exit /b 1 exit /b 1
:GeneratorValid :GeneratorValid
@@ -82,6 +101,18 @@ FOR %%i IN (%GENERATOR_SPLIT%) DO (
) )
) )
:: Check CMake version and convert possible new format (>= 3.0) generator names to the old versions if using older CMake for VS <= 2013,
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
FOR /f "delims=" %%i in ('where cmake') DO set CMAKE_PATH=%%i
IF NOT "%CMAKE_PATH%"=="" (
FOR /f "delims=" %%i in ('cmake --version ^| findstr /C:"cmake version 3"') DO GOTO :CMake3AndNewer
)
:: CMake older than 3.0.0: convert new format generators to the old format (simple brute force for simplicity)
set GENERATOR=%GENERATOR: 2013=%
set GENERATOR=%GENERATOR: 2012=%
set GENERATOR=%GENERATOR: 2010=%
:CMake3AndNewer
:: VS project file extension is different on older VS versions :: VS project file extension is different on older VS versions
set VCPROJ_FILE_EXT=vcxproj set VCPROJ_FILE_EXT=vcxproj
IF %VS_VER%==2008 set VCPROJ_FILE_EXT=vcproj IF %VS_VER%==2008 set VCPROJ_FILE_EXT=vcproj