diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 292ad972dc..ffad0b888e 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -102,7 +102,6 @@ #include "LinkBaseExtensionPy.h" #include "VarSet.h" #include "MaterialObject.h" -#include "MeasureDistance.h" #include "MeasureManagerPy.h" #include "Origin.h" #include "OriginFeature.h" @@ -2114,7 +2113,6 @@ void Application::initTypes() App::VRMLObject ::init(); App::Annotation ::init(); App::AnnotationLabel ::init(); - App::MeasureDistance ::init(); App::MaterialObject ::init(); App::MaterialObjectPython ::init(); App::TextDocument ::init(); diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index 817fc8b635..52c0c85968 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -165,7 +165,6 @@ SET(Document_CPP_SRCS Origin.cpp Path.cpp InventorObject.cpp - MeasureDistance.cpp Placement.cpp ProjectFile.cpp OriginFeature.cpp @@ -212,7 +211,6 @@ SET(Document_HPP_SRCS Origin.h Path.h InventorObject.h - MeasureDistance.h Placement.h ProjectFile.h OriginFeature.h diff --git a/src/App/MeasureDistance.cpp b/src/App/MeasureDistance.cpp deleted file mode 100644 index 9bd75333ac..0000000000 --- a/src/App/MeasureDistance.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2008 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" - -#include "MeasureDistance.h" - -using namespace App; - -PROPERTY_SOURCE(App::MeasureDistance, App::DocumentObject) - - -MeasureDistance::MeasureDistance() -{ - // clang-format off - ADD_PROPERTY_TYPE(P1,(Base::Vector3d()),"Measurement",Prop_None,"First point of measurement"); - ADD_PROPERTY_TYPE(P2,(Base::Vector3d()),"Measurement",Prop_None,"Second point of measurement"); - ADD_PROPERTY_TYPE(Distance,(0.0) ,"Measurement",App::PropertyType(Prop_ReadOnly|Prop_Output), - "Distance between the points"); - // clang-format on -} - -MeasureDistance::~MeasureDistance() = default; - -DocumentObjectExecReturn *MeasureDistance::execute() -{ - Distance.setValue(Base::Distance(P1.getValue(), P2.getValue())); - return DocumentObject::StdReturn; -} - -void MeasureDistance::onChanged(const App::Property* prop) -{ - if (prop == &P1 || prop == &P2) { - if (!isRestoring()) { - App::DocumentObjectExecReturn *ret = recompute(); - delete ret; - } - } - DocumentObject::onChanged(prop); -} diff --git a/src/App/MeasureDistance.h b/src/App/MeasureDistance.h deleted file mode 100644 index a08668c008..0000000000 --- a/src/App/MeasureDistance.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2008 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef APP_MEASUREDISTANCE_H -#define APP_MEASUREDISTANCE_H - -#include "DocumentObject.h" -#include "PropertyGeo.h" -#include "PropertyUnits.h" - - -namespace App -{ - -class AppExport MeasureDistance : public DocumentObject -{ - PROPERTY_HEADER_WITH_OVERRIDE(App::MeasureDistance); - -public: - /// Constructor - MeasureDistance(); - ~MeasureDistance() override; - - App::PropertyVector P1; - App::PropertyVector P2; - App::PropertyDistance Distance; - - /// recalculate the object - DocumentObjectExecReturn *execute() override; - - /// returns the type name of the ViewProvider - const char* getViewProviderName() const override { - return "Gui::ViewProviderMeasureDistance"; - } - -protected: - void onChanged(const Property* prop) override; -}; - -} //namespace App - - -#endif // APP_MEASUREDISTANCE_H diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index e8e14cb233..60872cb00e 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -113,7 +113,6 @@ #include "ViewProviderLink.h" #include "ViewProviderLinkPy.h" #include "ViewProviderMaterialObject.h" -#include "ViewProviderMeasureDistance.h" #include "ViewProviderOrigin.h" #include "ViewProviderOriginFeature.h" #include "ViewProviderOriginGroup.h" @@ -1908,8 +1907,6 @@ void Application::initTypes() Gui::ViewProviderVRMLObject ::init(); Gui::ViewProviderAnnotation ::init(); Gui::ViewProviderAnnotationLabel ::init(); - Gui::ViewProviderPointMarker ::init(); - Gui::ViewProviderMeasureDistance ::init(); Gui::ViewProviderPythonFeature ::init(); Gui::ViewProviderPythonGeometry ::init(); Gui::ViewProviderPlacement ::init(); diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 21ec70d4fa..a6e701b279 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -929,7 +929,6 @@ SET(Viewprovider_CPP_SRCS ViewProviderGeometryObject.cpp ViewProviderImagePlane.cpp ViewProviderInventorObject.cpp - ViewProviderMeasureDistance.cpp ViewProviderPyImp.cpp ViewProviderPythonFeature.cpp ViewProviderVRMLObject.cpp @@ -967,7 +966,6 @@ SET(Viewprovider_SRCS ViewProviderGeometryObject.h ViewProviderImagePlane.h ViewProviderInventorObject.h - ViewProviderMeasureDistance.h ViewProviderPythonFeature.h ViewProviderVRMLObject.h ViewProviderBuilder.h diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 1355ef7c2a..80f5a58920 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include @@ -85,7 +84,6 @@ #include "View3DInventor.h" #include "View3DInventorViewer.h" #include "ViewParams.h" -#include "ViewProviderMeasureDistance.h" #include "ViewProviderGeometryObject.h" #include "WaitCursor.h" @@ -3139,62 +3137,6 @@ void StdCmdTreeSelectAllInstances::activated(int iMsg) Selection().selStackPush(); } -//=========================================================================== -// Std_MeasureDistance -//=========================================================================== - -DEF_STD_CMD_A(StdCmdMeasureDistance) - -StdCmdMeasureDistance::StdCmdMeasureDistance() - : Command("Std_MeasureDistance") -{ - sGroup = "View"; - sMenuText = QT_TR_NOOP("Measure distance"); - sToolTipText = QT_TR_NOOP("Activate the distance measurement tool"); - sWhatsThis = "Std_MeasureDistance"; - sStatusTip = QT_TR_NOOP("Activate the distance measurement tool"); - sPixmap = "view-measurement"; - eType = Alter3DView; -} - -void StdCmdMeasureDistance::activated(int iMsg) -{ - Q_UNUSED(iMsg); - Gui::Document* doc = Gui::Application::Instance->activeDocument(); - auto view = static_cast(doc->getActiveView()); - if (view) { - Gui::View3DInventorViewer* viewer = view->getViewer(); - viewer->setEditing(true); - - // NOLINTBEGIN - QCursor cursor = SelectionCallbackHandler::makeCursor(viewer, QSize(32, 32), - "view-measurement-cross", 6, 25); - viewer->setEditingCursor(cursor); - // NOLINTEND - - // Derives from QObject and we have a parent object, so we don't - // require a delete. - auto marker = new PointMarker(viewer); - viewer->addEventCallback(SoEvent::getClassTypeId(), - ViewProviderMeasureDistance::measureDistanceCallback, marker); - } -} - -bool StdCmdMeasureDistance::isActive() -{ - App::Document* doc = App::GetApplication().getActiveDocument(); - if (!doc || doc->countObjectsOfType(App::GeoFeature::getClassTypeId()) == 0) - return false; - - Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); - return !viewer->isEditing(); - } - - return false; -} - //=========================================================================== // Std_Measure // this is the Unified Measurement Facility Measure command @@ -4124,7 +4066,6 @@ void CreateViewStdCommands() rcCmdMgr.addCommand(new StdCmdTreeExpand()); rcCmdMgr.addCommand(new StdCmdTreeCollapse()); rcCmdMgr.addCommand(new StdCmdTreeSelectAllInstances()); - rcCmdMgr.addCommand(new StdCmdMeasureDistance()); rcCmdMgr.addCommand(new StdCmdMeasure()); rcCmdMgr.addCommand(new StdCmdSceneInspector()); rcCmdMgr.addCommand(new StdCmdTextureMapping()); diff --git a/src/Gui/ViewProviderMeasureDistance.cpp b/src/Gui/ViewProviderMeasureDistance.cpp deleted file mode 100644 index 84766d4954..0000000000 --- a/src/Gui/ViewProviderMeasureDistance.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2008 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#include - -#include -#include -#include -#include - -#include "ViewProviderMeasureDistance.h" -#include "Application.h" -#include -#include "Document.h" -#include "View3DInventorViewer.h" -#include "ViewParams.h" - - -using namespace Gui; - -PROPERTY_SOURCE(Gui::ViewProviderMeasureDistance, Gui::ViewProviderDocumentObject) - - -ViewProviderMeasureDistance::ViewProviderMeasureDistance() -{ - ADD_PROPERTY(TextColor,(1.0f,1.0f,1.0f)); - ADD_PROPERTY(LineColor,(1.0f,1.0f,1.0f)); - ADD_PROPERTY(FontSize,(18)); - ADD_PROPERTY(DistFactor,(1.0)); - ADD_PROPERTY(Mirror,(false)); - - pFont = new SoFontStyle(); - pFont->ref(); - pLabel = new SoText2(); - pLabel->ref(); - pColor = new SoBaseColor(); - pColor->ref(); - pTextColor = new SoBaseColor(); - pTextColor->ref(); - pTranslation = new SoTranslation(); - pTranslation->ref(); - - TextColor.touch(); - FontSize.touch(); - LineColor.touch(); - - static const SbVec3f verts[4] = - { - SbVec3f(0,0,0), SbVec3f(0,0,0), - SbVec3f(0,0,0), SbVec3f(0,0,0) - }; - - // indexes used to create the edges - static const int32_t lines[9] = - { - 0,2,-1, - 1,3,-1, - 2,3,-1 - }; - - pCoords = new SoCoordinate3(); - pCoords->ref(); - pCoords->point.setNum(4); - pCoords->point.setValues(0, 4, verts); - - pLines = new SoIndexedLineSet(); - pLines->ref(); - pLines->coordIndex.setNum(9); - pLines->coordIndex.setValues(0, 9, lines); - sPixmap = "view-measurement"; -} - -ViewProviderMeasureDistance::~ViewProviderMeasureDistance() -{ - pFont->unref(); - pLabel->unref(); - pColor->unref(); - pTextColor->unref(); - pTranslation->unref(); - pCoords->unref(); - pLines->unref(); -} - -bool ViewProviderMeasureDistance::isPartOfPhysicalObject() const -{ - return false; -} - -void ViewProviderMeasureDistance::onChanged(const App::Property* prop) -{ - if (prop == &Mirror || prop == &DistFactor) { - updateData(prop); - } - else if (prop == &TextColor) { - const App::Color& c = TextColor.getValue(); - pTextColor->rgb.setValue(c.r,c.g,c.b); - } - else if (prop == &LineColor) { - const App::Color& c = LineColor.getValue(); - pColor->rgb.setValue(c.r,c.g,c.b); - } - else if (prop == &FontSize) { - pFont->size = FontSize.getValue(); - } - else { - ViewProviderDocumentObject::onChanged(prop); - } -} - -std::vector ViewProviderMeasureDistance::getDisplayModes() const -{ - // add modes - std::vector StrList; - StrList.emplace_back("Base"); - return StrList; -} - -void ViewProviderMeasureDistance::setDisplayMode(const char* ModeName) -{ - if (strcmp(ModeName, "Base") == 0) - setDisplayMaskMode("Base"); - ViewProviderDocumentObject::setDisplayMode(ModeName); -} - -void ViewProviderMeasureDistance::attach(App::DocumentObject* pcObject) -{ - ViewProviderDocumentObject::attach(pcObject); - - auto ps = new SoPickStyle(); - ps->style = SoPickStyle::UNPICKABLE; - - auto lineSep = new SoSeparator(); - auto style = new SoDrawStyle(); - style->lineWidth = 2.0f; - lineSep->addChild(ps); - lineSep->addChild(style); - lineSep->addChild(pColor); - lineSep->addChild(pCoords); - lineSep->addChild(pLines); - auto points = new SoMarkerSet(); - points->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", - ViewParams::instance()->getMarkerSize()); - points->numPoints=2; - lineSep->addChild(points); - - auto textsep = new SoSeparator(); - textsep->addChild(pTranslation); - textsep->addChild(pTextColor); - textsep->addChild(pFont); - textsep->addChild(pLabel); - - auto sep = new SoAnnotation(); - sep->addChild(lineSep); - sep->addChild(textsep); - addDisplayMaskMode(sep, "Base"); -} - -void ViewProviderMeasureDistance::updateData(const App::Property* prop) -{ - if (prop->is() || - prop == &Mirror || prop == &DistFactor) { - if (strcmp(prop->getName(),"P1") == 0) { - Base::Vector3d v = static_cast(prop)->getValue(); - pCoords->point.set1Value(0, SbVec3f(v.x,v.y,v.z)); - } - else if (strcmp(prop->getName(),"P2") == 0) { - Base::Vector3d v = static_cast(prop)->getValue(); - pCoords->point.set1Value(1, SbVec3f(v.x,v.y,v.z)); - } - - SbVec3f pt1 = pCoords->point[0]; - SbVec3f pt2 = pCoords->point[1]; - SbVec3f dif = pt1-pt2; - - float length = fabs(dif.length())*DistFactor.getValue(); - if (Mirror.getValue()) - length = -length; - - - if (dif.sqrLength() < 10.0e-6f) { - pCoords->point.set1Value(2, pt1+SbVec3f(0.0f,0.0f,length)); - pCoords->point.set1Value(3, pt2+SbVec3f(0.0f,0.0f,length)); - } - else { - SbVec3f dir = dif.cross(SbVec3f(1.0f,0.0f,0.0f)); - if (dir.sqrLength() < 10.0e-6f) - dir = dif.cross(SbVec3f(0.0f,1.0f,0.0f)); - if (dir.sqrLength() < 10.0e-6f) - dir = dif.cross(SbVec3f(0.0f,0.0f,1.0f)); - dir.normalize(); - if (dir.dot(SbVec3f(0.0f,0.0f,1.0f)) < 0.0f) - length = -length; - pCoords->point.set1Value(2, pt1 + length*dir); - pCoords->point.set1Value(3, pt2 + length*dir); - } - - SbVec3f pos = (pCoords->point[2]+pCoords->point[3])/2.0f; - pTranslation->translation.setValue(pos); - - pLabel->string.setValue((Base::Quantity(dif.length(), Base::Unit::Length)).getUserString().toUtf8().constData()); - } - - ViewProviderDocumentObject::updateData(prop); -} - -// ---------------------------------------------------------------------------- - -PointMarker::PointMarker(View3DInventorViewer* iv) : view(iv), - vp(new ViewProviderPointMarker) -{ - view->addViewProvider(vp); - previousSelectionEn = view->isSelectionEnabled(); - view->setSelectionEnabled(false); -} - -PointMarker::~PointMarker() -{ - view->removeViewProvider(vp); - view->setSelectionEnabled(previousSelectionEn); - delete vp; -} - -void PointMarker::addPoint(const SbVec3f& pt) -{ - int ct = countPoints(); - vp->pCoords->point.set1Value(ct, pt); - vp->pMarker->numPoints=ct+1; -} - -int PointMarker::countPoints() const -{ - return vp->pCoords->point.getNum(); -} - -void PointMarker::customEvent(QEvent*) -{ - Gui::Document* doc = Gui::Application::Instance->activeDocument(); - doc->openCommand(QT_TRANSLATE_NOOP("Command", "Measure distance")); - App::DocumentObject* obj = doc->getDocument()->addObject - (App::MeasureDistance::getClassTypeId().getName(),"Distance"); - - auto md = static_cast(obj); - const SbVec3f& pt1 = vp->pCoords->point[0]; - const SbVec3f& pt2 = vp->pCoords->point[1]; - md->P1.setValue(Base::Vector3d(pt1[0],pt1[1],pt1[2])); - md->P2.setValue(Base::Vector3d(pt2[0],pt2[1],pt2[2])); - - QString str = QString::fromLatin1("Distance: %1") - .arg(Base::Quantity(md->Distance.getValue(), Base::Unit::Length).getUserString()); - md->Label.setValue(str.toUtf8().constData()); - doc->commitCommand(); - - this->deleteLater(); -} - -PROPERTY_SOURCE(Gui::ViewProviderPointMarker, Gui::ViewProviderDocumentObject) - -ViewProviderPointMarker::ViewProviderPointMarker() -{ - pCoords = new SoCoordinate3(); - pCoords->ref(); - pCoords->point.setNum(0); - pMarker = new SoMarkerSet(); - pMarker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", - ViewParams::instance()->getMarkerSize()); - pMarker->numPoints=0; - pMarker->ref(); - - auto grp = new SoGroup(); - grp->addChild(pCoords); - grp->addChild(pMarker); - addDisplayMaskMode(grp, "Base"); - setDisplayMaskMode("Base"); -} - -ViewProviderPointMarker::~ViewProviderPointMarker() -{ - pCoords->unref(); - pMarker->unref(); -} - -bool ViewProviderPointMarker::isPartOfPhysicalObject() const -{ - return false; -} - -void ViewProviderMeasureDistance::measureDistanceCallback(void * ud, SoEventCallback * n) -{ - auto view = static_cast(n->getUserData()); - auto pm = static_cast(ud); - const SoEvent* ev = n->getEvent(); - if (ev->isOfType(SoKeyboardEvent::getClassTypeId())) { - const auto ke = static_cast(ev); - const SbBool press = ke->getState() == SoButtonEvent::DOWN ? true : false; - if (ke->getKey() == SoKeyboardEvent::ESCAPE) { - n->setHandled(); - // Handle it on key up, because otherwise upper layer will handle it too. - if (!press) { - endMeasureDistanceMode(ud, view, n, pm); - } - } - } - else if (ev->isOfType(SoMouseButtonEvent::getClassTypeId())) { - const auto mbe = static_cast(ev); - - // Mark all incoming mouse button events as handled, especially, to deactivate the selection node - n->getAction()->setHandled(); - - if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { - const SoPickedPoint * point = n->getPickedPoint(); - if (!point) { - Base::Console().Message("No point picked.\n"); - return; - } - - n->setHandled(); - pm->addPoint(point->getPoint()); - if (pm->countPoints() == 2) { - auto e = new QEvent(QEvent::User); - QApplication::postEvent(pm, e); - // leave mode - view->setEditing(false); - view->removeEventCallback(SoEvent::getClassTypeId(), measureDistanceCallback, ud); - } - } - else if (mbe->getButton() != SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) { - endMeasureDistanceMode(ud, view, n, pm); - } - } -} - -void ViewProviderMeasureDistance::endMeasureDistanceMode(void * ud, Gui::View3DInventorViewer* view, SoEventCallback * n, PointMarker *pm) -{ - n->setHandled(); - view->setEditing(false); - view->removeEventCallback(SoEvent::getClassTypeId(), ViewProviderMeasureDistance::measureDistanceCallback, ud); - Application::Instance->commandManager().testActive(); - pm->deleteLater(); -} diff --git a/src/Gui/ViewProviderMeasureDistance.h b/src/Gui/ViewProviderMeasureDistance.h deleted file mode 100644 index 48b039466c..0000000000 --- a/src/Gui/ViewProviderMeasureDistance.h +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2008 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_VIEWPROVIDERMEASUREDISTANCE_H -#define GUI_VIEWPROVIDERMEASUREDISTANCE_H - -#include "ViewProviderDocumentObject.h" -#include - -class SoFontStyle; -class SoText2; -class SoBaseColor; -class SoTranslation; -class SoCoordinate3; -class SoIndexedLineSet; -class SoEventCallback; -class SoMarkerSet; - -namespace Gui -{ - -class View3DInventorViewer; -class ViewProviderPointMarker; -class PointMarker : public QObject -{ -public: - explicit PointMarker(View3DInventorViewer* view); - ~PointMarker() override; - - void addPoint(const SbVec3f&); - int countPoints() const; - -protected: - void customEvent(QEvent* e) override; - -private: - View3DInventorViewer *view; - ViewProviderPointMarker *vp; - bool previousSelectionEn; -}; - -class GuiExport ViewProviderPointMarker : public ViewProviderDocumentObject -{ - PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderPointMarker); - -public: - ViewProviderPointMarker(); - ~ViewProviderPointMarker() override; - bool isPartOfPhysicalObject() const override; - -protected: - SoCoordinate3 * pCoords; - SoMarkerSet * pMarker; - friend class PointMarker; -}; - -class GuiExport ViewProviderMeasureDistance : public ViewProviderDocumentObject -{ - PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderMeasureDistance); - -public: - /// Constructor - ViewProviderMeasureDistance(); - ~ViewProviderMeasureDistance() override; - bool isPartOfPhysicalObject() const override; - - // Display properties - App::PropertyColor TextColor; - App::PropertyColor LineColor; - App::PropertyInteger FontSize; - App::PropertyFloat DistFactor; - App::PropertyBool Mirror; - - void attach(App::DocumentObject *) override; - void updateData(const App::Property*) override; - bool useNewSelectionModel() const override {return true;} - std::vector getDisplayModes() const override; - void setDisplayMode(const char* ModeName) override; - - static void measureDistanceCallback(void * ud, SoEventCallback * n); - -protected: - void onChanged(const App::Property* prop) override; - -private: - SoFontStyle * pFont; - SoText2 * pLabel; - SoBaseColor * pColor; - SoBaseColor * pTextColor; - SoTranslation * pTranslation; - SoCoordinate3 * pCoords; - SoIndexedLineSet * pLines; - - static void endMeasureDistanceMode(void * ud, Gui::View3DInventorViewer* view, SoEventCallback * n, PointMarker *pm); -}; - -} //namespace Gui - - -#endif // GUI_VIEWPROVIDERMEASUREDISTANCE_H diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index bc82acc494..e4ca175b20 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -719,7 +719,6 @@ MenuItem* StdWorkbench::setupMenuBar() const << "Std_ExportDependencyGraph" << "Std_ProjectUtil" << "Separator" - << "Std_MeasureDistance" << "Std_Measure" << "Separator" << "Std_TextDocument" @@ -805,7 +804,7 @@ ToolBarItem* StdWorkbench::setupToolBars() const view->setCommand("View"); *view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_ViewGroup" << "Std_AlignToSelection" << "Separator" << "Std_DrawStyle" << "Std_TreeViewActions" - << "Separator" << "Std_MeasureDistance" << "Std_Measure"; + << "Separator" << "Std_Measure"; // Individual views auto individualViews = new ToolBarItem(root, ToolBarItem::DefaultVisibility::Hidden); diff --git a/src/Mod/Measure/Gui/ViewProviderMeasureDistance.cpp b/src/Mod/Measure/Gui/ViewProviderMeasureDistance.cpp index e0357ed88c..bf2e8edc4f 100644 --- a/src/Mod/Measure/Gui/ViewProviderMeasureDistance.cpp +++ b/src/Mod/Measure/Gui/ViewProviderMeasureDistance.cpp @@ -42,11 +42,9 @@ #include #include -#include #include #include #include -#include "Mod/Measure/App/MeasureDistance.h" #include #include "ViewProviderMeasureDistance.h" diff --git a/src/Mod/Measure/Gui/ViewProviderMeasureDistance.h b/src/Mod/Measure/Gui/ViewProviderMeasureDistance.h index 28a229329d..945f6c7f78 100644 --- a/src/Mod/Measure/Gui/ViewProviderMeasureDistance.h +++ b/src/Mod/Measure/Gui/ViewProviderMeasureDistance.h @@ -23,14 +23,12 @@ #ifndef MEASUREGUI_VIEWPROVIDERMEASUREDISTANCE_H #define MEASUREGUI_VIEWPROVIDERMEASUREDISTANCE_H -#include - #include -#include - +#include #include "ViewProviderMeasureBase.h" + class SoCoordinate3; class SoIndexedLineSet;