#include "GeomAPI_Shape.h"
+#include <Basics_OCCTVersion.hxx>
+
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Edge.h>
#include <sstream>
#include <algorithm> // for std::transform
-#include <BRepTools.hxx>
-
#define MY_SHAPE implPtr<TopoDS_Shape>()
GeomAPI_Shape::GeomAPI_Shape()
const TopoDS_Shape& aShape2 = theShape2->impl<TopoDS_Shape>();
bool isLess = aShape1.TShape() < aShape2.TShape();
if (aShape1.TShape() == aShape2.TShape()) {
+#if OCC_VERSION_LARGE < 0x07080000
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast());
+#else
+ Standard_Integer aHash1 = aShape1.Location().HashCode();
+ Standard_Integer aHash2 = aShape2.Location().HashCode();
+#endif
isLess = aHash1 < aHash2;
}
return isLess;
const TopoDS_Shape& aShape2 = theShape2->impl<TopoDS_Shape>();
bool isLess = aShape1.TShape() < aShape2.TShape();
if (aShape1.TShape() == aShape2.TShape()) {
+#if OCC_VERSION_LARGE < 0x07080000
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast());
+#else
+ Standard_Integer aHash1 = aShape1.Location().HashCode();
+ Standard_Integer aHash2 = aShape2.Location().HashCode();
+#endif
isLess = (aHash1 < aHash2) ||
(aHash1 == aHash2 && aShape1.Orientation() < aShape2.Orientation());
}
int GeomAPI_Shape::Hash::operator()(const std::shared_ptr<GeomAPI_Shape>& theShape) const
{
const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+#if OCC_VERSION_LARGE < 0x07080000
return aShape.HashCode(IntegerLast());
+#else
+ return std::hash<TopoDS_Shape>{}(aShape);
+#endif
}
bool GeomAPI_Shape::Equal::operator()(const std::shared_ptr<GeomAPI_Shape>& theShape1,
const TopoDS_Shape& aShape1 = theShape1->impl<TopoDS_Shape>();
const TopoDS_Shape& aShape2 = theShape2->impl<TopoDS_Shape>();
+#if OCC_VERSION_LARGE < 0x07080000
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast());
+#else
+ Standard_Integer aHash1 = aShape1.Location().HashCode();
+ Standard_Integer aHash2 = aShape2.Location().HashCode();
+#endif
return aShape1.TShape() == aShape2.TShape() && aHash1 == aHash2;
}
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <STEPCAFControl_Writer.hxx>
+#include <StepData_StepModel.hxx>
+#include <UnitsMethods.hxx>
#include <Interface_Static.hxx>
#include <Quantity_Color.hxx>
Interface_Static::SetCVal("xstep.cascade.unit", "M");
Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree
Interface_Static::SetCVal("write.step.unit", "M");
-#else
+#elif OCC_VERSION_LARGE < 0x07080000
STEPCAFControl_Writer aWriterTmp;
Interface_Static::SetCVal("xstep.cascade.unit", "M");
Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree
Interface_Static::SetCVal("write.step.unit", "M");
STEPCAFControl_Writer aWriter;
+#else
+ STEPCAFControl_Writer aWriter;
+ Interface_Static::SetCVal("xstep.cascade.unit", "M");
+ Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree
+ Interface_Static::SetCVal("write.step.unit", "M");
+ Handle(StepData_StepModel) aModel = aWriter.ChangeWriter().Model();
+ aModel->InternalParameters.InitFromStatic();
+ Standard_Integer aWriteUnitInt = Interface_Static::IVal("write.step.unit");
+ Standard_Real aWriteUnitReal = UnitsMethods::GetLengthFactorValue(aWriteUnitInt);
+ aModel->SetWriteLengthUnit(aWriteUnitReal);
#endif
auto aStatus = aWriter.Transfer(aDoc, STEPControl_AsIs);
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
+
+#include <Basics_OCCTVersion.hxx>
+
+#if OCC_VERSION_LARGE < 0x07080000
+
#include <TColStd_MapIntegerHasher.hxx>
#define _NCollection_MapHasher
#undef _NCollection_MapHasher
+#else
+
+#include <NCollection_IndexedDataMap.hxx>
+
+typedef NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape> GEOMAlgo_IndexedDataMapOfIntegerShape;
+
+#endif // OCC_VERSION_LARGE < 0x07080000
#endif
//
#include <GEOMAlgo_PassKeyShape.hxx>
+#include <Basics_OCCTVersion.hxx>
+
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
Clear();
myNbIds=1;
myMap.Add(aS1);
+#if OCC_VERSION_LARGE < 0x07080000
aHC=aS1.HashCode(myUpper);
+#else
+ aHC = std::hash<TopoDS_Shape>{}(aS1);
+#endif
mySum=NormalizedId(aHC, myNbIds);
}
//=======================================================================
myNbIds=myMap.Extent();
for(i=1; i<=myNbIds; ++i) {
const TopoDS_Shape& aS=myMap(i);
+#if OCC_VERSION_LARGE < 0x07080000
aId=aS.HashCode(myUpper);
+#else
+ aId = std::hash<TopoDS_Shape>{}(aS);
+#endif
aIdN=NormalizedId(aId, myNbIds);
mySum+=aIdN;
}
}
return !bRet;
}
+#if OCC_VERSION_LARGE < 0x07080000
//=======================================================================
//function : HashCode
//purpose :
{
return ::HashCode(mySum, aUpper);
}
+#endif
//=======================================================================
//function : Dump
//purpose :
+<<<<<<< HEAD
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
+=======
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
+>>>>>>> d24a43759... Porting to OCCT 7.8.0
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GeomAlgoImpl.h>
+#include <Basics_OCCTVersion.hxx>
+
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Integer.hxx>
GEOMALGOIMPL_EXPORT
Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const;
+#if OCC_VERSION_LARGE < 0x07080000
GEOMALGOIMPL_EXPORT
Standard_Integer HashCode(const Standard_Integer Upper) const;
+#endif
+
+ GEOMALGOIMPL_EXPORT
+ bool operator==(const GEOMAlgo_PassKeyShape& theOther) const
+ {
+ return IsEqual(theOther);
+ }
+
+ GEOMALGOIMPL_EXPORT
+ size_t GetSum() const { return (size_t)mySum; }
GEOMALGOIMPL_EXPORT
void Dump(const Standard_Integer aHex = 0) const;
//
#include <GEOMAlgo_PassKeyShapeMapHasher.hxx>
+#if OCC_VERSION_LARGE < 0x07080000
+
//=======================================================================
//function : HashCode
//purpose :
{
return aPK1.IsEqual(aPK2);
}
+
+#else
+
+size_t GEOMAlgo_PassKeyShapeMapHasher::operator()(const GEOMAlgo_PassKeyShape& aPKey) const
+{
+ return aPKey.GetSum();
+}
+
+bool GEOMAlgo_PassKeyShapeMapHasher::operator()(const GEOMAlgo_PassKeyShape& aPKey1,
+ const GEOMAlgo_PassKeyShape& aPKey2) const
+{
+ return aPKey1.IsEqual(aPKey2);
+}
+
+#endif // OCC_VERSION_LARGE < 0x07080000
#include <Standard_Boolean.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
+#include <Basics_OCCTVersion.hxx>
+
//=======================================================================
//class : GEOMAlgo_PassKeyShapeMapHasher
//purpose :
class GEOMAlgo_PassKeyShapeMapHasher
{
public:
+#if OCC_VERSION_LARGE < 0x07080000
GEOMALGOIMPL_EXPORT
static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,
const Standard_Integer Upper) ;
GEOMALGOIMPL_EXPORT
static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,
const GEOMAlgo_PassKeyShape& aPKey2) ;
+#else
+ GEOMALGOIMPL_EXPORT
+ size_t operator()(const GEOMAlgo_PassKeyShape& aPKey) const;
+
+ GEOMALGOIMPL_EXPORT
+ bool operator()(const GEOMAlgo_PassKeyShape& aPKey1,
+ const GEOMAlgo_PassKeyShape& aPKey2) const;
+#endif // OCC_VERSION_LARGE < 0x07080000
};
#endif
#include <Model_BodyBuilder.h>
+#include <Basics_OCCTVersion.hxx>
+
#include <Locale_Convert.h>
#include <Model_Data.h>
continue;
Standard_Integer anID = 0;
for(TopTools_ListIteratorOfListOfShape aFaceIt(ancestors); aFaceIt.More(); aFaceIt.Next()) {
+#if OCC_VERSION_LARGE < 0x07080000
anID ^= HashCode(aFaceIt.ChangeValue(), 1990657); // Pierpont prime
+#else
+ anID ^= ((std::hash<TopoDS_Shape>{}(aFaceIt.ChangeValue()) & IntegerLast()) % 1990657 + 1); // Pierpont prime
+#endif
}
if (aFacesIDs.IsBound(anID)) { // there found same edge, check they really have same faces
const NCollection_List<TopoDS_Shape>& aSameFaces1 =
/// references and Boolean and Integer Arrays for the current moment.
static bool isEqualContent(Handle(TDF_Attribute) theAttr1, Handle(TDF_Attribute) theAttr2)
{
- if (Standard_GUID::IsEqual(theAttr1->ID(), TDF_Reference::GetID())) { // reference
+ Standard_GUID aGUID1 = theAttr1->ID();
+ if (aGUID1 == TDF_Reference::GetID()) { // reference
Handle(TDF_Reference) aRef1 = Handle(TDF_Reference)::DownCast(theAttr1);
Handle(TDF_Reference) aRef2 = Handle(TDF_Reference)::DownCast(theAttr2);
if (aRef1.IsNull() && aRef2.IsNull())
if (aRef1.IsNull() || aRef2.IsNull())
return false;
return aRef1->Get().IsEqual(aRef2->Get()) == Standard_True;
- } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_BooleanArray::GetID())) {
+ } else if (aGUID1 == TDataStd_BooleanArray::GetID()) {
Handle(TDataStd_BooleanArray) anArr1 = Handle(TDataStd_BooleanArray)::DownCast(theAttr1);
Handle(TDataStd_BooleanArray) anArr2 = Handle(TDataStd_BooleanArray)::DownCast(theAttr2);
if (anArr1.IsNull() && anArr2.IsNull())
}
return true;
}
- } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_IntegerArray::GetID())) {
+ } else if (aGUID1 == TDataStd_IntegerArray::GetID()) {
Handle(TDataStd_IntegerArray) anArr1 = Handle(TDataStd_IntegerArray)::DownCast(theAttr1);
Handle(TDataStd_IntegerArray) anArr2 = Handle(TDataStd_IntegerArray)::DownCast(theAttr2);
if (anArr1.IsNull() && anArr2.IsNull())
}
return true;
}
- } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_ReferenceArray::GetID())) {
+ } else if (aGUID1 == TDataStd_ReferenceArray::GetID()) {
Handle(TDataStd_ReferenceArray) anArr1 = Handle(TDataStd_ReferenceArray)::DownCast(theAttr1);
Handle(TDataStd_ReferenceArray) anArr2 = Handle(TDataStd_ReferenceArray)::DownCast(theAttr2);
if (anArr1.IsNull() && anArr2.IsNull())
}
return true;
}
- } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDataStd_ReferenceList::GetID())) {
+ } else if (aGUID1 == TDataStd_ReferenceList::GetID()) {
Handle(TDataStd_ReferenceList) aList1 = Handle(TDataStd_ReferenceList)::DownCast(theAttr1);
Handle(TDataStd_ReferenceList) aList2= Handle(TDataStd_ReferenceList)::DownCast(theAttr2);
if (aList1.IsNull() && aList2.IsNull())
return false;
}
return !aLIter1.More() && !aLIter2.More(); // both lists are with the same size
- } else if (Standard_GUID::IsEqual(theAttr1->ID(), TDF_TagSource::GetID())) {
+ } else if (aGUID1 == TDF_TagSource::GetID()) {
return true; // it just for created and removed feature: nothing is changed
}
return false;
continue; // attribute is not changed actually
}
} else
- if (Standard_GUID::IsEqual(anADelta->Attribute()->ID(), TDataStd_AsciiString::GetID())) {
+ if (anADelta->Attribute()->ID() == TDataStd_AsciiString::GetID()) {
continue; // error message is disappeared
}
}
//
#include <Model_Objects.h>
+
+#include <Basics_OCCTVersion.hxx>
+
#include <Model_Data.h>
#include <Model_Document.h>
#include <Model_Events.h>
#include <TDataStd_HLabelArray1.hxx>
#include <TDF_Reference.hxx>
#include <TDF_ChildIDIterator.hxx>
-#include <TDF_LabelMapHasher.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
+#if OCC_VERSION_LARGE < 0x07080000
+
+#include <TDF_LabelMapHasher.hxx>
// for TDF_Label map usage
static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper);
static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2);
+#endif
+
int kUNDEFINED_FEATURE_INDEX = -1;
static const std::string& groupNameFoldering(const std::string& theGroupID,
int aRefIndex = aRefs->Lower();
for(; aRefIndex <= aRefs->Upper(); ++aRefIndex) { // iterate all existing features
TDF_Label aCurLabel = aRefs->Value(aRefIndex);
- if (IsEqual(aCurLabel, aFirstFeatureLabel))
+ if (aCurLabel.IsEqual(aFirstFeatureLabel))
break; // no need to continue searching
// searching the folder below, just continue to search last feature from the list
// because the folder may end by the feature which is
// neither a sub-feature nor a feature in history.
if (!aLastFeatureInFolder.IsNull()) {
- if (IsEqual(aCurLabel, aLastFeatureInFolder))
+ if (aCurLabel.IsEqual(aLastFeatureInFolder))
aLastFeatureInFolder.Nullify(); // the last feature in the folder is achieved
continue;
}
return FeaturePtr(); // invalid
}
+#if OCC_VERSION_LARGE < 0x07080000
Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
{
return TDF_LabelMapHasher::HashCode(theLab, theUpper);
{
return TDF_LabelMapHasher::IsEqual(theLab1, theLab2);
}
+#endif