| 36 | boost::none_t const null = boost::none; |
| 37 | |
| 38 | void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) { |
| 39 | IfcSchema::IfcProfileDef* profile = *profiles->begin(); |
| 40 | const std::string& profile_type = profile->declaration().name(); |
| 41 | const std::string filename = profile_type + ".ifc"; |
| 42 | |
| 43 | IfcHierarchyHelper<IfcSchema> file; |
| 44 | file.header().file_name()->setname(filename); |
| 45 | |
| 46 | int i = 0; |
| 47 | for (IfcSchema::IfcProfileDef::list::it it = profiles->begin(); it != profiles->end(); ++it, ++i) { |
| 48 | IfcSchema::IfcProfileDef* profile = *it; |
| 49 | IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( |
| 50 | guid(), 0, S("profile"), null, null, 0, 0, null, null); |
| 51 | file.addBuildingProduct(product); |
| 52 | file.getSingle<IfcSchema::IfcProject>()->setName(profile_type); |
| 53 | product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>()); |
| 54 | |
| 55 | product->setObjectPlacement(file.addLocalPlacement(0, 100. * i)); |
| 56 | |
| 57 | if (profile->declaration().is(IfcSchema::IfcParameterizedProfileDef::Class())) { |
| 58 | ((IfcSchema::IfcParameterizedProfileDef*) profile)->setPosition(file.addPlacement2d()); |
| 59 | } |
| 60 | |
| 61 | IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile, |
| 62 | file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0); |
| 63 | |
| 64 | file.addEntity(profile); |
| 65 | file.addEntity(solid); |
| 66 | |
| 67 | IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list); |
| 68 | IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list); |
| 69 | |
| 70 | items->push(solid); |
| 71 | IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation( |
| 72 | file.getSingle<IfcSchema::IfcRepresentationContext>(), S("Body"), S("SweptSolid"), items); |
| 73 | reps->push(rep); |
| 74 | |
| 75 | IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps); |
| 76 | file.addEntity(rep); |
| 77 | file.addEntity(shape); |
| 78 | |
| 79 | product->setRepresentation(shape); |
| 80 | } |
| 81 | |
| 82 | std::ofstream f(filename.c_str()); |
| 83 | f << file; |
| 84 | } |
| 85 | |
| 86 | int main(int argc, char** argv) { |
| 87 | IfcSchema::get_schema(); // Ensure schema is initialized |
no test coverage detected