Skip to content

Ported to OCCT 7.8.x #1063

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 3 commits into from
Apr 23, 2025
Merged
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
2 changes: 0 additions & 2 deletions TIGLViewer/src/TIGLViewerInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_Shape.hxx>
#include <AIS_SequenceOfInteractive.hxx>
#include <AIS_Trihedron.hxx>

#include <Aspect_Background.hxx>
Expand Down Expand Up @@ -89,7 +88,6 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_PhysicalQuantity.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SelectableObject.hxx>
Expand Down
11 changes: 10 additions & 1 deletion src/common/tiglcommonfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,21 @@
boundingBox.Get(minx, miny, minz, maxx, maxy, maxz);
}

int GetHash(const TopoDS_Shape& shape)
{
#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,8,0)
return std::hash<TopoDS_Shape>{}(shape);
#else
return shape.HashCode(INT_MAX);
#endif
}

// Returns a unique Hashcode for a specific geometric component
int GetComponentHashCode(tigl::ITiglGeometricComponent& component)
{
const TopoDS_Shape& loft = (*component.GetLoft()).Shape();
if (!loft.IsNull()) {
return loft.HashCode(2294967295);
return GetHash(loft);

Check warning on line 656 in src/common/tiglcommonfunctions.cpp

View check run for this annotation

Codecov / codecov/patch

src/common/tiglcommonfunctions.cpp#L656

Added line #L656 was not covered by tests
}
else {
return 0;
Expand Down
4 changes: 3 additions & 1 deletion src/common/tiglcommonfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include "CCPACSImportExport.h"
#include "Standard.hxx"
#include "Standard_values.h"
#include "tigl_internal.h"
#include "gp_Pnt.hxx"
#include "gp_Vec.hxx"
Expand Down Expand Up @@ -203,6 +202,9 @@ TIGL_EXPORT void GetShapeExtension(const TopoDS_Shape& shape,
double& miny, double& maxy,
double& minz, double& maxz);

// Returns a unique Hashcode for a shape
TIGL_EXPORT int GetHash(const TopoDS_Shape& shape);

// Returns a unique Hashcode for a specific geometric component based on its loft
TIGL_EXPORT int GetComponentHashCode(tigl::ITiglGeometricComponent&);

Expand Down
1 change: 1 addition & 0 deletions src/geometry/CTiglBSplineFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <TColStd_Array1OfInteger.hxx>
#include <math_Matrix.hxx>
#include <math_Gauss.hxx>
#include <math_Vector.hxx>

#include <BSplCLib.hxx>
#include <Geom_BSplineCurve.hxx>
Expand Down
3 changes: 2 additions & 1 deletion src/geometry/CTiglBSplineFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <TColStd_Array1OfReal.hxx>
#include <Geom_BSplineCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <math_Vector.hxx>

class BSplineFit
{
Expand Down Expand Up @@ -69,7 +70,7 @@ class BSplineFit


/// Computes the matrix and the right hand side of the system to be solved
void initSystem(class math_Matrix& A, class math_Vector& rhsx, class math_Vector& rhsy, class math_Vector& rhsz);
void initSystem(class math_Matrix& A, math_Vector& rhsx, math_Vector& rhsy, math_Vector& rhsz);

/// Computes an uniform knot vector
void computeKnots();
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/CTiglIntersectionCalculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
bool found = false;
TopoDS_Wire wire = TopoDS::Wire(Edges->Value(wireID));
for (std::vector<TopoDS_Wire>::size_type i = 0; i < Wires.size(); i++) {
if (Wires[i].HashCode(200000) == wire.HashCode(200000)) {
if (GetHash(Wires[i]) == GetHash(wire)) {

Check warning on line 378 in src/geometry/CTiglIntersectionCalculation.cpp

View check run for this annotation

Codecov / codecov/patch

src/geometry/CTiglIntersectionCalculation.cpp#L378

Added line #L378 was not covered by tests
found = true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/imports/CTiglStepReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "CTiglImporterFactory.h"
#include "CTiglTypeRegistry.h"
#include "CTiglError.h"
#include "tiglcommonfunctions.h"

#include <STEPControl_Reader.hxx>
#include <StepBasic_ProductDefinition.hxx>
Expand Down Expand Up @@ -55,7 +56,7 @@ namespace
continue;
}

int hash = shape->Shape().HashCode(INT_MAX);
int hash = GetHash(shape->Shape());
shapeMap[hash] = ishape;
}

Expand Down Expand Up @@ -90,7 +91,7 @@ namespace
std::string shapeName = prod->Name()->ToCString();

// create hash and search for it in hashMap
int hash = boundShape.HashCode(INT_MAX);
int hash = GetHash(boundShape);
HashMap::iterator it = shapeMap.find(hash);
if (it == shapeMap.end()) {
continue;
Expand Down
1 change: 1 addition & 0 deletions src/math/tiglMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "tigl_internal.h"

#include <math_Matrix.hxx>
#include <math_Vector.hxx>

namespace tigl
{
Expand Down
Loading