| 45 | static int i = 0; |
| 46 | |
| 47 | void create_testcase_for(IfcHierarchyHelper<IfcSchema>& file, const EllipsePie& pie, IfcSchema::IfcTrimmingPreference pref) { |
| 48 | const double deg = 1. / 180. * 3.141592653; |
| 49 | double flt1[] = {0. , 0. }; |
| 50 | double flt2[] = {pie.r1 * cos(pie.t1*deg), pie.r2 * sin(pie.t1*deg)}; |
| 51 | double flt3[] = {pie.r1 * cos(pie.t2*deg), pie.r2 * sin(pie.t2*deg)}; |
| 52 | |
| 53 | std::vector<double> coords1(flt1, flt1 + 2); |
| 54 | std::vector<double> coords2(flt2, flt2 + 2); |
| 55 | std::vector<double> coords3(flt3, flt3 + 2); |
| 56 | |
| 57 | Ifc2x3::IfcCartesianPoint* p1 = new Ifc2x3::IfcCartesianPoint(coords1); |
| 58 | Ifc2x3::IfcCartesianPoint* p2 = new Ifc2x3::IfcCartesianPoint(coords2); |
| 59 | Ifc2x3::IfcCartesianPoint* p3 = new Ifc2x3::IfcCartesianPoint(coords3); |
| 60 | |
| 61 | Ifc2x3::IfcCartesianPoint::list::ptr points(new Ifc2x3::IfcCartesianPoint::list()); |
| 62 | points->push(p3); |
| 63 | points->push(p1); |
| 64 | points->push(p2); |
| 65 | file.addEntities(points->generalize()); |
| 66 | |
| 67 | |
| 68 | Ifc2x3::IfcEllipse* ellipse = new Ifc2x3::IfcEllipse(file.addPlacement2d(), pie.r1, pie.r2); |
| 69 | file.addEntity(ellipse); |
| 70 | aggregate_of_instance::ptr trim1(new aggregate_of_instance); |
| 71 | aggregate_of_instance::ptr trim2(new aggregate_of_instance); |
| 72 | if (pref == IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER) { |
| 73 | trim1->push(new Ifc2x3::IfcParameterValue(pie.t1)); |
| 74 | trim2->push(new Ifc2x3::IfcParameterValue(pie.t2)); |
| 75 | } else { |
| 76 | trim1->push(p2); |
| 77 | trim2->push(p3); |
| 78 | } |
| 79 | Ifc2x3::IfcTrimmedCurve* trim = new Ifc2x3::IfcTrimmedCurve(ellipse, trim1->as<IfcSchema::IfcTrimmingSelect>(), trim2->as<IfcSchema::IfcTrimmingSelect>(), true, pref); |
| 80 | file.addEntity(trim); |
| 81 | |
| 82 | Ifc2x3::IfcCompositeCurveSegment::list::ptr segments(new Ifc2x3::IfcCompositeCurveSegment::list()); |
| 83 | Ifc2x3::IfcCompositeCurveSegment* s2 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim); |
| 84 | |
| 85 | Ifc2x3::IfcPolyline* poly = new Ifc2x3::IfcPolyline(points); |
| 86 | file.addEntity(poly); |
| 87 | Ifc2x3::IfcCompositeCurveSegment* s1 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly); |
| 88 | segments->push(s1); |
| 89 | |
| 90 | segments->push(s2); |
| 91 | file.addEntities(segments->generalize()); |
| 92 | |
| 93 | Ifc2x3::IfcCompositeCurve* ccurve = new Ifc2x3::IfcCompositeCurve(segments, false); |
| 94 | Ifc2x3::IfcArbitraryClosedProfileDef* profile = new Ifc2x3::IfcArbitraryClosedProfileDef(Ifc2x3::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve); |
| 95 | file.addEntity(ccurve); |
| 96 | file.addEntity(profile); |
| 97 | |
| 98 | IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( |
| 99 | guid(), 0, S("profile"), null, null, 0, 0, null, null); |
| 100 | file.addBuildingProduct(product); |
| 101 | product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>()); |
| 102 | |
| 103 | product->setObjectPlacement(file.addLocalPlacement(0, 200 * i++)); |
| 104 |
no test coverage detected