@@ -4008,22 +4008,24 @@ std::vector<CJT::GeoObject> CJGeoCreator::makeLoDe0(DataManager* h, CJT::Kernel*
40084008 SettingsCollection& settingsCollection = SettingsCollection::getInstance ();
40094009 std::cout << CommunicationStringEnum::getString (CommunicationStringID::infoComputingLoDe0) << std::endl;
40104010 auto startTime = std::chrono::steady_clock::now ();
4011-
4012- if (storeyObjects_.empty ()){makeStoreyObjects (h);}
40134011 finishedLoDe0_ = true ;
40144012
4015- std::vector< CJT::GeoObject> geoObjectList; // final output collection
4013+ gp_Trsf localRotationTrsf;
4014+ localRotationTrsf.SetRotation (gp_Ax1 (gp_Pnt (0 , 0 , 0 ), gp_Vec (0 , 0 , 1 )), -settingsCollection.gridRotation ());
40164015
4016+ std::vector< CJT::GeoObject> geoObjectList; // final output collection
40174017 auto spatialIndx = h->getIndexPointer ();
4018-
4018+
4019+ std::vector<TopoDS_Shape> collectionShape;
40194020 for (auto it = spatialIndx->begin (); it != spatialIndx->end (); ++ it)
40204021 {
40214022 Value test = *it;
40224023 std::shared_ptr<IfcProductSpatialData> lookup = h->getLookup (test.second );
40234024 TopoDS_Shape currentShape = lookup->getProductShape ();
40244025 if (currentShape.IsNull ()) { continue ; }
4026+ currentShape.Move (localRotationTrsf);
4027+
40254028
4026- CJT::GeoObject geoObject = kernel->convertToJSON (currentShape, " 4.0" );
40274029 IfcSchema::IfcProduct* currentProduct = lookup->getProductPtr ();
40284030
40294031 nlohmann::json attributeMap;
@@ -4034,56 +4036,29 @@ std::vector<CJT::GeoObject> CJGeoCreator::makeLoDe0(DataManager* h, CJT::Kernel*
40344036 }
40354037
40364038 int faceCount = 0 ;
4037- for (TopExp_Explorer explorer (currentShape, TopAbs_FACE); explorer.More (); explorer.Next ()) { faceCount++; }
4039+ for (TopExp_Explorer explorer (currentShape, TopAbs_FACE); explorer.More (); explorer.Next ())
4040+ {
4041+ faceCount++;
4042+ }
40384043 std::vector<int >TypeValueList (faceCount, 0 );
40394044
4045+ CJT::GeoObject geoObject = kernel->convertToJSON (currentShape, " 4.0" );
40404046 geoObject.setSurfaceTypeValues (TypeValueList);
40414047 geoObject.appendSurfaceData (attributeMap);
40424048 geoObjectList.emplace_back (geoObject);
4043- }
4044-
4045-
4046-
40474049
4048-
4049- /* for (const std::shared_ptr<CJT::CityObject>& storeyObject : storeyObjects_)
4050+ collectionShape.emplace_back (currentShape);
4051+ }
4052+ if (settingsCollection.createOBJ ())
40504053 {
4051- std::vector<std::string> storeyGuidList = storeyObject->getAttributes()["IFC Guid"];
4052- std::vector< IfcSchema::IfcBuildingStorey*> ifcStoreyList = fetchStoreyObjects(h, storeyGuidList);
4053-
4054- for (IfcSchema::IfcBuildingStorey* currentStorey : ifcStoreyList)
4055- {
4056- IfcSchema::IfcRelContainedInSpatialStructure::list::ptr containedStructure = currentStorey->ContainsElements()->as<IfcSchema::IfcRelContainedInSpatialStructure>();
4057- for (auto csit = containedStructure->begin(); csit != containedStructure->end(); ++csit)
4058- {
4059- IfcSchema::IfcProduct::list::ptr storeyRelatedProducts = (*csit)->RelatedElements();
4060- for (auto srit = storeyRelatedProducts->begin(); srit != storeyRelatedProducts->end(); ++srit)
4061- {
4062- IfcSchema::IfcProduct* currentProduct = *srit;
4063- TopoDS_Shape currentShape = h->getObjectShapeFromMem(currentProduct, true);
4064-
4065- if (currentShape.IsNull()) { continue; }
4066- CJT::GeoObject geoObject = kernel->convertToJSON(currentShape, "4.0");
4067-
4068- nlohmann::json attributeMap;
4069- attributeMap[CJObjectEnum::getString(CJObjectID::CJType)] = "+" + currentProduct->data().type()->name();
4070- nlohmann::json attributeList = h->collectPropertyValues(currentProduct->GlobalId());
4071- for (auto jsonObIt = attributeList.begin(); jsonObIt != attributeList.end(); ++jsonObIt) {
4072- attributeMap[sourceIdentifierEnum::getString(sourceIdentifierID::ifc) + jsonObIt.key()] = jsonObIt.value();
4073- }
4074-
4075- int faceCount = 0;
4076- for (TopExp_Explorer explorer(currentShape, TopAbs_FACE); explorer.More(); explorer.Next()) { faceCount++; }
4077- std::vector<int>TypeValueList(faceCount, 0);
4054+ helperFunctions::writeToOBJ (collectionShape, settingsCollection.getOutputBasePath () + fileExtensionEnum::getString (fileExtensionID::OBJLoDe0));
4055+ }
40784056
4079- geoObject.setSurfaceTypeValues(TypeValueList);
4080- geoObject.appendSurfaceData(attributeMap);
4081- geoObjectList.emplace_back(geoObject);
4082- }
4083- }
4084- }
4057+ if (settingsCollection.createSTEP ())
4058+ {
4059+ helperFunctions::writeToSTEP (collectionShape, settingsCollection.getOutputBasePath () + fileExtensionEnum::getString (fileExtensionID::STEPLoDe0));
40854060 }
4086- */
4061+
40874062 printTime (startTime, std::chrono::steady_clock::now ());
40884063 garbageCollection ();
40894064 return geoObjectList;
0 commit comments