support for IfcConvert -include=arg <Description|Tag> (for IfcElement.Tag, not yet for IfcProxy.Tag).

This commit is contained in:
Stinkfist0
2017-02-16 19:49:46 +02:00
committed by Thomas Krijnen
parent de5864fc72
commit 1b7d38a56d
3 changed files with 96 additions and 47 deletions
+9 -5
View File
@@ -24,7 +24,11 @@
#define IFCGEOMFILTER_H
#include "IfcGeom.h"
#include <boost/function.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/case_conv.hpp>
namespace IfcGeom
{
@@ -100,13 +104,13 @@ namespace IfcGeom
/// @todo Maybe not use template class for this after all. Attribute name would be better
/// than index, but IfcBaseClass doesn't have getArgument(name) (IfcLateBoundEntity would have though).
template<class ClassType, unsigned short ArgIndex, typename ArgType>
template<class IfcType, unsigned short ArgIndex, typename ArgType>
struct arg_filter : public wildcard_filter
{
arg_filter()
{
#ifndef NDEBUG
ClassType dummy(0);
IfcType dummy(0);
assert(ArgIndex < dummy.getArgumentCount());
#endif
}
@@ -114,7 +118,7 @@ namespace IfcGeom
: wildcard_filter(include, traverse, patterns)
{
#ifndef NDEBUG
ClassType dummy(0);
IfcType dummy(0);
assert(ArgIndex < dummy.getArgumentCount());
#endif
populate(patterns);
@@ -122,8 +126,8 @@ namespace IfcGeom
ArgType value(IfcSchema::IfcProduct* prod) const
{
Argument *arg = prod->entity->getArgument(ArgIndex);
return !arg->isNull() ? *arg : ArgType();
Argument *arg = prod->is(IfcType::Class()) ? prod->entity->getArgument(ArgIndex) : 0;
return arg && !arg->isNull() ? *arg : ArgType();
}
bool operator()(IfcSchema::IfcProduct* prod) const
+13 -2
View File
@@ -145,7 +145,18 @@ namespace IfcGeom {
}
}
/// @todo public/private sections all over the place: move all public to the beginning of the class
public:
Iterator(const IteratorSettings& settings, const std::string& filename, std::vector<filter_t>& filters)
: settings(settings)
, ifc_file(new IfcParse::IfcFile)
, owns_ifc_file(true)
, filters_(filters)
{
ifc_file->Init(filename);
_initialize();
}
bool initialize() {
try {
initUnits();
@@ -307,8 +318,8 @@ namespace IfcGeom {
IfcParse::IfcFile* getFile() const { return ifc_file; }
const std::vector<filter_t> &filters() const { return filters_; }
std::vector<filter_t> &filters() { return filters_; }
const std::vector<filter_t>& filters() const { return filters_; }
std::vector<filter_t>& filters() { return filters_; }
const gp_XYZ& bounds_min() const { return bounds_min_; }
const gp_XYZ& bounds_max() const { return bounds_max_; }