diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index b58f21fa8b..f54136a6c8 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -39,7 +39,6 @@ #include #include -#include #include #include @@ -400,7 +399,12 @@ int main(int argc, char** argv) return EXIT_FAILURE; } - ///@ todo Logger::Message(Logger::LOG_NOTICE, "Filtering by X, Y and Z.") + if (!entity_filter.values.empty()) { entity_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, entity_filter.description); } + if (!layer_filter.values.empty()) { layer_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, layer_filter.description); } + if (!guid_filter.values.empty()) { guid_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, guid_filter.description); } + if (!name_filter.values.empty()) { name_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, name_filter.description); } + if (!desc_filter.values.empty()) { desc_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, desc_filter.description); } + if (!tag_filter.values.empty()) { tag_filter.update_description(); Logger::Message(Logger::LOG_NOTICE, tag_filter.description); } if (output_extension == ".xml") { int exit_code = 1; @@ -677,9 +681,6 @@ std::vector setup_filters( entities.insert("IfcOpeningElement"); } entity_filter.populate(entities); - - Logger::Message(Logger::LOG_NOTICE, entity_filter.include ? "Including" : "Excluding" + - std::string(" by default entities ") + boost::algorithm::join(entities, ", ")); } } catch (const IfcParse::IfcException& e) { std::cerr << "[Error] " << e.what() << std::endl; diff --git a/src/ifcgeom/IfcGeomFilter.h b/src/ifcgeom/IfcGeomFilter.h index e64914717b..7ffd16719c 100644 --- a/src/ifcgeom/IfcGeomFilter.h +++ b/src/ifcgeom/IfcGeomFilter.h @@ -24,9 +24,7 @@ #define IFCGEOMFILTER_H #include "IfcGeom.h" -#ifndef NDEBUG #include "../ifcparse/IfcWritableEntity.h" -#endif #include #include @@ -51,6 +49,8 @@ namespace IfcGeom /// If traversal requested, traverse to the parents to see if they satisfy the criteria. E.g. we might be looking for /// children of a storey named "Level 20", or children of entities that have no representation, e.g. IfcCurtainWall. bool traverse; + /// Optional description for the filtering criteria of this filter. + std::string description; bool match(IfcSchema::IfcProduct* prod, const filter_t& pred) const { @@ -171,6 +171,29 @@ namespace IfcGeom // @note bind1st() and mem_fun() deprecated in C++11, use bind() and mem_fn() when migrating to C++11. return filter::match(prod, std::bind1st(std::mem_fun(&string_arg_filter::match), this)); } + + void update_description() + { + std::stringstream ss; + + ss << (traverse ? "traverse " : "") << (include ? "include" : "exclude"); + std::vector patterns; + foreach(const boost::regex& r, values) { + patterns.push_back(" \"" + r.str() + "\""); + } + + for (arg_map_t::const_iterator it = args.begin(); it != args.end(); ++it) { + IfcWrite::IfcWritableEntity dummy(it->first); + IfcUtil::IfcBaseClass* base = IfcSchema::SchemaEntity(&dummy); + try { + ss << " " << IfcSchema::Type::ToString(it->first) << "." << base->getArgumentName(it->second); + } catch(...) {} + delete base; + } + + ss << " values " << boost::algorithm::join(patterns, " "); + description = ss.str(); + } }; struct layer_filter : public wildcard_filter @@ -204,6 +227,18 @@ namespace IfcGeom std::set patterns; }; + + void update_description() + { + std::stringstream ss; + ss << (traverse ? "traverse " : "") << (include ? "include" : "exclude") << " layers"; + std::vector str_values; + foreach(const boost::regex& r, values) { + str_values.push_back(" \"" + r.str() + "\""); + } + ss << " " << boost::algorithm::join(str_values, " "); + description = ss.str(); + } }; struct entity_filter : public filter @@ -247,6 +282,16 @@ namespace IfcGeom { return filter::match(prod, std::bind1st(std::mem_fun(&entity_filter::match), this)); } + + void update_description() + { + std::stringstream ss; + ss << (traverse ? "traverse " : "") << (include ? "include" : "exclude") << " entities"; + foreach(IfcSchema::Type::Enum type, values) { + ss << " " << IfcSchema::Type::ToString(type); + } + description = ss.str(); + } }; }