Gui/Mod: replace several reinterpret_cast with static_cast
This commit is contained in:
@@ -951,7 +951,7 @@ void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
Gui::WaitCursor wc;
|
||||
|
||||
// When this callback function is invoked we must in either case leave the edit mode
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
view->setEditing(false);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback, ud);
|
||||
n->setHandled();
|
||||
|
||||
@@ -138,7 +138,7 @@ void TaskCreateNodeSet::DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
|
||||
|
||||
// When this callback function is invoked we must in either case leave the edit mode
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
view->setEditing(false);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback, ud);
|
||||
n->setHandled();
|
||||
|
||||
@@ -822,8 +822,8 @@ void TaskPostDataAlongLine::resolutionChanged(int val) {
|
||||
void TaskPostDataAlongLine::pointCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
const SoMouseButtonEvent* mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
PointMarker* pm = reinterpret_cast<PointMarker*>(ud);
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
PointMarker* pm = static_cast<PointMarker*>(ud);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
@@ -1047,8 +1047,8 @@ void TaskPostDataAtPoint::centerChanged(double) {
|
||||
void TaskPostDataAtPoint::pointCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
const SoMouseButtonEvent* mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
DataMarker* pm = reinterpret_cast<DataMarker*>(ud);
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
DataMarker* pm = static_cast<DataMarker*>(ud);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
|
||||
@@ -245,7 +245,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
|
||||
ViewProviderGeometryObject::attach(pcObj);
|
||||
|
||||
// Move 'coords' before the switch
|
||||
//pcRoot->insertChild(pcCoords,pcRoot->findChild(reinterpret_cast<const SoNode*>(pcModeSwitch)));
|
||||
//pcRoot->insertChild(pcCoords,pcRoot->findChild(static_cast<const SoNode*>(pcModeSwitch)));
|
||||
|
||||
// Annotation sets
|
||||
SoGroup* pcAnotRoot = new SoAnnotation();
|
||||
|
||||
@@ -297,9 +297,9 @@ void ViewProviderFemPostFunction::dragStartCallback(void* data, SoDragger*)
|
||||
{
|
||||
// This is called when a manipulator is about to manipulating
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Edit Mirror"));
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = true;
|
||||
static_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = true;
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
ViewProviderFemPostFunction* that = static_cast<ViewProviderFemPostFunction*>(data);
|
||||
that->m_autoRecompute = FemSettings().getPostAutoRecompute();
|
||||
}
|
||||
|
||||
@@ -308,16 +308,16 @@ void ViewProviderFemPostFunction::dragFinishCallback(void* data, SoDragger*)
|
||||
// This is called when a manipulator has done manipulating
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
ViewProviderFemPostFunction* that = static_cast<ViewProviderFemPostFunction*>(data);
|
||||
if (that->m_autoRecompute)
|
||||
that->getObject()->getDocument()->recompute();
|
||||
|
||||
reinterpret_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = false;
|
||||
static_cast<ViewProviderFemPostFunction*>(data)->m_isDragging = false;
|
||||
}
|
||||
|
||||
void ViewProviderFemPostFunction::dragMotionCallback(void* data, SoDragger* drag)
|
||||
{
|
||||
ViewProviderFemPostFunction* that = reinterpret_cast<ViewProviderFemPostFunction*>(data);
|
||||
ViewProviderFemPostFunction* that = static_cast<ViewProviderFemPostFunction*>(data);
|
||||
that->draggerUpdate(drag);
|
||||
|
||||
if (that->m_autoRecompute)
|
||||
|
||||
@@ -443,7 +443,7 @@ private:
|
||||
|
||||
void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
const SoEvent* ev = n->getEvent();
|
||||
if (ev->getTypeId() == SoMouseButtonEvent::getClassTypeId()) {
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent *>(ev);
|
||||
|
||||
@@ -588,7 +588,7 @@ void CurveOnMeshHandler::closeWire()
|
||||
|
||||
void CurveOnMeshHandler::Private::vertexCallback(void * ud, SoEventCallback * cb)
|
||||
{
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
const SoEvent* ev = cb->getEvent();
|
||||
if (ev->getTypeId() == SoMouseButtonEvent::getClassTypeId()) {
|
||||
// set as handled
|
||||
|
||||
@@ -80,7 +80,6 @@ int TopoShapeVertexPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
if (!success) {
|
||||
PyErr_Clear(); // set by PyArg_ParseTuple()
|
||||
if (PyArg_ParseTuple(args,"O!",&(Base::VectorPy::Type), &object)) {
|
||||
// Note: must be static_cast, not reinterpret_cast
|
||||
Base::Vector3d* ptr = static_cast<Base::VectorPy*>(object)->getVectorPtr();
|
||||
x = ptr->x;
|
||||
y = ptr->y;
|
||||
@@ -121,7 +120,7 @@ int TopoShapeVertexPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
TopoShape* ptr = static_cast<TopoShapePy*>(object)->getTopoShapePtr();
|
||||
TopoDS_Shape shape = ptr->getShape();
|
||||
if (!shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX) {
|
||||
TopoShapeVertexPy::PointerType vert = reinterpret_cast<TopoShapeVertexPy::PointerType>(_pcTwinPointer);
|
||||
TopoShapeVertexPy::PointerType vert = getTopoShapePtr();
|
||||
vert->setShape(ptr->getShape());
|
||||
return 0;
|
||||
}
|
||||
@@ -132,7 +131,7 @@ int TopoShapeVertexPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return -1;
|
||||
}
|
||||
|
||||
TopoShapeVertexPy::PointerType ptr = reinterpret_cast<TopoShapeVertexPy::PointerType>(_pcTwinPointer);
|
||||
TopoShapeVertexPy::PointerType ptr = getTopoShapePtr();
|
||||
BRepBuilderAPI_MakeVertex aBuilder(gp_Pnt(x,y,z));
|
||||
TopoDS_Shape s = aBuilder.Vertex();
|
||||
ptr->setShape(s);
|
||||
|
||||
@@ -107,7 +107,7 @@ bool BoxSelection::isAutoDelete() const
|
||||
|
||||
void BoxSelection::selectionCallback(void * ud, SoEventCallback * cb)
|
||||
{
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, ud);
|
||||
SoNode* root = view->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
|
||||
|
||||
@@ -659,7 +659,7 @@ void DlgPrimitives::connectSignalMapper(QWidget *sender, const char *signal, QSi
|
||||
void DlgPrimitives::pickCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Picker* pick = reinterpret_cast<Picker*>(ud);
|
||||
Picker* pick = static_cast<Picker*>(ud);
|
||||
if (pick->exitCode >= 0)
|
||||
pick->loop.exit(pick->exitCode);
|
||||
|
||||
@@ -1953,7 +1953,7 @@ void Location::on_viewPositionButton_clicked()
|
||||
void Location::pickCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
@@ -1963,7 +1963,7 @@ void Location::pickCallback(void * ud, SoEventCallback * n)
|
||||
if (point) {
|
||||
SbVec3f pnt = point->getPoint();
|
||||
SbVec3f nor = point->getNormal();
|
||||
Location* dlg = reinterpret_cast<Location*>(ud);
|
||||
Location* dlg = static_cast<Location*>(ud);
|
||||
dlg->ui->XPositionQSB->setValue(pnt[0]);
|
||||
dlg->ui->YPositionQSB->setValue(pnt[1]);
|
||||
dlg->ui->ZPositionQSB->setValue(pnt[2]);
|
||||
@@ -1979,7 +1979,7 @@ void Location::pickCallback(void * ud, SoEventCallback * n)
|
||||
n->setHandled();
|
||||
view->setEditing(false);
|
||||
view->setRedirectToSceneGraph(false);
|
||||
Location* dlg = reinterpret_cast<Location*>(ud);
|
||||
Location* dlg = static_cast<Location*>(ud);
|
||||
dlg->activeView = nullptr;
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,ud);
|
||||
SoNode* root = view->getSceneGraph();
|
||||
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
}
|
||||
static void selectionCallback(void* ud, SoEventCallback* cb)
|
||||
{
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, ud);
|
||||
SoNode* root = view->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
polygon.Add(Base::Vector2d((*it)[0], (*it)[1]));
|
||||
}
|
||||
|
||||
FaceColors* self = reinterpret_cast<FaceColors*>(ud);
|
||||
FaceColors* self = static_cast<FaceColors*>(ud);
|
||||
self->d->view = nullptr;
|
||||
if (self->d->obj && self->d->obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
cb->setHandled();
|
||||
|
||||
@@ -206,7 +206,7 @@ void ViewProviderMirror::dragFinishCallback(void *, SoDragger *)
|
||||
|
||||
void ViewProviderMirror::dragMotionCallback(void *data, SoDragger *drag)
|
||||
{
|
||||
ViewProviderMirror* that = reinterpret_cast<ViewProviderMirror*>(data);
|
||||
ViewProviderMirror* that = static_cast<ViewProviderMirror*>(data);
|
||||
const SbMatrix& mat = drag->getMotionMatrix();
|
||||
// the new axis of the plane
|
||||
SbRotation rot(mat);
|
||||
|
||||
@@ -326,7 +326,7 @@ void ViewProviderPoints::unsetEdit(int ModNum)
|
||||
void ViewProviderPoints::clipPointsCallback(void *, SoEventCallback * n)
|
||||
{
|
||||
// When this callback function is invoked we must in either case leave the edit mode
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
view->setEditing(false);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), clipPointsCallback);
|
||||
n->setHandled();
|
||||
|
||||
@@ -43,7 +43,6 @@ using namespace Base;
|
||||
std::string WaypointPy::representation(void) const
|
||||
{
|
||||
double A,B,C;
|
||||
//PlacementPy::PointerType ptr = reinterpret_cast<PlacementPy::PointerType>(_pcTwinPointer);
|
||||
std::stringstream str;
|
||||
getWaypointPtr()->EndPos.getRotation().getYawPitchRoll(A,B,C);
|
||||
str.precision(5);
|
||||
|
||||
Reference in New Issue
Block a user