MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / addHorizontalAlignment

Function addHorizontalAlignment

src/ifcparse/IfcAlignmentHelper.cpp:181–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181Ifc4x3_add2::IfcAlignment* addHorizontalAlignment(IfcHierarchyHelper<Ifc4x3_add2>& file, const std::string& alignment_name, const std::vector<std::pair<double, double>>& points, const std::vector<double>& radii,bool include_geometry) {
182
183 auto [horizontal_segments, horizontal_curve_segments, composite_curve] = _createHorizontalAlignment(file, points, radii, include_geometry);
184 _name_segments("H", horizontal_segments);
185
186 //
187 // Create the horizontal alignment (IfcAlignmentHorizontal) and nest alignment segments
188 //
189 auto horizontal_alignment = new Ifc4x3_add2::IfcAlignmentHorizontal(IfcParse::IfcGlobalId(), nullptr, alignment_name + std::string(" - Horizontal"), boost::none, boost::none, nullptr, nullptr);
190 file.addEntity(horizontal_alignment);
191
192 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);
193 file.addEntity(nests_horizontal_segments);
194
195 //
196 // Create geometric representation
197 //
198 Ifc4x3_add2::IfcLocalPlacement* placement = nullptr;
199 Ifc4x3_add2::IfcProductDefinitionShape* product_definition_shape = nullptr;
200 if (include_geometry) {
201 typename aggregate_of<Ifc4x3_add2::IfcRepresentationItem>::ptr alignment_representation_items(new aggregate_of<Ifc4x3_add2::IfcRepresentationItem>());
202 alignment_representation_items->push(composite_curve);
203
204 // create the footprint representation
205 auto axis_model_representation_subcontext = file.getRepresentationSubContext("Axis", "Model");
206 auto footprint_shape_representation = new Ifc4x3_add2::IfcShapeRepresentation(axis_model_representation_subcontext, std::string("FootPrint"), std::string("Curve2D"), alignment_representation_items);
207 file.addEntity(footprint_shape_representation);
208
209 placement = file.addLocalPlacement();
210
211 // the alignment has a plan view footprint representation
212 typename aggregate_of<Ifc4x3_add2::IfcRepresentation>::ptr alignment_representations(new aggregate_of<Ifc4x3_add2::IfcRepresentation>());
213 alignment_representations->push(footprint_shape_representation); // 2D footprint
214
215 // create the alignment product definition
216 product_definition_shape = new Ifc4x3_add2::IfcProductDefinitionShape(std::string("Alignment Product Definition Shape"), boost::none, alignment_representations);
217
218 // create representations for each segment
219 _createSegmentRepresentations(file, placement, axis_model_representation_subcontext, horizontal_curve_segments, horizontal_segments);
220 }
221
222 // create the alignment
223 auto alignment = new Ifc4x3_add2::IfcAlignment(IfcParse::IfcGlobalId(), nullptr, alignment_name, boost::none, boost::none, placement, product_definition_shape, boost::none);
224 file.addEntity(alignment);
225
226
227 return alignment;
228}
229
230std::tuple<typename aggregate_of<Ifc4x3_add2::IfcObjectDefinition>::ptr, typename aggregate_of<Ifc4x3_add2::IfcSegment>::ptr, Ifc4x3_add2::IfcGradientCurve*> _createVerticalAlignment(IfcHierarchyHelper<Ifc4x3_add2>& file, Ifc4x3_add2::IfcCompositeCurve* composite_curve,const std::vector<std::pair<double, double>>& vpoints, const std::vector<double>& vclengths, bool include_geometry) {
231 typename aggregate_of<Ifc4x3_add2::IfcObjectDefinition>::ptr vertical_segments(new aggregate_of<Ifc4x3_add2::IfcObjectDefinition>()); // business logic

Callers

nothing calls this directly

Calls 7

_name_segmentsFunction · 0.85
addEntityMethod · 0.80
addLocalPlacementMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected