Skip to content

Commit 1707a0f

Browse files
committed
Simplefied 1:1 conversion code to avoid nesting issues
1 parent 66739b7 commit 1707a0f

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

inc/cjCreator.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4013,7 +4013,40 @@ std::vector<CJT::GeoObject> CJGeoCreator::makeLoDe0(DataManager* h, CJT::Kernel*
40134013
finishedLoDe0_ = true;
40144014

40154015
std::vector< CJT::GeoObject> geoObjectList; // final output collection
4016-
for (const std::shared_ptr<CJT::CityObject>& storeyObject: storeyObjects_)
4016+
4017+
auto spatialIndx = h->getIndexPointer();
4018+
4019+
for (auto it = spatialIndx->begin(); it != spatialIndx->end(); ++ it)
4020+
{
4021+
Value test = *it;
4022+
std::shared_ptr<IfcProductSpatialData> lookup = h->getLookup(test.second);
4023+
TopoDS_Shape currentShape = lookup->getProductShape();
4024+
if (currentShape.IsNull()) { continue; }
4025+
4026+
CJT::GeoObject geoObject = kernel->convertToJSON(currentShape, "4.0");
4027+
IfcSchema::IfcProduct* currentProduct = lookup->getProductPtr();
4028+
4029+
nlohmann::json attributeMap;
4030+
attributeMap[CJObjectEnum::getString(CJObjectID::CJType)] = "+" + currentProduct->data().type()->name();
4031+
nlohmann::json attributeList = h->collectPropertyValues(currentProduct->GlobalId());
4032+
for (auto jsonObIt = attributeList.begin(); jsonObIt != attributeList.end(); ++jsonObIt) {
4033+
attributeMap[sourceIdentifierEnum::getString(sourceIdentifierID::ifc) + jsonObIt.key()] = jsonObIt.value();
4034+
}
4035+
4036+
int faceCount = 0;
4037+
for (TopExp_Explorer explorer(currentShape, TopAbs_FACE); explorer.More(); explorer.Next()) { faceCount++; }
4038+
std::vector<int>TypeValueList(faceCount, 0);
4039+
4040+
geoObject.setSurfaceTypeValues(TypeValueList);
4041+
geoObject.appendSurfaceData(attributeMap);
4042+
geoObjectList.emplace_back(geoObject);
4043+
}
4044+
4045+
4046+
4047+
4048+
4049+
/*for (const std::shared_ptr<CJT::CityObject>& storeyObject : storeyObjects_)
40174050
{
40184051
std::vector<std::string> storeyGuidList = storeyObject->getAttributes()["IFC Guid"];
40194052
std::vector< IfcSchema::IfcBuildingStorey*> ifcStoreyList = fetchStoreyObjects(h, storeyGuidList);
@@ -4050,6 +4083,7 @@ std::vector<CJT::GeoObject> CJGeoCreator::makeLoDe0(DataManager* h, CJT::Kernel*
40504083
}
40514084
}
40524085
}
4086+
*/
40534087
printTime(startTime, std::chrono::steady_clock::now());
40544088
garbageCollection();
40554089
return geoObjectList;

inc/helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define USE_IFC4x3
1+
#define USE_IFC4
22
#define iterationVersion "0.2.5"
33

44
#ifdef USE_IFC2x3

0 commit comments

Comments
 (0)