Add support for OCCT 7.8.0 (#11909)
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <SMESHDS_Mesh.hxx>
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#include <Standard_math.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
||||
@@ -151,7 +151,11 @@ void ImportOCAF::loadShapes(const TDF_Label& label,
|
||||
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;
|
||||
@@ -223,7 +227,11 @@ void ImportOCAF::loadShapes(const TDF_Label& label,
|
||||
if (isRef || myRefShapes.find(hash) == myRefShapes.end()) {
|
||||
TopoDS_Shape aShape;
|
||||
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))) {
|
||||
@@ -550,7 +558,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
||||
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
|
||||
@@ -571,7 +583,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
||||
// 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);
|
||||
}
|
||||
@@ -591,7 +607,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
|
||||
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);
|
||||
@@ -626,29 +646,57 @@ void ImportXCAF::loadShapes(const TDF_Label& label)
|
||||
// add the shapes
|
||||
TopExp_Explorer xp;
|
||||
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());
|
||||
#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++) {
|
||||
#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()) {
|
||||
#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
|
||||
}
|
||||
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());
|
||||
#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());
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -659,7 +707,11 @@ void ImportXCAF::loadShapes(const TDF_Label& label)
|
||||
|| 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/
|
||||
@@ -669,7 +721,11 @@ void ImportXCAF::loadShapes(const TDF_Label& label)
|
||||
|| 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -682,7 +738,11 @@ void ImportXCAF::loadShapes(const TDF_Label& label)
|
||||
extstr.ToUTF8CString(str);
|
||||
std::string labelName(str);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <XCAFDoc_ColorTool.hxx>
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
#define IMPORT_TOOLS_H
|
||||
|
||||
#include <Quantity_ColorRGBA.hxx>
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <XCAFDoc_ColorTool.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <App/Color.h>
|
||||
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
namespace Import
|
||||
{
|
||||
|
||||
@@ -37,7 +38,11 @@ struct ShapeHasher
|
||||
{
|
||||
std::size_t operator()(const TopoDS_Shape& shape) const
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
return std::hash<TopoDS_Shape> {}(shape);
|
||||
#else
|
||||
return shape.HashCode(INT_MAX);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +50,11 @@ struct LabelHasher
|
||||
{
|
||||
std::size_t operator()(const TDF_Label& label) const
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
return std::hash<TDF_Label> {}(label);
|
||||
#else
|
||||
return TDF_LabelMapHasher::HashCode(label, INT_MAX);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <Mod/Mesh/App/Mesh.h>
|
||||
#include <Mod/MeshPart/MeshPartGlobal.h>
|
||||
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
namespace MeshCore
|
||||
{
|
||||
@@ -65,7 +66,12 @@ public:
|
||||
{
|
||||
bool operator()(const T& x, const T& y) const
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
std::hash<T> hasher;
|
||||
return hasher(x) < hasher(y);
|
||||
#else
|
||||
return x.HashCode(INT_MAX - 1) < y.HashCode(INT_MAX - 1);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -137,7 +137,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
// This is a trick to access the GUI via Python and set the color property
|
||||
// of the associated view provider. If no GUI is up an exception is thrown
|
||||
// and cleared immediately
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
std::hash<TopoDS_Solid> hasher;
|
||||
std::map<int, Quantity_Color>::iterator it = hash_col.find(hasher(aSolid));
|
||||
#else
|
||||
std::map<int, Quantity_Color>::iterator it = hash_col.find(aSolid.HashCode(INT_MAX));
|
||||
#endif
|
||||
if (it != hash_col.end()) {
|
||||
try {
|
||||
Py::Object obj(pcFeature->getPyObject(), true);
|
||||
|
||||
@@ -1306,7 +1306,11 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
|
||||
TopTools_ListIteratorOfListOfShape it(ancestors);
|
||||
for (; it.More(); it.Next()) {
|
||||
// make sure to avoid duplicates
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
const size_t code = std::hash<TopoDS_Shape>{}(static_cast<TopoDS_Shape>(it.Value()));
|
||||
#else
|
||||
Standard_Integer code = it.Value().HashCode(INT_MAX);
|
||||
#endif
|
||||
if (hashes.find(code) == hashes.end()) {
|
||||
list.append(shape2pyshape(it.Value()));
|
||||
hashes.insert(code);
|
||||
@@ -1928,7 +1932,11 @@ PyObject* TopoShapePy::hashCode(PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "|i",&upper))
|
||||
return nullptr;
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
int hc = std::hash<TopoDS_Shape>{}(getTopoShapePtr()->getShape());
|
||||
#else
|
||||
int hc = getTopoShapePtr()->getShape().HashCode(upper);
|
||||
#endif
|
||||
return Py_BuildValue("i", hc);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Standard_math.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
# include <QFileInfo>
|
||||
# include <QPointer>
|
||||
# include <QString>
|
||||
# include <Standard_math.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <TopoDS_Shape.hxx>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Standard_math.hxx>
|
||||
# include <QInputDialog>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
# include <QKeyEvent>
|
||||
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <Standard_math.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Compound.hxx>
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#ifndef _PreComp_
|
||||
# include <cfloat>
|
||||
|
||||
# include <Standard_math.hxx>
|
||||
|
||||
# include <Inventor/nodes/SoAnnotation.h>
|
||||
# include <Inventor/nodes/SoBaseColor.h>
|
||||
|
||||
@@ -982,7 +982,11 @@ void ViewProviderPartExt::updateVisual()
|
||||
|
||||
TopExp_Explorer xp;
|
||||
for (xp.Init(faceMap(i),TopAbs_EDGE);xp.More();xp.Next())
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
faceEdges.insert(std::hash<TopoDS_Shape>{}(xp.Current()));
|
||||
#else
|
||||
faceEdges.insert(xp.Current().HashCode(INT_MAX));
|
||||
#endif
|
||||
numFaces++;
|
||||
}
|
||||
|
||||
@@ -1010,7 +1014,11 @@ void ViewProviderPartExt::updateVisual()
|
||||
// So, we have to store the hashes of the edges associated to a face.
|
||||
// If the hash of a given edge is not in this list we know it's really
|
||||
// a free edge.
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
int hash = std::hash<TopoDS_Shape>{}(aEdge);
|
||||
#else
|
||||
int hash = aEdge.HashCode(INT_MAX);
|
||||
#endif
|
||||
if (faceEdges.find(hash) == faceEdges.end()) {
|
||||
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);
|
||||
if (!aPoly.IsNull()) {
|
||||
@@ -1209,7 +1217,11 @@ void ViewProviderPartExt::updateVisual()
|
||||
TopLoc_Location aLoc;
|
||||
|
||||
// handling of the free edge that are not associated to a face
|
||||
#if OCC_VERSION_HEX >= 0x070800
|
||||
int hash = std::hash<TopoDS_Shape>{}(aEdge);
|
||||
#else
|
||||
int hash = aEdge.HashCode(INT_MAX);
|
||||
#endif
|
||||
if (faceEdges.find(hash) == faceEdges.end()) {
|
||||
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);
|
||||
if (!aPoly.IsNull()) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#define PARTGUI_VIEWPROVIDERPARTEXT_H
|
||||
|
||||
#include <map>
|
||||
#include <Standard_math.hxx>
|
||||
|
||||
#include <App/PropertyUnits.h>
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
# include <QMenu>
|
||||
# include <QTimer>
|
||||
|
||||
# include <Standard_math.hxx>
|
||||
# include <TopExp.hxx>
|
||||
# include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Standard_math.hxx>
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#ifndef PARTGUI_ViewProviderPartReference_H
|
||||
#define PARTGUI_ViewProviderPartReference_H
|
||||
|
||||
#include <Standard_math.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Standard_math.hxx>
|
||||
#define _USE_MATH_DEFINES
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
# define PathGuiExport
|
||||
#endif
|
||||
|
||||
#include <Standard_math.hxx>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( disable : 4273 )
|
||||
#endif
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#define RobotGuiExport
|
||||
#endif
|
||||
|
||||
#include <Standard_math.hxx>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4005)
|
||||
#pragma warning(disable : 4273)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <Standard_math.hxx>
|
||||
/// Qt Include Files
|
||||
#include <Inventor/sensors/SoSensor.h>
|
||||
#include <QApplication>
|
||||
|
||||
Reference in New Issue
Block a user