#ifndef _GEOMAlgo_ClsfSolid_HeaderFile
#define _GEOMAlgo_ClsfSolid_HeaderFile
+#include <Basics_OCCTVersion.hxx>
+
#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
#include <TopoDS_Shape.hxx>
+#if OCC_VERSION_LARGE < 0x07080000
#include <Standard_Address.hxx>
+#else
+#include <Standard_TypeDef.hxx>
+#endif
#include <GEOMAlgo_Clsf.hxx>
DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf)
#ifndef GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile
#define GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile
+#include <Basics_OCCTVersion.hxx>
+
#include <GEOMAlgo_PassKey.hxx>
#include <Standard_Integer.hxx>
+
+#if OCC_VERSION_LARGE < 0x07080000
#include <GEOMAlgo_PassKeyMapHasher.hxx>
#define _NCollection_MapHasher
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<GEOMAlgo_PassKey, Standard_Integer, GEOMAlgo_PassKeyMapHasher> GEOMAlgo_DataMapOfPassKeyInteger;
+
+#else
+
+#include <NCollection_DataMap.hxx>
+
+typedef NCollection_DataMap<GEOMAlgo_PassKey, Standard_Integer> GEOMAlgo_DataMapOfPassKeyInteger;
+
+#endif // OCC_VERSION_LARGE < 0x07080000
+
+
typedef GEOMAlgo_DataMapOfPassKeyInteger::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger;
#undef _NCollection_MapHasher
#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
}
return !bRet;
}
+#if OCC_VERSION_LARGE < 0x07080000
//=======================================================================
//function : HashCode
//purpose :
{
return ::HashCode(mySum, aUpper);
}
+#endif
//=======================================================================
//function : Dump
//purpose :
#ifndef _GEOMAlgo_PassKey_HeaderFile
#define _GEOMAlgo_PassKey_HeaderFile
+#include <Basics_OCCTVersion.hxx>
+
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Integer.hxx>
Standard_EXPORT
Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const;
+#if OCC_VERSION_LARGE < 0x07080000
Standard_EXPORT
Standard_Integer HashCode(const Standard_Integer Upper) const;
+#endif
+
+ Standard_EXPORT
+ bool operator==(const GEOMAlgo_PassKey& theOther) const
+ {
+ return IsEqual(theOther);
+ }
+
+ Standard_EXPORT
+ size_t GetSum() const { return (size_t)mySum; }
Standard_EXPORT
Standard_Integer Id(const Standard_Integer aIndex) const;
Standard_Integer mySum;
TColStd_IndexedMapOfInteger myMap;
};
+
+namespace std
+{
+ template <>
+ struct hash<GEOMAlgo_PassKey>
+ {
+ size_t operator()(const GEOMAlgo_PassKey& thePK) const noexcept
+ {
+ return thePK.GetSum();
+ }
+ };
+}
#endif
//
#include <GEOMAlgo_PassKeyMapHasher.hxx>
+#if OCC_VERSION_LARGE < 0x07080000
+
//=======================================================================
//function : HashCode
//purpose :
{
return aPK1.IsEqual(aPK2);
}
+
+#else
+
+size_t GEOMAlgo_PassKeyMapHasher::operator()(const GEOMAlgo_PassKey& aPKey) const
+{
+ return aPKey.GetSum();
+}
+
+bool GEOMAlgo_PassKeyMapHasher::operator()(const GEOMAlgo_PassKey& aPKey1,
+ const GEOMAlgo_PassKey& aPKey2) const
+{
+ return aPKey1.IsEqual(aPKey2);
+}
+
+#endif // OCC_VERSION_LARGE < 0x07080000
#include <Standard_Boolean.hxx>
#include <GEOMAlgo_PassKey.hxx>
+#include <Basics_OCCTVersion.hxx>
+
//=======================================================================
//class : GEOMAlgo_PassKeyMapHasher
//purpose :
//=======================================================================
class GEOMAlgo_PassKeyMapHasher {
public:
+#if OCC_VERSION_LARGE < 0x07080000
Standard_EXPORT
static Standard_Integer HashCode(const GEOMAlgo_PassKey& aPKey,
const Standard_Integer Upper) ;
Standard_EXPORT
static Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aPKey1,
const GEOMAlgo_PassKey& aPKey2) ;
+#else
+ Standard_EXPORT
+ size_t operator()(const GEOMAlgo_PassKey& aPKey) const;
+
+ Standard_EXPORT
+ bool operator()(const GEOMAlgo_PassKey& aPKey1,
+ const GEOMAlgo_PassKey& aPKey2) const;
+#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 :
#ifndef _GEOMAlgo_PassKeyShape_HeaderFile
#define _GEOMAlgo_PassKeyShape_HeaderFile
+#include <Basics_OCCTVersion.hxx>
+
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Integer.hxx>
Standard_EXPORT
Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const;
+#if OCC_VERSION_LARGE < 0x07080000
Standard_EXPORT
Standard_Integer HashCode(const Standard_Integer Upper) const;
+#endif
+
+ Standard_EXPORT
+ bool operator==(const GEOMAlgo_PassKeyShape& theOther) const
+ {
+ return IsEqual(theOther);
+ }
+
+ Standard_EXPORT
+ size_t GetSum() const { return (size_t)mySum; }
Standard_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
Standard_EXPORT
static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,
const Standard_Integer Upper) ;
Standard_EXPORT
static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,
const GEOMAlgo_PassKeyShape& aPKey2) ;
+#else
+ Standard_EXPORT
+ size_t operator()(const GEOMAlgo_PassKeyShape& aPKey) const;
+
+ Standard_EXPORT
+ bool operator()(const GEOMAlgo_PassKeyShape& aPKey1,
+ const GEOMAlgo_PassKeyShape& aPKey2) const;
+#endif // OCC_VERSION_LARGE < 0x07080000
};
#endif
// File : GeometryGUI.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+#include <Basics_OCCTVersion.hxx>
+
+#if OCC_VERSION_LARGE < 0x07080000
+
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
+
+#else
+
+#ifdef _MSC_VER
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#endif
+
+#endif
+
#ifdef HAVE_FINITE
#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
#endif
// OOCT includes
#include <IFSelect_ReturnStatus.hxx>
#include <STEPControl_Writer.hxx>
+#include <StepData_StepModel.hxx>
+#include <UnitsMethods.hxx>
#include <Interface_Static.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Shape.hxx>
Interface_Static::SetCVal("xstep.cascade.unit","M");
Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
Interface_Static::SetIVal("write.step.nonmanifold", 1);
-#else
+#elif OCC_VERSION_LARGE < 0x07080000
STEPControl_Writer aWriterTmp;
Interface_Static::SetCVal("xstep.cascade.unit","M");
Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
Interface_Static::SetIVal("write.step.nonmanifold", 1);
STEPControl_Writer aWriter;
+#else
+ STEPControl_Writer aWriter;
+ Interface_Static::SetCVal("xstep.cascade.unit","M");
+ Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
+ Interface_Static::SetIVal("write.step.nonmanifold", 1);
+ Handle(StepData_StepModel) aModel = aWriter.Model();
+ aModel->InternalParameters.InitFromStatic();
+ Standard_Integer aWriteUnitInt = Interface_Static::IVal("write.step.unit");
+ Standard_Real aWriteUnitReal = UnitsMethods::GetLengthFactorValue(aWriteUnitInt);
+ aModel->SetWriteLengthUnit(aWriteUnitReal);
#endif
IFSelect_ReturnStatus status = aWriter.Transfer( aShape, STEPControl_AsIs );