| 320 | } |
| 321 | |
| 322 | Ifc4x3_add2::IfcAlignment* addAlignment(IfcHierarchyHelper<Ifc4x3_add2>& file, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii, const std::vector<std::pair<double, double>>& vpoints, const std::vector<double>& vclengths,bool include_geometry) { |
| 323 | auto [horizontal_segments, horizontal_curve_segments, composite_curve] = _createHorizontalAlignment(file, points, radii, include_geometry); |
| 324 | auto [vertical_segments, vertical_curve_segments, gradient_curve] = _createVerticalAlignment(file, composite_curve, vpoints, vclengths, include_geometry); |
| 325 | |
| 326 | _name_segments("H", horizontal_segments); |
| 327 | _name_segments("V", vertical_segments); |
| 328 | |
| 329 | // |
| 330 | // Create the horizontal alignment (IfcAlignmentHorizontal) and nest the segments |
| 331 | // |
| 332 | auto horizontal_alignment = new Ifc4x3_add2::IfcAlignmentHorizontal(IfcParse::IfcGlobalId(), nullptr, alignment_name + std::string(" - Horizontal"), boost::none, boost::none, nullptr, nullptr); |
| 333 | file.addEntity(horizontal_alignment); |
| 334 | |
| 335 | auto nests_horizontal_segments = new Ifc4x3_add2::IfcRelNests(IfcParse::IfcGlobalId(), nullptr, boost::none, std::string("Nests horizontal alignment segments with horizontal alignment"), horizontal_alignment, horizontal_segments); |
| 336 | file.addEntity(nests_horizontal_segments); |
| 337 | |
| 338 | // |
| 339 | // Create the vertical alignment (IfcAlignmentVertical) and nest the segments |
| 340 | // |
| 341 | auto vertical_profile = new Ifc4x3_add2::IfcAlignmentVertical(IfcParse::IfcGlobalId(), nullptr, alignment_name + std::string("- Vertical"), boost::none, boost::none, nullptr, nullptr); |
| 342 | file.addEntity(vertical_profile); |
| 343 | |
| 344 | auto nests_vertical_segments = new Ifc4x3_add2::IfcRelNests(IfcParse::IfcGlobalId(), nullptr, boost::none, std::string("Nests vertical alignment segments with vertical alignment"), vertical_profile, vertical_segments); |
| 345 | file.addEntity(nests_vertical_segments); |
| 346 | |
| 347 | Ifc4x3_add2::IfcLocalPlacement* placement = nullptr; |
| 348 | Ifc4x3_add2::IfcProductDefinitionShape* product_definition_shape = nullptr; |
| 349 | if (include_geometry) { |
| 350 | auto axis_model_representation_subcontext = file.getRepresentationSubContext("Axis", "Model"); |
| 351 | |
| 352 | // the composite curve is a representation item |
| 353 | typename aggregate_of<Ifc4x3_add2::IfcRepresentationItem>::ptr alignment_representation_items(new aggregate_of<Ifc4x3_add2::IfcRepresentationItem>()); |
| 354 | alignment_representation_items->push(composite_curve); |
| 355 | |
| 356 | // the gradient curve is a representation item |
| 357 | typename aggregate_of<typename Ifc4x3_add2::IfcRepresentationItem>::ptr profile_representation_items(new aggregate_of<Ifc4x3_add2::IfcRepresentationItem>()); |
| 358 | profile_representation_items->push(gradient_curve); |
| 359 | |
| 360 | // create footprint representation |
| 361 | auto footprint_shape_representation = new Ifc4x3_add2::IfcShapeRepresentation(axis_model_representation_subcontext, std::string("FootPrint"), std::string("Curve2D"), alignment_representation_items); |
| 362 | file.addEntity(footprint_shape_representation); |
| 363 | |
| 364 | // create the axis representation |
| 365 | auto axis3d_shape_representation = new Ifc4x3_add2::IfcShapeRepresentation(axis_model_representation_subcontext, std::string("Axis"), std::string("Curve3D"), profile_representation_items); |
| 366 | file.addEntity(axis3d_shape_representation); |
| 367 | |
| 368 | // create axis representations for each segment |
| 369 | placement = file.addLocalPlacement(); |
| 370 | _createSegmentRepresentations(file, placement, axis_model_representation_subcontext, horizontal_curve_segments, horizontal_segments); |
| 371 | _createSegmentRepresentations(file, placement, axis_model_representation_subcontext, vertical_curve_segments, vertical_segments); |
| 372 | |
| 373 | // the alignment has a 3d curve representation |
| 374 | typename aggregate_of<typename Ifc4x3_add2::IfcRepresentation>::ptr alignment_representations(new aggregate_of<Ifc4x3_add2::IfcRepresentation>()); |
| 375 | alignment_representations->push(footprint_shape_representation); // 2D curve |
| 376 | alignment_representations->push(axis3d_shape_representation); // 3D curve |
| 377 | |
| 378 | // create the alignment product definition |
| 379 | product_definition_shape = new Ifc4x3_add2::IfcProductDefinitionShape(std::string("Alignment Product Definition Shape"), boost::none, alignment_representations); |
no test coverage detected