Skip to content

Further #1431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged

Further #1431

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/cpp/web-ifc/geometry/IfcGeometryLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2995,16 +2995,16 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID) const
IfcCurve IfcGeometryLoader::GetLocalCurve(uint32_t expressID) const
{
spdlog::debug("[GetLocalCurve({})]",expressID);
for (uint32_t i = 0; i < LocalcurvesIndices.size(); i++)
for (uint32_t i = 0; i < _localcurvesIndices.size(); i++)
{
if (LocalcurvesIndices[i] == expressID)
if (_localcurvesIndices[i] == expressID)
{
return LocalCurvesList[i];
return _localCurvesList[i];
}
}
IfcCurve curve = GetCurve(expressID, 3, false);
LocalcurvesIndices.push_back(expressID);
LocalCurvesList.push_back(curve);
_localcurvesIndices.push_back(expressID);
_localCurvesList.push_back(curve);
return curve;
}

Expand Down Expand Up @@ -3678,4 +3678,15 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID) const
return result;
}

IfcGeometryLoader* IfcGeometryLoader::Clone(const webifc::parsing::IfcLoader &newLoader) const {
IfcGeometryLoader * newGeomLoader = new IfcGeometryLoader(newLoader, _schemaManager, _relVoids, _relNests, _relAggregates, _styledItems, _relMaterials, _materialDefinitions, _linearScalingFactor, _squaredScalingFactor, _cubicScalingFactor, _angularScalingFactor, _angleUnits, _circleSegments, _localCurvesList, _localcurvesIndices, _expressIDToPlacement);
return newGeomLoader;
}


IfcGeometryLoader::IfcGeometryLoader(const webifc::parsing::IfcLoader &loader, const webifc::schema::IfcSchemaManager &schemaManager, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relVoids, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relNests, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relAggregates, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &styledItems, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &relMaterials, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &materialDefinitions, double linearScalingFactor, double squaredScalingFactor, double cubicScalingFactor, double angularScalingFactor, std::string angleUnits, uint16_t circleSegments, std::vector<IfcCurve> &localCurvesList, std::vector<uint32_t> &localcurvesIndices, std::unordered_map<uint32_t, glm::dmat4> expressIDToPlacement)
: _loader(loader),_schemaManager(schemaManager),_relVoids(relVoids),_relNests(relNests),_relAggregates(relAggregates),_styledItems(styledItems),_relMaterials(relMaterials), _materialDefinitions(materialDefinitions), _linearScalingFactor(linearScalingFactor), _squaredScalingFactor(squaredScalingFactor), _cubicScalingFactor(cubicScalingFactor), _angularScalingFactor(angularScalingFactor), _angleUnits(angleUnits), _circleSegments(circleSegments),_localCurvesList(localCurvesList), _localcurvesIndices(localcurvesIndices), _expressIDToPlacement(expressIDToPlacement)
{}


}
6 changes: 4 additions & 2 deletions src/cpp/web-ifc/geometry/IfcGeometryLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ namespace webifc::geometry
double GetLinearScalingFactor() const;
std::string GetAngleUnits() const;
void Clear() const;
IfcGeometryLoader* Clone(const webifc::parsing::IfcLoader &loader) const;
private:
IfcGeometryLoader(const webifc::parsing::IfcLoader &loader, const webifc::schema::IfcSchemaManager &schemaManager, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relVoids, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relNests, const std::unordered_map<uint32_t, std::vector<uint32_t>> &relAggregates, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &styledItems, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &relMaterials, const std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, uint32_t>>> &materialDefinitions, double linearScalingFactor, double squaredScalingFactor, double cubicScalingFactor, double angularScalingFactor, std::string angleUnits, uint16_t circleSegments, std::vector<IfcCurve> &localCurvesList, std::vector<uint32_t> &localcurvesIndices, std::unordered_map<uint32_t, glm::dmat4> expressIDToPlacement);
IfcCurve GetAlignmentCurve(uint32_t expressID, uint32_t parentExpressID = -1) const;
IfcProfile GetProfileByLine(uint32_t expressID) const;
glm::dvec3 GetVertexPoint(uint32_t expressID) const;
Expand All @@ -79,8 +81,8 @@ namespace webifc::geometry
double _angularScalingFactor = 1;
std::string _angleUnits;
uint16_t _circleSegments;
mutable std::vector<IfcCurve> LocalCurvesList;
mutable std::vector<uint32_t> LocalcurvesIndices;
mutable std::vector<IfcCurve> _localCurvesList;
mutable std::vector<uint32_t> _localcurvesIndices;
std::unordered_map<uint32_t, std::vector<uint32_t>> PopulateRelVoidsMap();
std::unordered_map<uint32_t, std::vector<uint32_t>> PopulateRelNestsMap();
std::unordered_map<uint32_t, std::vector<uint32_t>> PopulateRelAggregatesMap();
Expand Down
12 changes: 11 additions & 1 deletion src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ namespace webifc::geometry

