Skip to content

Commit 9d5e6b0

Browse files
committed
Fixed bug where translation of the model would not be stored if no georeferencing data was present in ifc, changed projected roofoutline surface type
1 parent 549b4bc commit 9d5e6b0

File tree

6 files changed

+42
-23
lines changed

6 files changed

+42
-23
lines changed

GUI_code/Ext_GUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,8 @@ def makeUnitWindow(frame_location, unit_variable):
889889
Tooltip(toggle_make_obj, "If active output is copied to wavefront .OBJ file(s)")
890890
Tooltip(toggle_make_step, "If active output is copied to .STEP (ISO 10303) file(s)")
891891

892-
Tooltip(toggle_makefootprint, "If active a footprint will be created at the footprint elevation (lod0.0 0.2, 0.3 and 0.4 only)")
893-
Tooltip(toggle_makeroofprint, "If active a roof outline will be created (lod0.0 0.2, 0.3 and 0.4 only)")
892+
Tooltip(toggle_makefootprint, "If active a footprint will be created at the footprint elevation (lod0.0, 0.2, 0.3 and 0.4 only)")
893+
Tooltip(toggle_makeroofprint, "If active a roof outline will be created (lod0.0, 0.2, 0.3 and 0.4 only)")
894894
Tooltip(toggle_footprint_based, "If active the footprint will be used to restrict the output (LoD1.2, 1.3 & 2.2)")
895895
Tooltip(toggle_makeexterior, "If active exterior shells will be stored")
896896
Tooltip(toggle_makeinterior, "If active spaces will be stored (Lod0.2, 1.2, 2.2, 3.2 & voxels) and storey "

inc/DataManager.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,25 +1165,26 @@ void DataManager::getProjectionData(CJT::ObjectTransformation* transformation, C
11651165
IfcParse::IfcFile* fileObject = datacollection_[0]->getFilePtr();
11661166
#if defined(USE_IFC4) || defined(USE_IFC4x3)
11671167
IfcSchema::IfcMapConversion::list::ptr mapList = fileObject->instances_by_type<IfcSchema::IfcMapConversion>();
1168-
if (mapList->size() == 0) { return; }
1169-
if (mapList->size() > 1) {
1170-
ErrorCollection::getInstance().addError(ErrorID::warningIfcMultipleProjections);
1171-
std::cout << errorWarningStringEnum::getString(ErrorID::warningIfcMultipleProjections) << std::endl;
1172-
}
1173-
1174-
IfcSchema::IfcMapConversion* mapConversion = *(mapList->begin());
1175-
metaData->setReferenceSystem(mapConversion->TargetCRS()->Name());
1168+
if (mapList->size() != 0) {
1169+
if (mapList->size() > 1) {
1170+
ErrorCollection::getInstance().addError(ErrorID::warningIfcMultipleProjections);
1171+
std::cout << errorWarningStringEnum::getString(ErrorID::warningIfcMultipleProjections) << std::endl;
1172+
}
11761173

1177-
if (mapConversion->Scale().has_value())
1178-
{
1179-
std::array<double, 3> scaleCity = transformation->getScale();
1180-
double scaleIfc = mapConversion->Scale().get();
1174+
IfcSchema::IfcMapConversion* mapConversion = *(mapList->begin());
1175+
metaData->setReferenceSystem(mapConversion->TargetCRS()->Name());
11811176

1182-
for (size_t i = 0; i < scaleCity.size(); i++)
1177+
if (mapConversion->Scale().has_value())
11831178
{
1184-
scaleCity[i] = scaleCity[i] * scaleIfc;
1179+
std::array<double, 3> scaleCity = transformation->getScale();
1180+
double scaleIfc = mapConversion->Scale().get();
1181+
1182+
for (size_t i = 0; i < scaleCity.size(); i++)
1183+
{
1184+
scaleCity[i] = scaleCity[i] * scaleIfc;
1185+
}
1186+
transformation->setScale(scaleCity);
11851187
}
1186-
transformation->setScale(scaleCity);
11871188
}
11881189
gp_XYZ invertedObjectTrsf = objectIfcTranslation_.TranslationPart();
11891190

inc/cjCreator.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,16 +2438,18 @@ std::vector< CJT::GeoObject> CJGeoCreator::makeLoD00(DataManager* h, CJT::Kernel
24382438
if (settingsCollection.makeRoofPrint())
24392439
{
24402440
double roofOutlineHeight = footprintHeight;
2441+
std::string surfaceType = CJObjectEnum::getString(CJObjectID::CJTTypeProjectedRoofOutline);
24412442
if (settingsCollection.makeFootPrint())
24422443
{
24432444
roofOutlineHeight = urr.Z();
2445+
surfaceType = CJObjectEnum::getString(CJObjectID::CJTypeRoofSurface);
24442446
}
24452447
TopoDS_Shape roofShape = helperFunctions::createHorizontalFace(lll, urr, -rotationAngle, roofOutlineHeight);
24462448
faceCopyCollection.emplace_back(roofShape);
24472449

24482450
CJT::GeoObject geoObject = kernel->convertToJSON(roofShape, "0.0");
24492451
std::map<std::string, std::string> semanticData;
2450-
semanticData.emplace(CJObjectEnum::getString(CJObjectID::CJType), CJObjectEnum::getString(CJObjectID::CJTypeRoofSurface));
2452+
semanticData.emplace(CJObjectEnum::getString(CJObjectID::CJType), surfaceType);
24512453
geoObject.appendSurfaceData(semanticData);
24522454
geoObject.appendSurfaceTypeValue(0);
24532455
geoObjectCollection.emplace_back(geoObject);
@@ -2521,12 +2523,12 @@ std::vector< CJT::GeoObject> CJGeoCreator::makeLoD02(DataManager* h, CJT::Kernel
25212523

25222524
std::vector< CJT::GeoObject> geoObjectCollection;
25232525

2524-
std::map<std::string, std::string> semanticRoofData;
2525-
semanticRoofData.emplace(CJObjectEnum::getString(CJObjectID::CJType), CJObjectEnum::getString(CJObjectID::CJTypeRoofSurface));
2526+
25262527
std::map<std::string, std::string> semanticFootData;
25272528
semanticFootData.emplace(CJObjectEnum::getString(CJObjectID::CJType), CJObjectEnum::getString(CJObjectID::CJTypeGroundSurface));
25282529

25292530
gp_Pnt urr = h->getUrrPoint();
2531+
double footprintHeight = settingCollection.footprintElevation() + h->getObjectTranslation().TranslationPart().Z();
25302532

25312533
std::vector<TopoDS_Shape> faceCopyCollection;
25322534
if (settingCollection.makeRoofPrint())
@@ -2538,10 +2540,22 @@ std::vector< CJT::GeoObject> CJGeoCreator::makeLoD02(DataManager* h, CJT::Kernel
25382540

25392541
gp_Trsf trsf;
25402542
trsf.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Vec(0, 0, 1)), -settingCollection.gridRotation());
2541-
if (hasFootprints_) { trsf.SetTranslationPart(gp_Vec(0, 0, urr.Z())); }
2543+
2544+
std::map<std::string, std::string> semanticRoofData;
2545+
2546+
std::string surfaceType = CJObjectEnum::getString(CJObjectID::CJTTypeProjectedRoofOutline);
2547+
if (hasFootprints_) {
2548+
surfaceType = CJObjectEnum::getString(CJObjectID::CJTypeRoofSurface);
2549+
trsf.SetTranslationPart(gp_Vec(0, 0, urr.Z()));
2550+
}
2551+
else
2552+
{
2553+
trsf.SetTranslationPart(gp_Vec(0, 0, footprintHeight));
2554+
}
25422555
roofOutline.Move(trsf);
25432556
faceCopyCollection.emplace_back(roofOutline);
25442557

2558+
semanticRoofData.emplace(CJObjectEnum::getString(CJObjectID::CJType), surfaceType);
25452559
CJT::GeoObject geoObject = kernel->convertToJSON(roofOutline, "0.2");
25462560
geoObject.appendSurfaceData(semanticRoofData);
25472561
geoObject.appendSurfaceTypeValue(0);

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_IFC2x3
22
#define iterationVersion "0.2.6"
33

44
#ifdef USE_IFC2x3

inc/stringManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,9 @@ std::string CJObjectEnum::getString(CJObjectID id)
666666
case CJObjectID::CJTTypeCeilingSurface:
667667
return "CeilingSurface";
668668
case CJObjectID::CJTTypeOuterCeilingSurface:
669-
return "OuterCeilingSurface";
669+
return "OuterCeilingSurface";
670+
case CJObjectID::CJTTypeProjectedRoofOutline:
671+
return "+projectedRoofOutline";
670672
case CJObjectID::CJAttHasWindow:
671673
return "+hasWindows";
672674

inc/stringManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ enum class CJObjectID {
268268
CJTTypeCeilingSurface,
269269
CJTTypeOuterCeilingSurface,
270270

271+
CJTTypeProjectedRoofOutline,
272+
271273
CJAttHasWindow,
272274

273275
True,

0 commit comments

Comments
 (0)