diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 45b45f2489..63926249d1 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -374,6 +374,8 @@ int main(int argc, char** argv) { "Creates SVG cross section drawings automatically based on model extents") ("auto-elevation", "Creates SVG elevation drawings automatically based on model extents") + ("svg-xmlns", + "Stores name and guid in a separate namespace as opposed to data-name, data-guid") ("door-arcs", "Draw door openings arcs for IfcDoor elements") ("section-height", po::value(§ion_height), "Specifies the cut section height for SVG 2D geometry.") @@ -956,6 +958,7 @@ int main(int argc, char** argv) { if (vmap.count("auto-elevation")) { static_cast(serializer.get())->setAutoElevation(true); } + static_cast(serializer.get())->setUseNamespace(vmap.count("svg-xmlns") > 0); if (relative_center_x && relative_center_y) { static_cast(serializer.get())->setDrawingCenter(*relative_center_x, *relative_center_y); } diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index 34162ba013..1d2381436d 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -1093,7 +1093,7 @@ void SvgSerializer::finalize() { } else { auto n = it->first.second; IfcUtil::escape_xml(n); - svg_file << " \n"; + svg_file << " \n"; } } svg_file << " second.first << ">\n"; @@ -1113,6 +1113,9 @@ void SvgSerializer::finalize() { void SvgSerializer::writeHeader() { svg_file << "type()}, - {"data-name", n}, - {"data-guid", elem->guid()} + {namespace_prefix_ + "name", n}, + {namespace_prefix_ + "guid", elem->guid()} }); } @@ -1214,8 +1217,8 @@ std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* elem) { return nameElement_({ {"id", idElement(elem)}, {"class", entity}, - {"data-name", ifc_name}, - {"data-guid", *elem->get("GlobalId")} + {namespace_prefix_ + "name", ifc_name}, + {namespace_prefix_ + "guid", *elem->get("GlobalId")} }); } diff --git a/src/serializers/SvgSerializer.h b/src/serializers/SvgSerializer.h index 178e336e42..f483a69a47 100644 --- a/src/serializers/SvgSerializer.h +++ b/src/serializers/SvgSerializer.h @@ -121,6 +121,7 @@ protected: bool with_section_heights_from_storey_, rescale, print_space_names_, print_space_areas_; bool draw_door_arcs_, is_floor_plan_; bool auto_section_, auto_elevation_; + bool use_namespace_; IfcParse::IfcFile* file; IfcUtil::IfcBaseEntity* storey_; @@ -134,6 +135,8 @@ protected: std::list element_buffer_; Handle(HLRBRep_Algo) hlr; + + std::string namespace_prefix_; public: SvgSerializer(const std::string& out_filename, const SerializerSettings& settings) : GeometrySerializer(settings) @@ -150,11 +153,13 @@ public: , is_floor_plan_(true) , auto_section_(false) , auto_elevation_(false) + , use_namespace_(false) , file(0) , storey_(0) , xcoords_begin(0) , ycoords_begin(0) , radii_begin(0) + , namespace_prefix_("data-") {} void addXCoordinate(const boost::shared_ptr& fi) { xcoords.push_back(fi); } void addYCoordinate(const boost::shared_ptr& fi) { ycoords.push_back(fi); } @@ -197,6 +202,11 @@ public: auto_elevation_ = b; } + void setUseNamespace(bool b) { + use_namespace_ = b; + namespace_prefix_ = use_namespace_ ? "ifc:" : "data-"; + } + void setScale(double s) { scale_ = s; } void setDrawingCenter(double x, double y) { center_x_ = x; center_y_ = y;