+ remove Part_ShapeInfo command

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5157 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer 2011-11-23 09:05:06 +00:00
parent 3b4dde6799
commit 978392f78a
8 changed files with 10 additions and 175 deletions

View File

@ -297,9 +297,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "Part_Revolve"
<< "Part_Mirror"
<< "Part_Fillet"
<< "PartDesign_Chamfer"
<< "Separator"
<< "Part_ShapeInfo";
<< "PartDesign_Chamfer";
// Drawing ****************************************************************************************************

View File

@ -1000,12 +1000,12 @@ void CmdShapeInfo::activated(int iMsg)
Gui::Document* doc = Gui::Application::Instance->activeDocument();
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(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)

View File

@ -401,54 +401,6 @@ std::vector<Base::Vector3d> ViewProviderPartExt::getSelectionShape(const char* E
return std::vector<Base::Vector3d>();
}
void ViewProviderPartExt::shapeInfoCallback(void * ud, SoEventCallback * n)
{
const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent();
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(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<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderPartExt::getClassTypeId()))
return;
ViewProviderPartExt* that = static_cast<ViewProviderPartExt*>(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<SoVertexShape*>(point->getPath()->getTail());
std::map<SoVertexShape*, TopoDS_Shape>::const_iterator it = vertexShapeMap.find(vs);
if (it != vertexShapeMap.end())
return it->second;
}
return TopoDS_Shape();
}
bool ViewProviderPartExt::loadParameter()
{
bool changed = false;

View File

@ -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<SoVertexShape*, TopoDS_Shape> vertexShapeMap;
};
}

View File

@ -280,115 +280,8 @@ std::vector<std::string> ViewProviderPartReference::getDisplayModes(void) const
return StrList;
}
void ViewProviderPartReference::shapeInfoCallback(void * ud, SoEventCallback * n)
{
const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent();
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(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<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderPartReference::getClassTypeId()))
return;
ViewProviderPartReference* that = static_cast<ViewProviderPartReference*>(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<SoVertexShape*>(point->getPath()->getTail());
std::map<SoVertexShape*, TopoDS_Shape>::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<const Part::PropertyPartShape*>(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
// }
// }
}
// ----------------------------------------------------------------------------

View File

@ -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<SoVertexShape*, TopoDS_Shape> vertexShapeMap;
};

View File

@ -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;
}

View File

@ -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")) {