Use OCCT Handle macro for Handle_ classes
This is the result of running OCCT's upgrade script provided with OCCT 7.0. See https://www.opencascade.com/content/freecad-occt710-and-windows-rtti-data-missing#comment-form and https://www.forum.freecadweb.org/viewtopic.php?f=4&t=21405&start=120#p169019 for why this is necessary for OCCT >= 7.1
This commit is contained in:
@@ -127,7 +127,7 @@ private:
|
||||
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.Reader().WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading STEP file...");
|
||||
pi->Show();
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
pi->EndScope();
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load STEP file without colors...\n");
|
||||
|
||||
@@ -160,7 +160,7 @@ private:
|
||||
throw Py::Exception(PyExc_IOError, "cannot read IGES file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading IGES file...");
|
||||
pi->Show();
|
||||
@@ -171,7 +171,7 @@ private:
|
||||
->SetModel(new IGESData_IGESModel);
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load IGES file without colors...\n");
|
||||
|
||||
@@ -194,7 +194,7 @@ private:
|
||||
hApp->Close(hDoc);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -300,7 +300,7 @@ private:
|
||||
hApp->Close(hDoc);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -354,7 +354,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.Reader().WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading STEP file...");
|
||||
pi->Show();
|
||||
@@ -362,7 +362,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
|
||||
pi->EndScope();
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load STEP file without colors...\n");
|
||||
|
||||
@@ -383,7 +383,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading IGES file...");
|
||||
pi->Show();
|
||||
@@ -391,7 +391,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
|
||||
pi->EndScope();
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load IGES file without colors...\n");
|
||||
|
||||
@@ -410,7 +410,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
|
||||
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PyExc_Exception, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ using namespace Import;
|
||||
|
||||
#define OCAF_KEEP_PLACEMENT
|
||||
|
||||
ImportOCAF::ImportOCAF(Handle_TDocStd_Document h, App::Document* d, const std::string& name)
|
||||
ImportOCAF::ImportOCAF(Handle(TDocStd_Document) h, App::Document* d, const std::string& name)
|
||||
: pDoc(h), doc(d), default_name(name)
|
||||
{
|
||||
aShapeTool = XCAFDoc_DocumentTool::ShapeTool (pDoc->Main());
|
||||
@@ -128,7 +128,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
|
||||
hash = aShape.HashCode(HashUpper);
|
||||
}
|
||||
|
||||
Handle_TDataStd_Name name;
|
||||
Handle(TDataStd_Name) name;
|
||||
std::string part_name = defaultname;
|
||||
if (label.FindAttribute(TDataStd_Name::GetID(),name)) {
|
||||
TCollection_ExtendedString extstr = name->Get();
|
||||
@@ -153,7 +153,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
|
||||
}
|
||||
|
||||
TopLoc_Location part_loc = loc;
|
||||
Handle_XCAFDoc_Location hLoc;
|
||||
Handle(XCAFDoc_Location) hLoc;
|
||||
if (label.FindAttribute(XCAFDoc_Location::GetID(), hLoc)) {
|
||||
if (isRef)
|
||||
part_loc = part_loc * hLoc->Get();
|
||||
@@ -344,7 +344,7 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ExportOCAF::ExportOCAF(Handle_TDocStd_Document h, bool explicitPlacement)
|
||||
ExportOCAF::ExportOCAF(Handle(TDocStd_Document) h, bool explicitPlacement)
|
||||
: pDoc(h)
|
||||
, keepExplicitPlacement(explicitPlacement)
|
||||
{
|
||||
@@ -434,7 +434,7 @@ void ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& c
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ImportXCAF::ImportXCAF(Handle_TDocStd_Document h, App::Document* d, const std::string& name)
|
||||
ImportXCAF::ImportXCAF(Handle(TDocStd_Document) h, App::Document* d, const std::string& name)
|
||||
: hdoc(h), doc(d), default_name(name)
|
||||
{
|
||||
aShapeTool = XCAFDoc_DocumentTool::ShapeTool (hdoc->Main());
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Import {
|
||||
class ImportExport ImportOCAF
|
||||
{
|
||||
public:
|
||||
ImportOCAF(Handle_TDocStd_Document h, App::Document* d, const std::string& name);
|
||||
ImportOCAF(Handle(TDocStd_Document) h, App::Document* d, const std::string& name);
|
||||
virtual ~ImportOCAF();
|
||||
void loadShapes();
|
||||
|
||||
@@ -65,10 +65,10 @@ private:
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){}
|
||||
|
||||
private:
|
||||
Handle_TDocStd_Document pDoc;
|
||||
Handle(TDocStd_Document) pDoc;
|
||||
App::Document* doc;
|
||||
Handle_XCAFDoc_ShapeTool aShapeTool;
|
||||
Handle_XCAFDoc_ColorTool aColorTool;
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool;
|
||||
Handle(XCAFDoc_ColorTool) aColorTool;
|
||||
std::string default_name;
|
||||
std::set<int> myRefShapes;
|
||||
static const int HashUpper = INT_MAX;
|
||||
@@ -77,13 +77,13 @@ private:
|
||||
class ImportExport ExportOCAF
|
||||
{
|
||||
public:
|
||||
ExportOCAF(Handle_TDocStd_Document h, bool explicitPlacement);
|
||||
ExportOCAF(Handle(TDocStd_Document) h, bool explicitPlacement);
|
||||
void saveShape(Part::Feature* part, const std::vector<App::Color>&);
|
||||
|
||||
private:
|
||||
Handle_TDocStd_Document pDoc;
|
||||
Handle_XCAFDoc_ShapeTool aShapeTool;
|
||||
Handle_XCAFDoc_ColorTool aColorTool;
|
||||
Handle(TDocStd_Document) pDoc;
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool;
|
||||
Handle(XCAFDoc_ColorTool) aColorTool;
|
||||
TDF_Label rootLabel;
|
||||
bool keepExplicitPlacement;
|
||||
};
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
class ImportXCAF
|
||||
{
|
||||
public:
|
||||
ImportXCAF(Handle_TDocStd_Document h, App::Document* d, const std::string& name);
|
||||
ImportXCAF(Handle(TDocStd_Document) h, App::Document* d, const std::string& name);
|
||||
virtual ~ImportXCAF();
|
||||
void loadShapes();
|
||||
|
||||
@@ -102,10 +102,10 @@ private:
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){}
|
||||
|
||||
private:
|
||||
Handle_TDocStd_Document hdoc;
|
||||
Handle(TDocStd_Document) hdoc;
|
||||
App::Document* doc;
|
||||
Handle_XCAFDoc_ShapeTool aShapeTool;
|
||||
Handle_XCAFDoc_ColorTool hColors;
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool;
|
||||
Handle(XCAFDoc_ColorTool) hColors;
|
||||
std::string default_name;
|
||||
std::map<Standard_Integer, TopoDS_Shape> mySolids;
|
||||
std::map<Standard_Integer, TopoDS_Shape> myShells;
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
# include <sstream>
|
||||
# include <Standard_Version.hxx>
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <Handle_TDocStd_Document.hxx>
|
||||
# include <Handle_XCAFApp_Application.hxx>
|
||||
# include <TDocStd_Document.hxx>
|
||||
# include <XCAFApp_Application.hxx>
|
||||
# include <XCAFDoc_DocumentTool.hxx>
|
||||
@@ -79,7 +77,7 @@
|
||||
using namespace Import;
|
||||
|
||||
|
||||
ImportOCAFAssembly::ImportOCAFAssembly(Handle_TDocStd_Document h, App::Document* d, const std::string& name, App::DocumentObject *target)
|
||||
ImportOCAFAssembly::ImportOCAFAssembly(Handle(TDocStd_Document) h, App::Document* d, const std::string& name, App::DocumentObject *target)
|
||||
: pDoc(h),
|
||||
doc(d),
|
||||
default_name(name),
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
#ifndef IMPORT_ImportOCAFAssembly_H
|
||||
#define IMPORT_ImportOCAFAssembly_H
|
||||
|
||||
#include <Handle_TDocStd_Document.hxx>
|
||||
#include <Handle_XCAFDoc_ColorTool.hxx>
|
||||
#include <Handle_XCAFDoc_ShapeTool.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <climits>
|
||||
@@ -52,7 +49,7 @@ namespace Import {
|
||||
class ImportExport ImportOCAFAssembly
|
||||
{
|
||||
public:
|
||||
ImportOCAFAssembly(Handle_TDocStd_Document h, App::Document* d, const std::string& name, App::DocumentObject *target);
|
||||
ImportOCAFAssembly(Handle(TDocStd_Document) h, App::Document* d, const std::string& name, App::DocumentObject *target);
|
||||
virtual ~ImportOCAFAssembly();
|
||||
void loadShapes();
|
||||
void loadAssembly();
|
||||
@@ -69,10 +66,10 @@ private:
|
||||
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){}
|
||||
|
||||
private:
|
||||
Handle_TDocStd_Document pDoc;
|
||||
Handle(TDocStd_Document) pDoc;
|
||||
App::Document* doc;
|
||||
Handle_XCAFDoc_ShapeTool aShapeTool;
|
||||
Handle_XCAFDoc_ColorTool aColorTool;
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool;
|
||||
Handle(XCAFDoc_ColorTool) aColorTool;
|
||||
std::string default_name;
|
||||
std::set<int> myRefShapes;
|
||||
static const int HashUpper = INT_MAX;
|
||||
|
||||
@@ -82,11 +82,11 @@ int StepShape::read(const char* fileName)
|
||||
|
||||
//Use method StepData_StepModel::NextNumberForLabel to find its rank with the following:
|
||||
//Standard_CString label = "#...";
|
||||
Handle_StepData_StepModel model = aReader.StepModel();
|
||||
Handle(StepData_StepModel) model = aReader.StepModel();
|
||||
//rank = model->NextNumberForLabe(label, 0, Standard_False);
|
||||
|
||||
Handle_Message_PrinterOStream mstr = new Message_PrinterOStream();
|
||||
Handle_Message_Messenger msg = new Message_Messenger(mstr);
|
||||
Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream();
|
||||
Handle(Message_Messenger) msg = new Message_Messenger(mstr);
|
||||
|
||||
std::cout << "dump of step header:" << std::endl;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
class OCAFBrowser
|
||||
{
|
||||
public:
|
||||
OCAFBrowser(Handle_TDocStd_Document h)
|
||||
OCAFBrowser(Handle(TDocStd_Document) h)
|
||||
: pDoc(h)
|
||||
{
|
||||
myGroupIcon = QApplication::style()->standardIcon(QStyle::SP_DirIcon);
|
||||
@@ -156,7 +156,7 @@ private:
|
||||
private:
|
||||
QIcon myGroupIcon;
|
||||
TDF_IDList myList;
|
||||
Handle_TDocStd_Document pDoc;
|
||||
Handle(TDocStd_Document) pDoc;
|
||||
};
|
||||
|
||||
void OCAFBrowser::load(QTreeWidget* theTree)
|
||||
@@ -188,25 +188,25 @@ void OCAFBrowser::load(const TDF_Label& label, QTreeWidgetItem* item, const QStr
|
||||
QString text;
|
||||
QTextStream str(&text);
|
||||
str << attr->DynamicType()->Name();
|
||||
str << " = " << toString(Handle_TDataStd_Name::DownCast(attr)->Get()).c_str();
|
||||
str << " = " << toString(Handle(TDataStd_Name)::DownCast(attr)->Get()).c_str();
|
||||
child->setText(0, text);
|
||||
}
|
||||
else if (it.Value() == TDF_TagSource::GetID()) {
|
||||
QString text;
|
||||
QTextStream str(&text);
|
||||
str << attr->DynamicType()->Name();
|
||||
str << " = " << Handle_TDF_TagSource::DownCast(attr)->Get();
|
||||
str << " = " << Handle(TDF_TagSource)::DownCast(attr)->Get();
|
||||
child->setText(0, text);
|
||||
}
|
||||
else if (it.Value() == TDataStd_Integer::GetID()) {
|
||||
QString text;
|
||||
QTextStream str(&text);
|
||||
str << attr->DynamicType()->Name();
|
||||
str << " = " << Handle_TDataStd_Integer::DownCast(attr)->Get();
|
||||
str << " = " << Handle(TDataStd_Integer)::DownCast(attr)->Get();
|
||||
child->setText(0, text);
|
||||
}
|
||||
else if (it.Value() == TNaming_NamedShape::GetID()) {
|
||||
TopoDS_Shape shape = Handle_TNaming_NamedShape::DownCast(attr)->Get();
|
||||
TopoDS_Shape shape = Handle(TNaming_NamedShape)::DownCast(attr)->Get();
|
||||
QString text;
|
||||
QTextStream str(&text);
|
||||
str << attr->DynamicType()->Name() << " = ";
|
||||
@@ -273,7 +273,7 @@ void OCAFBrowser::load(const TDF_Label& label, QTreeWidgetItem* item, const QStr
|
||||
class ImportOCAFExt : public Import::ImportOCAF
|
||||
{
|
||||
public:
|
||||
ImportOCAFExt(Handle_TDocStd_Document h, App::Document* d, const std::string& name)
|
||||
ImportOCAFExt(Handle(TDocStd_Document) h, App::Document* d, const std::string& name)
|
||||
: ImportOCAF(h, d, name)
|
||||
{
|
||||
}
|
||||
@@ -354,7 +354,7 @@ private:
|
||||
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.Reader().WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading STEP file...");
|
||||
pi->Show();
|
||||
@@ -362,7 +362,7 @@ private:
|
||||
pi->EndScope();
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load STEP file without colors...\n");
|
||||
|
||||
@@ -387,7 +387,7 @@ private:
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot read IGES file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading IGES file...");
|
||||
pi->Show();
|
||||
@@ -398,7 +398,7 @@ private:
|
||||
->SetModel(new IGESData_IGESModel);
|
||||
}
|
||||
catch (OSD_Exception) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
Base::Console().Error("%s\n", e->GetMessageString());
|
||||
Base::Console().Message("Try to load IGES file without colors...\n");
|
||||
|
||||
@@ -416,7 +416,7 @@ private:
|
||||
hApp->Close(hDoc);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -511,7 +511,7 @@ private:
|
||||
hApp->Close(hDoc);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -542,7 +542,7 @@ private:
|
||||
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.Reader().WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading STEP file...");
|
||||
pi->Show();
|
||||
@@ -564,7 +564,7 @@ private:
|
||||
throw Py::Exception(PyExc_IOError, "cannot read IGES file");
|
||||
}
|
||||
|
||||
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
|
||||
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
|
||||
aReader.WS()->MapReader()->SetProgress(pi);
|
||||
pi->NewScope(100, "Reading IGES file...");
|
||||
pi->Show();
|
||||
@@ -605,7 +605,7 @@ private:
|
||||
hApp->Close(hDoc);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
Handle(Standard_Failure) e = Standard_Failure::Caught();
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
|
||||
Reference in New Issue
Block a user