TKG2d
TKG3d
TKMath
- TKIGES
- TKSTL
TKShHealing
TKXSBase
TKBool
TKGeomBase
TKOffset
TKPrim
- TKSTEPBase
- TKSTEPAttr
- TKSTEP209
- TKSTEP
TKHLR
TKFeat
)
TKLCAF
TKVCAF
TKCDF
- TKXDESTEP
- TKXDEIGES
TKMeshVS
TKService
TKV3d
)
- if(OCC_VERSION_STRING VERSION_LESS 6.7.3)
- list(APPEND OCC_OCAF_LIBRARIES TKAdvTools)
- elseif(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
+
+ if(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
list(APPEND OCC_OCAF_LIBRARIES TKRWMesh)
- endif(OCC_VERSION_STRING VERSION_LESS 6.7.3)
+ endif(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0)
+ if(OCC_VERSION_STRING VERSION_LESS 7.8.0)
+ list(APPEND OCC_LIBRARIES TKIGES TKSTL TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP)
+ list(APPEND OCC_OCAF_LIBRARIES TKXDESTEP TKXDEIGES)
+ else(OCC_VERSION_STRING VERSION_LESS 7.8.0)
+ list(APPEND OCC_LIBRARIES TKDESTEP TKDEIGES TKDEGLTF TKDESTL)
+ endif(OCC_VERSION_STRING VERSION_LESS 7.8.0)
message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
#include <TopoDS_Shape.hxx>
+#include <Standard_Version.hxx>
+
/*
* This method needed for instance NCollection_DataMap with TopoDS_Shape as key
*/
+#if OCC_VERSION_HEX >= 0x070800
+struct SMESHDS_Hasher
+{
+ size_t operator()(const TopoDS_Shape& S) const noexcept {
+ return std::hash<TopoDS_Shape>{}(S);
+ }
+ size_t operator()(const TopoDS_Shape& S1, const TopoDS_Shape& S2) const noexcept {
+ return S1.IsSame(S2);
+ }
+};
+#else
struct SMESHDS_Hasher
{
static inline Standard_Boolean IsEqual(const TopoDS_Shape& S1,
- const TopoDS_Shape& S2)
+ const TopoDS_Shape& S2)
{
return S1.IsSame(S2);
}
return ::HashCode( S, Upper);
}
};
-
+#endif
#endif
#ifndef _MeshVS_EntityType_HeaderFile
#include <MeshVS_EntityType.hxx>
#endif
-#ifndef _Standard_Address_HeaderFile
-#include <Standard_Address.hxx>
-#endif
#ifndef _TColStd_HArray1OfInteger_HeaderFile
#include <TColStd_HArray1OfInteger.hxx>
#endif
#define SMESH_EXPORT
#endif
+#include <Standard_Version.hxx>
#endif
#include "SMESH_SMESH.hxx"
-#include <NCollection_DefineSequence.hxx>
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Sequence.hxx>
+#else
+#include <NCollection_DefineSequence.hxx>
#endif
typedef const SMDS_MeshNode* SMDS_MeshNodePtr;
// --------------------------------------------------------------------------------
// class SMESH_SequenceOfElemPtr
+#include <Standard_Version.hxx>
+#if OCC_VERSION_HEX >= 0x060703
+#include <NCollection_Sequence.hxx>
+#else
#include <NCollection_DefineSequence.hxx>
+#endif
class SMDS_MeshElement;
typedef const SMDS_MeshElement* SMDS_MeshElementPtr;
+#define DEFINE_SEQUENCE(_ClassName_, _BaseCollection_, TheItemType) \
+typedef NCollection_Sequence<TheItemType > _ClassName_;
DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)
#include "SMDS_MeshNode.hxx"
#include "SMESH_File.hxx"
+#include <Standard_Version.hxx>
+
namespace
{
struct Hasher
{
+#if OCC_VERSION_HEX >= 0x070800
+ size_t operator()(const gp_Pnt& point) const noexcept
+ {
+ union
+ {
+ Standard_Real R[3];
+ Standard_Integer I[6];
+ } U;
+
+ point.Coord( U.R[0], U.R[1], U.R[2] );
+ return std::hash<Standard_Integer>{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7);
+ }
+
+ size_t operator()(const gp_Pnt& point1, const gp_Pnt& point2) const noexcept
+ {
+ static Standard_Real tab1[3], tab2[3];
+ point1.Coord(tab1[0],tab1[1],tab1[2]);
+ point2.Coord(tab2[0],tab2[1],tab2[2]);
+ return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
+ }
+#else
//=======================================================================
//function : HashCode
//purpose :
} U;
point.Coord( U.R[0], U.R[1], U.R[2] );
-
- return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
+ return std::hash<Standard_Integer>{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7);
}
+
//=======================================================================
//function : IsEqual
//purpose :
point2.Coord(tab2[0],tab2[1],tab2[2]);
return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
}
+#endif
};
+
typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*,Hasher> TDataMapOfPntNodePtr;
const int HEADER_SIZE = 84;
#include <Bnd_Box.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_Surface.hxx>
-#include <NCollection_DefineArray2.hxx>
#include <Precision.hxx>
#include <Standard_Real.hxx>
#include <TColStd_SequenceOfInteger.hxx>
# include <SMESH_Mesh.hxx>
# include <SMESHDS_Mesh.hxx>
-# include <Standard_math.hxx>
#endif
#include <Base/Console.h>
std::vector<App::DocumentObject *> localValue;
if (aShapeTool->GetShape(label,aShape)) {
+#if OCC_VERSION_HEX >= 0x070800
+ hash = std::hash<TopoDS_Shape> {}(aShape);
+#else
hash = aShape.HashCode(HashUpper);
+#endif
}
Handle(TDataStd_Name) name;
if (isRef || myRefShapes.find(hash) == myRefShapes.end()) {
TopoDS_Shape aShape;
- if (isRef && aShapeTool->GetShape(label, aShape))
- myRefShapes.insert(aShape.HashCode(HashUpper));
-
+ if (isRef && aShapeTool->GetShape(label, aShape)) {
+#if OCC_VERSION_HEX >= 0x070800
+ myRefShapes.insert(std::hash<TopoDS_Shape> {}(aShape));
+#else
+ myRefShapes.insert(aShape.HashCode(HashUpper));
+#endif
+ }
if (aShapeTool->IsSimpleShape(label) && (isRef || aShapeTool->IsFree(label))) {
if (!asm_name.empty())
part_name = asm_name;
part->Label.setValue(default_name);
part->Shape.setValue(shape);
std::map<Standard_Integer, Quantity_ColorRGBA>::const_iterator jt;
+#if OCC_VERSION_HEX >= 0x070800
+ jt = myColorMap.find(std::hash<TopoDS_Shape> {}(shape));
+#else
jt = myColorMap.find(shape.HashCode(INT_MAX));
+#endif
App::Color partColor(0.8f,0.8f,0.8f);
#if 0//TODO
// set label name if defined
if (setname && !myNameMap.empty()) {
std::map<Standard_Integer, std::string>::const_iterator jt;
+#if OCC_VERSION_HEX >= 0x070800
+ jt = myNameMap.find(std::hash<TopoDS_Shape> {}(shape));
+#else
jt = myNameMap.find(shape.HashCode(INT_MAX));
+#endif
if (jt != myNameMap.end()) {
part->Label.setValue(jt->second);
}
faceColors.resize(faces.Extent(), partColor);
xp.Init(shape,TopAbs_FACE);
while (xp.More()) {
+#if OCC_VERSION_HEX >= 0x070800
+ jt = myColorMap.find(std::hash<TopoDS_Shape> {}(xp.Current()));
+#else
jt = myColorMap.find(xp.Current().HashCode(INT_MAX));
+#endif
if (jt != myColorMap.end()) {
int index = faces.FindIndex(xp.Current());
faceColors[index-1] = convertColor(jt->second);
int ctSolids = 0, ctShells = 0, ctComps = 0;
// add the shapes
TopExp_Explorer xp;
- for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++)
+ for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->mySolids[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->mySolids[xp.Current().HashCode(INT_MAX)] = (xp.Current());
- for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++)
+#endif
+ }
+ for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myShells[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myShells[xp.Current().HashCode(INT_MAX)] = (xp.Current());
+#endif
+ }
// if no solids and no shells were found then go for compounds
if (ctSolids == 0 && ctShells == 0) {
- for (xp.Init(aShape, TopAbs_COMPOUND); xp.More(); xp.Next(), ctComps++)
+ for (xp.Init(aShape, TopAbs_COMPOUND); xp.More(); xp.Next(), ctComps++) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myCompds[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myCompds[xp.Current().HashCode(INT_MAX)] = (xp.Current());
+#endif
+ }
}
if (ctComps == 0) {
- for (xp.Init(aShape, TopAbs_FACE, TopAbs_SHELL); xp.More(); xp.Next())
+ for (xp.Init(aShape, TopAbs_FACE, TopAbs_SHELL); xp.More(); xp.Next()) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myShapes[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current());
- for (xp.Init(aShape, TopAbs_WIRE, TopAbs_FACE); xp.More(); xp.Next())
+#endif
+ }
+ for (xp.Init(aShape, TopAbs_WIRE, TopAbs_FACE); xp.More(); xp.Next()) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myShapes[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current());
- for (xp.Init(aShape, TopAbs_EDGE, TopAbs_WIRE); xp.More(); xp.Next())
+#endif
+ }
+ for (xp.Init(aShape, TopAbs_EDGE, TopAbs_WIRE); xp.More(); xp.Next()) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myShapes[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current());
- for (xp.Init(aShape, TopAbs_VERTEX, TopAbs_EDGE); xp.More(); xp.Next())
+#endif
+ }
+ for (xp.Init(aShape, TopAbs_VERTEX, TopAbs_EDGE); xp.More(); xp.Next()) {
+#if OCC_VERSION_HEX >= 0x070800
+ this->myShapes[std::hash<TopoDS_Shape> {}(xp.Current())] = (xp.Current());
+#else
this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current());
+#endif
+ }
}
}
hColors->GetColor(label, XCAFDoc_ColorSurf, col) ||
hColors->GetColor(label, XCAFDoc_ColorCurv, col)) {
// add defined color
+#if OCC_VERSION_HEX >= 0x070800
+ myColorMap[std::hash<TopoDS_Shape> {}(aShape)] = col;
+#else
myColorMap[aShape.HashCode(INT_MAX)] = col;
+#endif
}
else {
// http://www.opencascade.org/org/forum/thread_17107/
hColors->GetColor(it.Value(), XCAFDoc_ColorSurf, col) ||
hColors->GetColor(it.Value(), XCAFDoc_ColorCurv, col)) {
// add defined color
+#if OCC_VERSION_HEX >= 0x070800
+ myColorMap[std::hash<TopoDS_Shape> {}(it.Value())] = col;
+#else
myColorMap[it.Value().HashCode(INT_MAX)] = col;
+#endif
}
}
}
char* str = new char[extstr.LengthOfCString()+1];
extstr.ToUTF8CString(str);
std::string labelName(str);
- if (!labelName.empty())
+ if (!labelName.empty()) {
+#if OCC_VERSION_HEX >= 0x070800
+ myNameMap[std::hash<TopoDS_Shape> {}(aShape)] = labelName;
+#else
myNameMap[aShape.HashCode(INT_MAX)] = labelName;
+#endif
+ }
delete [] str;
}
#include <unordered_map>
#include <vector>
-#include <TDF_LabelMapHasher.hxx>
#include <TDocStd_Document.hxx>
#include <TopoDS_Shape.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include "ImportOCAF.h"
#include "ExportOCAF.h"
+#include <Standard_Version.hxx>
class TDF_Label;
class TopLoc_Location;
struct ShapeHasher {
std::size_t operator()(const TopoDS_Shape &s) const {
- return s.HashCode(INT_MAX);
+#if OCC_VERSION_HEX >= 0x070800
+ return std::hash<TopoDS_Shape> {}(s);
+#else
+ return shape.HashCode(INT_MAX);
+#endif
}
};
struct LabelHasher {
std::size_t operator()(const TDF_Label &l) const {
- return TDF_LabelMapHasher::HashCode(l,INT_MAX);
+#if OCC_VERSION_HEX >= 0x070800
+ return std::hash<TDF_Label> {}(l);
+#else
+ return TDF_LabelMapHasher::HashCode(l, INT_MAX);
+#endif
}
};
#include <Mod/Mesh/App/Mesh.h>\r
#include <Mod/MeshPart/MeshPartGlobal.h>\r
\r
+#include <Standard_Version.hxx>\r
\r
namespace MeshCore\r
{\r
template<class T>\r
struct TopoDSLess {\r
bool operator()(const T& x, const T& y) const {\r
- return x.HashCode(INT_MAX-1) < y.HashCode(INT_MAX-1);\r
- }\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ std::hash<T> hasher;\r
+ return hasher(x) < hasher(y);\r
+#else\r
+ return x.HashCode(INT_MAX - 1) < y.HashCode(INT_MAX - 1);\r
+#endif\r
+ }\r
};\r
\r
using result_type = std::map<TopoDS_Edge, std::vector<FaceSplitEdge>,TopoDSLess<TopoDS_Edge> >;\r
// This is a trick to access the GUI via Python and set the color property\r
// of the associated view provider. If no GUI is up an exception is thrown\r
// and cleared immediately\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ std::hash<TopoDS_Solid> hasher;\r
+ std::map<int, Quantity_Color>::iterator it = hash_col.find(hasher(aSolid));\r
+#else\r
std::map<int, Quantity_Color>::iterator it = hash_col.find(aSolid.HashCode(INT_MAX));\r
+#endif\r
if (it != hash_col.end()) {\r
try {\r
Py::Object obj(pcFeature->getPyObject(), true);\r
TopTools_ListIteratorOfListOfShape it(ancestors);\r
for (; it.More(); it.Next()) {\r
// make sure to avoid duplicates\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ const size_t code = std::hash<TopoDS_Shape>{}(static_cast<TopoDS_Shape>(it.Value()));\r
+#else\r
Standard_Integer code = it.Value().HashCode(INT_MAX);\r
+#endif\r
if (hashes.find(code) == hashes.end()) {\r
list.append(shape2pyshape(it.Value()));\r
hashes.insert(code);\r
if (!PyArg_ParseTuple(args, "|i",&upper))\r
return nullptr;\r
\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ int hc = std::hash<TopoDS_Shape>{}(getTopoShapePtr()->getShape());\r
+#else\r
int hc = getTopoShapePtr()->getShape().HashCode(upper);\r
+#endif\r
return Py_BuildValue("i", hc);\r
}\r
\r
\r
#include "PreCompiled.h"\r
#ifndef _PreComp_\r
-# include <Standard_math.hxx>\r
#endif\r
\r
#include <Base/Console.h>\r
# include <QFileInfo>\r
# include <QPointer>\r
# include <QString>\r
-# include <Standard_math.hxx>\r
# include <Standard_Version.hxx>\r
# include <TopExp_Explorer.hxx>\r
# include <TopoDS_Shape.hxx>\r
\r
#include "PreCompiled.h"\r
#ifndef _PreComp_\r
-# include <Standard_math.hxx>\r
# include <QInputDialog>\r
#endif\r
\r
# include <QKeyEvent>\r
\r
# include <BRep_Builder.hxx>\r
-# include <Standard_math.hxx>\r
# include <TopoDS.hxx>\r
# include <TopoDS_Compound.hxx>\r
\r
#ifndef _PreComp_\r
# include <cfloat>\r
\r
-# include <Standard_math.hxx>\r
\r
# include <Inventor/nodes/SoAnnotation.h>\r
# include <Inventor/nodes/SoBaseColor.h>\r
\r
TopExp_Explorer xp;\r
for (xp.Init(faceMap(i),TopAbs_EDGE);xp.More();xp.Next())\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ faceEdges.insert(std::hash<TopoDS_Shape>{}(xp.Current()));\r
+#else\r
faceEdges.insert(xp.Current().HashCode(INT_MAX));\r
+#endif\r
numFaces++;\r
}\r
\r
// So, we have to store the hashes of the edges associated to a face.\r
// If the hash of a given edge is not in this list we know it's really\r
// a free edge.\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ int hash = std::hash<TopoDS_Shape>{}(aEdge);\r
+#else\r
int hash = aEdge.HashCode(INT_MAX);\r
+#endif\r
if (faceEdges.find(hash) == faceEdges.end()) {\r
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);\r
if (!aPoly.IsNull()) {\r
TopLoc_Location aLoc;\r
\r
// handling of the free edge that are not associated to a face\r
+#if OCC_VERSION_HEX >= 0x070800\r
+ int hash = std::hash<TopoDS_Shape>{}(aEdge);\r
+#else\r
int hash = aEdge.HashCode(INT_MAX);\r
+#endif\r
if (faceEdges.find(hash) == faceEdges.end()) {\r
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);\r
if (!aPoly.IsNull()) {\r
#define PARTGUI_VIEWPROVIDERPARTEXT_H\r
\r
#include <map>\r
-#include <Standard_math.hxx>\r
\r
#include <App/PropertyUnits.h>\r
#include <Gui/ViewProviderGeometryObject.h>\r
# include <QMenu>\r
# include <QTimer>\r
\r
-# include <Standard_math.hxx>\r
# include <TopExp.hxx>\r
# include <TopTools_IndexedMapOfShape.hxx>\r
\r
\r
#include "PreCompiled.h"\r
\r
-#include <Standard_math.hxx>\r
#ifndef _PreComp_\r
# include <Inventor/nodes/SoSeparator.h>\r
#endif\r
#ifndef PARTGUI_ViewProviderPartReference_H\r
#define PARTGUI_ViewProviderPartReference_H\r
\r
-#include <Standard_math.hxx>\r
#include <Standard_Boolean.hxx>\r
#include <TopoDS_Shape.hxx>\r
#include <Gui/ViewProviderGeometryObject.h>\r
#include "PreCompiled.h"
#ifndef _PreComp_
-# include <Standard_math.hxx>
+#define _USE_MATH_DEFINES
+# include <math.h>
#endif
#include <Base/Vector3D.h>
# define PathGuiExport
#endif
-#include <Standard_math.hxx>
-
#ifdef _MSC_VER
# pragma warning( disable : 4273 )
#endif
# define RobotGuiExport\r
#endif\r
\r
-#include <Standard_math.hxx>\r
-\r
#ifdef _MSC_VER\r
# pragma warning(disable : 4005)\r
# pragma warning(disable : 4273)\r
#include "PreCompiled.h"
#ifndef _PreComp_
-#include <Standard_math.hxx>
/// Qt Include Files
#include <Inventor/sensors/SoSensor.h>
#include <QApplication>