From 978392f78a53690e7c0c5cf76ccc747aa61db1ed Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 23 Nov 2011 09:05:06 +0000 Subject: [PATCH] + remove Part_ShapeInfo command git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5157 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Complete/Gui/Workbench.cpp | 4 +- src/Mod/Part/Gui/Command.cpp | 12 +-- src/Mod/Part/Gui/ViewProviderExt.cpp | 48 --------- src/Mod/Part/Gui/ViewProviderExt.h | 3 - src/Mod/Part/Gui/ViewProviderReference.cpp | 107 --------------------- src/Mod/Part/Gui/ViewProviderReference.h | 3 - src/Mod/Part/Gui/Workbench.cpp | 4 +- src/Mod/Web/Gui/Workbench.cpp | 4 +- 8 files changed, 10 insertions(+), 175 deletions(-) diff --git a/src/Mod/Complete/Gui/Workbench.cpp b/src/Mod/Complete/Gui/Workbench.cpp index e41837f3e..4f675962f 100644 --- a/src/Mod/Complete/Gui/Workbench.cpp +++ b/src/Mod/Complete/Gui/Workbench.cpp @@ -297,9 +297,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "Part_Revolve" << "Part_Mirror" << "Part_Fillet" - << "PartDesign_Chamfer" - << "Separator" - << "Part_ShapeInfo"; + << "PartDesign_Chamfer"; // Drawing **************************************************************************************************** diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 717adcea4..c86e33262 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -1000,12 +1000,12 @@ void CmdShapeInfo::activated(int iMsg) Gui::Document* doc = Gui::Application::Instance->activeDocument(); Gui::View3DInventor* view = static_cast(doc->getActiveView()); - if (view) { - Gui::View3DInventorViewer* viewer = view->getViewer(); - viewer->setEditing(true); - viewer->getWidget()->setCursor(QCursor(QPixmap(part_pipette),4,29)); - viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), PartGui::ViewProviderPart::shapeInfoCallback); - } + //if (view) { + // Gui::View3DInventorViewer* viewer = view->getViewer(); + // viewer->setEditing(true); + // viewer->getWidget()->setCursor(QCursor(QPixmap(part_pipette),4,29)); + // viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), PartGui::ViewProviderPart::shapeInfoCallback); + // } } bool CmdShapeInfo::isActive(void) diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index a42c41841..7680861cd 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -401,54 +401,6 @@ std::vector ViewProviderPartExt::getSelectionShape(const char* E return std::vector(); } -void ViewProviderPartExt::shapeInfoCallback(void * ud, SoEventCallback * n) -{ - const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent(); - Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); - - // Mark all incoming mouse button events as handled, especially, to deactivate the selection node - n->getAction()->setHandled(); - if (mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP) { - n->setHandled(); - view->setEditing(false); - view->getWidget()->setCursor(QCursor(Qt::ArrowCursor)); - view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), shapeInfoCallback); - } - else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { - const SoPickedPoint * point = n->getPickedPoint(); - if (point == NULL) { - Base::Console().Message("No point picked.\n"); - return; - } - - n->setHandled(); - - // By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is - // really from the mesh we render and not from any other geometry - Gui::ViewProvider* vp = static_cast(view->getViewProviderByPath(point->getPath())); - if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderPartExt::getClassTypeId())) - return; - ViewProviderPartExt* that = static_cast(vp); - TopoDS_Shape sh = that->getShape(point); - if (!sh.IsNull()) { - SbVec3f pt = point->getPoint(); - Base::Console().Message("(%.6f, %.6f, %.6f, %d)\n", pt[0], pt[1], pt[2], sh.HashCode(IntegerLast())); - } - } -} - -TopoDS_Shape ViewProviderPartExt::getShape(const SoPickedPoint* point) const -{ - if (point && point->getPath()->getTail()->getTypeId().isDerivedFrom(SoVertexShape::getClassTypeId())) { - SoVertexShape* vs = static_cast(point->getPath()->getTail()); - std::map::const_iterator it = vertexShapeMap.find(vs); - if (it != vertexShapeMap.end()) - return it->second; - } - - return TopoDS_Shape(); -} - bool ViewProviderPartExt::loadParameter() { bool changed = false; diff --git a/src/Mod/Part/Gui/ViewProviderExt.h b/src/Mod/Part/Gui/ViewProviderExt.h index daa43437f..1ad056ddc 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.h +++ b/src/Mod/Part/Gui/ViewProviderExt.h @@ -89,8 +89,6 @@ public: void reload(); virtual void updateData(const App::Property*); - TopoDS_Shape getShape(const SoPickedPoint*) const; - static void shapeInfoCallback(void * ud, SoEventCallback * n); /** @name Selection handling * This group of methodes do the selection handling. @@ -145,7 +143,6 @@ private: static App::PropertyFloatConstraint::Constraints sizeRange; static App::PropertyFloatConstraint::Constraints tessRange; static const char* LightingEnums[]; - std::map vertexShapeMap; }; } diff --git a/src/Mod/Part/Gui/ViewProviderReference.cpp b/src/Mod/Part/Gui/ViewProviderReference.cpp index 52b01998f..79b322df8 100644 --- a/src/Mod/Part/Gui/ViewProviderReference.cpp +++ b/src/Mod/Part/Gui/ViewProviderReference.cpp @@ -280,115 +280,8 @@ std::vector ViewProviderPartReference::getDisplayModes(void) const return StrList; } - -void ViewProviderPartReference::shapeInfoCallback(void * ud, SoEventCallback * n) -{ - const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent(); - Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); - - // Mark all incoming mouse button events as handled, especially, to deactivate the selection node - n->getAction()->setHandled(); - if (mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP) { - n->setHandled(); - view->setEditing(false); - view->getWidget()->setCursor(QCursor(Qt::ArrowCursor)); - view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), shapeInfoCallback); - } - else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { - const SoPickedPoint * point = n->getPickedPoint(); - if (point == NULL) { - Base::Console().Message("No point picked.\n"); - return; - } - - n->setHandled(); - - // By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is - // really from the mesh we render and not from any other geometry - Gui::ViewProvider* vp = static_cast(view->getViewProviderByPath(point->getPath())); - if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderPartReference::getClassTypeId())) - return; - ViewProviderPartReference* that = static_cast(vp); - TopoDS_Shape sh = that->getShape(point); - if (!sh.IsNull()) { - SbVec3f pt = point->getPoint(); - Base::Console().Message("(%.6f, %.6f, %.6f, %d)\n", pt[0], pt[1], pt[2], sh.HashCode(IntegerLast())); - } - } -} - -TopoDS_Shape ViewProviderPartReference::getShape(const SoPickedPoint* point) const -{ - if (point && point->getPath()->getTail()->getTypeId().isDerivedFrom(SoVertexShape::getClassTypeId())) { - SoVertexShape* vs = static_cast(point->getPath()->getTail()); - std::map::const_iterator it = vertexShapeMap.find(vs); - if (it != vertexShapeMap.end()) - return it->second; - } - - return TopoDS_Shape(); -} void ViewProviderPartReference::updateData(const App::Property* prop) { -// Gui::ViewProviderGeometryObject::updateData(prop); -// if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) { -// TopoDS_Shape cShape = static_cast(prop)->getValue(); -// -// // clear anchor nodes -// vertexShapeMap.clear(); -// EdgeRoot->removeAllChildren(); -// FaceRoot->removeAllChildren(); -// VertexRoot->removeAllChildren(); -// // do nothing if shape is empty -// if (cShape.IsNull()) -// return; -// -// try { -// // creating the mesh on the data structure -// Bnd_Box bounds; -// BRepBndLib::Add(cShape, bounds); -// bounds.SetGap(0.0); -// Standard_Real xMin, yMin, zMin, xMax, yMax, zMax; -// bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); -// Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * -// this->meshDeviation; -// -// BRepMesh::Mesh(cShape,deflection); -// //BRepMesh_IncrementalMesh MESH(cShape,meshDeviation); -// // We must reset the location here because the transformation data -// // are set in the placement property -// TopLoc_Location aLoc; -// cShape.Location(aLoc); -// computeFaces (FaceRoot,cShape,deflection); -// computeEdges (EdgeRoot,cShape); -// computeVertices(VertexRoot,cShape); -// BRepTools::Clean(cShape); // remove triangulation -// -// // update control points if there -// /* if (pcControlPoints) { -// pcControlPoints->removeAllChildren(); -// showControlPoints(this->ControlPoints.getValue(), prop); -// }*/ -// } -// catch (...){ -// Base::Console().Error("Cannot compute Inventor representation for the shape of %s.\n", -// pcObject->getNameInDocument()); -// // For many 64-bit Linux systems this error is due to a missing compiler switch -// // Note: echo "" | g++ -E -dM -x c - | sort | less prints a list of gcc-internals. -//#if defined(__GNUC__) && defined(__LP64__) && !defined(_OCC64) -// std::string exe = App::Application::Config()["ExeName"]; -// Base::Console().Error("IMPORTANT: Apparently, %s isn't built with the OpenCASCADE-internal " -// "define '_OCC64'.\nReconfigure the build system with the missing define " -// "(e.g. ./configure CXXFLAGS=\"-D_OCC64\") and run a complete rebuild.\n", -// exe.c_str()); -//#endif -// } -// } } - - -// ---------------------------------------------------------------------------- - - diff --git a/src/Mod/Part/Gui/ViewProviderReference.h b/src/Mod/Part/Gui/ViewProviderReference.h index ee886654e..e2ef186de 100644 --- a/src/Mod/Part/Gui/ViewProviderReference.h +++ b/src/Mod/Part/Gui/ViewProviderReference.h @@ -78,8 +78,6 @@ public: void reload(); virtual void updateData(const App::Property*); - TopoDS_Shape getShape(const SoPickedPoint*) const; - static void shapeInfoCallback(void * ud, SoEventCallback * n); protected: /// get called by the container whenever a property has been changed @@ -104,7 +102,6 @@ private: bool qualityNormals; static App::PropertyFloatConstraint::Constraints floatRange; static const char* LightingEnums[]; - std::map vertexShapeMap; }; diff --git a/src/Mod/Part/Gui/Workbench.cpp b/src/Mod/Part/Gui/Workbench.cpp index de67252cb..cdd9d920b 100644 --- a/src/Mod/Part/Gui/Workbench.cpp +++ b/src/Mod/Part/Gui/Workbench.cpp @@ -67,7 +67,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "Part_Boolean" << "Part_CrossSections" << "Part_Extrude" << "Part_Revolve" << "Part_Mirror" << "Part_Fillet" << "Part_RuledSurface" << "Part_Loft" - << "Part_Builder" << "Separator" << "Part_ShapeInfo"; + << "Part_Builder"; Gui::MenuItem* partSimple = new Gui::MenuItem; root->insertItem(item, partSimple); @@ -97,7 +97,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const Gui::ToolBarItem* boolop = new Gui::ToolBarItem(root); boolop->setCommand("Boolean"); - *boolop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common" << "Part_Section"/* << "Part_ShapeInfo"*/; + *boolop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common" << "Part_Section"; return root; } diff --git a/src/Mod/Web/Gui/Workbench.cpp b/src/Mod/Web/Gui/Workbench.cpp index b9998b177..87cde7f07 100644 --- a/src/Mod/Web/Gui/Workbench.cpp +++ b/src/Mod/Web/Gui/Workbench.cpp @@ -210,9 +210,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const // << "Part_Boolean" // << "Part_Extrude" // << "Part_Revolve" -// << "Part_Fillet" -// << "Separator" -// << "Part_ShapeInfo"; +// << "Part_Fillet"; // //# ifdef WEB_SHOW_SKETCHER // if (mgr.getCommandByName("Sketcher_NewSketch")) {