From 7750c4dfbf45b044e20e98b26ff76a1edae6d4da Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Wed, 30 Sep 2020 13:45:32 -0500 Subject: [PATCH] Surface: ViewProviderExtend for Surface::Extend object This is created by the Surface_ExtendFace command. --- src/Mod/Surface/App/FeatureExtend.h | 4 +++ src/Mod/Surface/Gui/AppSurfaceGui.cpp | 5 +-- src/Mod/Surface/Gui/CMakeLists.txt | 2 ++ src/Mod/Surface/Gui/ViewProviderExtend.cpp | 41 +++++++++++++++++++++ src/Mod/Surface/Gui/ViewProviderExtend.h | 42 ++++++++++++++++++++++ 5 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 src/Mod/Surface/Gui/ViewProviderExtend.cpp create mode 100644 src/Mod/Surface/Gui/ViewProviderExtend.h diff --git a/src/Mod/Surface/App/FeatureExtend.h b/src/Mod/Surface/App/FeatureExtend.h index cc8cd34954..774d106837 100644 --- a/src/Mod/Surface/App/FeatureExtend.h +++ b/src/Mod/Surface/App/FeatureExtend.h @@ -53,6 +53,10 @@ public: // recalculate the feature App::DocumentObjectExecReturn *execute(void) override; short mustExecute() const override; + /// returns the type name of the view provider + const char* getViewProviderName(void) const override { + return "SurfaceGui::ViewProviderExtend"; + } protected: virtual void onChanged(const App::Property* prop) override; diff --git a/src/Mod/Surface/Gui/AppSurfaceGui.cpp b/src/Mod/Surface/Gui/AppSurfaceGui.cpp index 415f001c3a..dc448da91e 100644 --- a/src/Mod/Surface/Gui/AppSurfaceGui.cpp +++ b/src/Mod/Surface/Gui/AppSurfaceGui.cpp @@ -37,6 +37,7 @@ #include "TaskGeomFillSurface.h" #include "TaskFilling.h" #include "TaskSections.h" +#include "ViewProviderExtend.h" // use a different name to CreateCommand() void CreateSurfaceCommands(void); @@ -81,8 +82,8 @@ PyMOD_INIT_FUNC(SurfaceGui) SurfaceGui::ViewProviderGeomFillSurface ::init(); SurfaceGui::ViewProviderFilling ::init(); SurfaceGui::ViewProviderSections ::init(); - -// SurfaceGui::ViewProviderCut::init(); + SurfaceGui::ViewProviderExtend::init(); + // SurfaceGui::ViewProviderCut::init(); PyObject* mod = SurfaceGui::initModule(); Base::Console().Log("Loading GUI of Surface module... done\n"); diff --git a/src/Mod/Surface/Gui/CMakeLists.txt b/src/Mod/Surface/Gui/CMakeLists.txt index cfef5bbede..60450ef0e0 100644 --- a/src/Mod/Surface/Gui/CMakeLists.txt +++ b/src/Mod/Surface/Gui/CMakeLists.txt @@ -70,6 +70,8 @@ SET(SurfaceGui_SRCS Command.cpp PreCompiled.cpp PreCompiled.h + ViewProviderExtend.cpp + ViewProviderExtend.h Workbench.cpp Workbench.h # ViewProviderCut.cpp diff --git a/src/Mod/Surface/Gui/ViewProviderExtend.cpp b/src/Mod/Surface/Gui/ViewProviderExtend.cpp new file mode 100644 index 0000000000..ed5b5f261f --- /dev/null +++ b/src/Mod/Surface/Gui/ViewProviderExtend.cpp @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (c) 2020 Eliud Cabrera Castillo * + * * + * 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 +#include + +#include "ViewProviderExtend.h" + +using namespace SurfaceGui; + +PROPERTY_SOURCE(SurfaceGui::ViewProviderExtend, PartGui::ViewProviderSpline) + +namespace SurfaceGui { + +QIcon ViewProviderExtend::getIcon(void) const +{ + return Gui::BitmapFactory().pixmap("Surface_Extend"); +} + +} //namespace SurfaceGui diff --git a/src/Mod/Surface/Gui/ViewProviderExtend.h b/src/Mod/Surface/Gui/ViewProviderExtend.h new file mode 100644 index 0000000000..2c8b6824ea --- /dev/null +++ b/src/Mod/Surface/Gui/ViewProviderExtend.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (c) 2020 Eliud Cabrera Castillo * + * * + * 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 SURFACEGUI_VIEWPROVIDEREXTEND_H +#define SURFACEGUI_VIEWPROVIDEREXTEND_H + +#include +#include + +namespace SurfaceGui +{ + +class ViewProviderExtend : public PartGui::ViewProviderSpline +{ + PROPERTY_HEADER(SurfaceGui::ViewProviderExtend); + +public: + QIcon getIcon(void) const; +}; + +} //namespace SurfaceGui + +#endif // SURFACEGUI_VIEWPROVIDEREXTEND_H