IfcGeometry IfcGeometryProcessor::BoolProcess(const std::vector<IfcGeometry> &firstGeoms, std::vector<IfcGeometry> &secondGeoms, std::string op)
{
return boolEngine.BoolProcess(firstGeoms, secondGeoms, op);
return _boolEngine.BoolProcess(firstGeoms, secondGeoms, op);
}

std::vector<uint32_t> IfcGeometryProcessor::Read2DArrayOfThreeIndices()
Expand Down Expand Up @@ -1975,4 +1975,14 @@ namespace webifc::geometry
return convertToWebIfc(fuzzybools::Subtract(firstEngGeom, secondEngGeom));
}

IfcGeometryProcessor * IfcGeometryProcessor::Clone(const webifc::parsing::IfcLoader &newLoader) const {
IfcGeometryProcessor *newProcessor = new IfcGeometryProcessor(_settings,_expressIDToGeometry,*_geometryLoader.Clone(newLoader),_transformation, newLoader, _boolEngine, _schemaManager, _isCoordinated, _expressIdCyl, _expressIdRect, _coordinationMatrix, _predefinedCylinder, _predefinedCube);
return newProcessor;
}

IfcGeometryProcessor::IfcGeometryProcessor(const IfcGeometrySettings &settings,std::unordered_map<uint32_t, IfcGeometry> expressIDToGeometry,const IfcGeometryLoader &geometryLoader,glm::dmat4 transformation, const parsing::IfcLoader &loader, booleanManager boolEngine, const schema::IfcSchemaManager &schemaManager, bool isCoordinated, uint32_t expressIdCyl, uint32_t expressIdRect, glm::dmat4 coordinationMatrix, IfcGeometry predefinedCylinder, IfcGeometry predefinedCube)
: _settings(settings), _expressIDToGeometry(expressIDToGeometry), _geometryLoader(geometryLoader), _transformation(transformation), _loader(loader), _boolEngine(boolEngine), _schemaManager(schemaManager), _isCoordinated(isCoordinated), _expressIdCyl(expressIdCyl), _expressIdRect(expressIdRect), _coordinationMatrix(coordinationMatrix), _predefinedCylinder(predefinedCylinder), _predefinedCube(predefinedCube)
{}


}
16 changes: 9 additions & 7 deletions src/cpp/web-ifc/geometry/IfcGeometryProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ namespace webifc::geometry
std::array<double, 16> GetFlatCoordinationMatrix() const;
glm::dmat4 GetCoordinationMatrix() const;
void Clear();
IfcGeometrySettings _settings;
IfcGeometryProcessor * Clone(const webifc::parsing::IfcLoader &loader) const;
private:
IfcGeometryProcessor(const IfcGeometrySettings &settings,std::unordered_map<uint32_t, IfcGeometry> expressIDToGeometry,const IfcGeometryLoader &geometryLoader,glm::dmat4 transformation, const parsing::IfcLoader &loader, booleanManager boolEngine, const schema::IfcSchemaManager &schemaManager, bool isCoordinated, uint32_t expressIdCyl, uint32_t expressIdRect, glm::dmat4 coordinationMatrix, IfcGeometry predefinedCylinder, IfcGeometry predefinedCube);
IfcGeometrySettings _settings;
std::optional<glm::dvec4> GetStyleItemFromExpressId(uint32_t expressID);
void AddFaceToGeometry(uint32_t expressID, IfcGeometry &geometry);
IfcGeometry GetBrep(uint32_t expressID);
Expand All @@ -65,16 +67,16 @@ namespace webifc::geometry
const IfcGeometryLoader _geometryLoader;
glm::dmat4 _transformation = glm::dmat4(1.0);
const parsing::IfcLoader &_loader;
booleanManager boolEngine;
booleanManager _boolEngine;
const schema::IfcSchemaManager &_schemaManager;
bool _isCoordinated = false;
uint32_t expressIdCyl = 0;
uint32_t expressIdRect = 0;
uint32_t _expressIdCyl = 0;
uint32_t _expressIdRect = 0;
glm::dmat4 _coordinationMatrix = glm::dmat4(1.0);
void AddComposedMeshToFlatMesh(IfcFlatMesh &flatMesh, const IfcComposedMesh &composedMesh, const glm::dmat4 &parentMatrix = glm::dmat4(1), const glm::dvec4 &color = glm::dvec4(1, 1, 1, 1), bool hasColor = false);
std::vector<uint32_t> Read2DArrayOfThreeIndices();
void ReadIndexedPolygonalFace(uint32_t expressID, std::vector<IfcBound3D> &bounds, const std::vector<glm::dvec3> &points);
IfcGeometry predefinedCylinder;
IfcGeometry predefinedCube;
IfcGeometry _predefinedCylinder;
IfcGeometry _predefinedCube;
};
}