From 7e3807ab493d5a88f6fab6693a0675f90e7c8ca7 Mon Sep 17 00:00:00 2001 From: jmaustpc Date: Tue, 5 Mar 2013 00:48:27 +1100 Subject: [PATCH] new Part Primitives icons, display tree icons Part Line and Circle New icons for Parametric Part Primitives Point, Line, Circle, Ellipse, Helix Display the icon in tree via independent viewproviders for Part Parametric Line and Circle Change Part Box tree icon to display yellow Part Box icon from the tool bar --- src/Mod/Part/App/FeaturePartCircle.h | 6 +- src/Mod/Part/App/PrimitiveFeature.h | 52 ++-- src/Mod/Part/Gui/AppPartGui.cpp | 4 + src/Mod/Part/Gui/CMakeLists.txt | 4 + src/Mod/Part/Gui/Resources/Part.qrc | 5 + .../icons/Part_Circle_Parametric.svg | 197 +++++++++++++++ .../icons/Part_Ellipse_Parametric.svg | 208 ++++++++++++++++ .../Resources/icons/Part_Helix_Parametric.svg | 230 ++++++++++++++++++ .../Resources/icons/Part_Line_Parametric.svg | 180 ++++++++++++++ .../Resources/icons/Part_Point_Parametric.svg | 172 +++++++++++++ src/Mod/Part/Gui/ViewProviderBox.cpp | 2 +- .../Part/Gui/ViewProviderCircleParametric.cpp | 75 ++++++ .../Part/Gui/ViewProviderCircleParametric.h | 64 +++++ .../Part/Gui/ViewProviderLineParametric.cpp | 75 ++++++ src/Mod/Part/Gui/ViewProviderLineParametric.h | 64 +++++ 15 files changed, 1312 insertions(+), 26 deletions(-) create mode 100644 src/Mod/Part/Gui/Resources/icons/Part_Circle_Parametric.svg create mode 100644 src/Mod/Part/Gui/Resources/icons/Part_Ellipse_Parametric.svg create mode 100644 src/Mod/Part/Gui/Resources/icons/Part_Helix_Parametric.svg create mode 100644 src/Mod/Part/Gui/Resources/icons/Part_Line_Parametric.svg create mode 100644 src/Mod/Part/Gui/Resources/icons/Part_Point_Parametric.svg create mode 100644 src/Mod/Part/Gui/ViewProviderCircleParametric.cpp create mode 100644 src/Mod/Part/Gui/ViewProviderCircleParametric.h create mode 100644 src/Mod/Part/Gui/ViewProviderLineParametric.cpp create mode 100644 src/Mod/Part/Gui/ViewProviderLineParametric.h diff --git a/src/Mod/Part/App/FeaturePartCircle.h b/src/Mod/Part/App/FeaturePartCircle.h index 1477df1f1..15dab6d75 100644 --- a/src/Mod/Part/App/FeaturePartCircle.h +++ b/src/Mod/Part/App/FeaturePartCircle.h @@ -47,10 +47,14 @@ public: App::DocumentObjectExecReturn *execute(void); short mustExecute() const; void onChanged(const App::Property*); - //@} + /// returns the type name of the ViewProvider + const char* getViewProviderName(void) const { + return "PartGui::ViewProviderCircleParametric"; + } private: static App::PropertyFloatConstraint::Constraints angleRange; + //@} }; } //namespace Part diff --git a/src/Mod/Part/App/PrimitiveFeature.h b/src/Mod/Part/App/PrimitiveFeature.h index 0c0b7b81d..4f1be5a9a 100644 --- a/src/Mod/Part/App/PrimitiveFeature.h +++ b/src/Mod/Part/App/PrimitiveFeature.h @@ -69,30 +69,34 @@ public: void onChanged(const App::Property*); //@} }; - -class PartExport Line : public Part::Primitive -{ - PROPERTY_HEADER(Part::Line); - -public: - Line(); - virtual ~Line(); - - App::PropertyFloat X1; - App::PropertyFloat Y1; - App::PropertyFloat Z1; - App::PropertyFloat X2; - App::PropertyFloat Y2; - App::PropertyFloat Z2; - - /** @name methods override feature */ - //@{ - /// recalculate the Feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - void onChanged(const App::Property*); - //@} -}; + +class PartExport Line : public Part::Primitive +{ + PROPERTY_HEADER(Part::Line); + +public: + Line(); + virtual ~Line(); + + App::PropertyFloat X1; + App::PropertyFloat Y1; + App::PropertyFloat Z1; + App::PropertyFloat X2; + App::PropertyFloat Y2; + App::PropertyFloat Z2; + + /** @name methods override feature */ + //@{ + /// recalculate the Feature + App::DocumentObjectExecReturn *execute(void); + short mustExecute() const; + void onChanged(const App::Property*); + /// returns the type name of the ViewProvider + const char* getViewProviderName(void) const { + return "PartGui::ViewProviderLineParametric"; + } + //@} +}; class PartExport Plane : public Primitive { diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index 17b65090a..d6a0967fe 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -36,6 +36,8 @@ #include "ViewProvider2DObject.h" #include "ViewProviderMirror.h" #include "ViewProviderBoolean.h" +#include "ViewProviderCircleParametric.h" +#include "ViewProviderLineParametric.h" #include "DlgSettingsGeneral.h" #include "DlgSettings3DViewPartImp.h" @@ -112,6 +114,8 @@ void PartGuiExport initPartGui() PartGui::ViewProviderBoolean ::init(); PartGui::ViewProviderMultiFuse ::init(); PartGui::ViewProviderMultiCommon ::init(); + PartGui::ViewProviderCircleParametric ::init(); + PartGui::ViewProviderLineParametric ::init(); PartGui::Workbench ::init(); diff --git a/src/Mod/Part/Gui/CMakeLists.txt b/src/Mod/Part/Gui/CMakeLists.txt index 15f0d3335..ddec97a3b 100644 --- a/src/Mod/Part/Gui/CMakeLists.txt +++ b/src/Mod/Part/Gui/CMakeLists.txt @@ -136,6 +136,10 @@ SET(PartGui_SRCS ViewProviderReference.h ViewProviderBox.cpp ViewProviderBox.h + ViewProviderCircleParametric.cpp + ViewProviderCircleParametric.h + ViewProviderLineParametric.cpp + ViewProviderLineParametric.h ViewProviderCurveNet.cpp ViewProviderCurveNet.h ViewProviderImport.cpp diff --git a/src/Mod/Part/Gui/Resources/Part.qrc b/src/Mod/Part/Gui/Resources/Part.qrc index f1abadd4f..ac45d7f6d 100644 --- a/src/Mod/Part/Gui/Resources/Part.qrc +++ b/src/Mod/Part/Gui/Resources/Part.qrc @@ -33,6 +33,11 @@ icons/preferences-part_design.svg icons/Tree_Part.svg icons/Part_CheckGeometry.svg + icons/Part_Ellipse_Parametric.svg + icons/Part_Helix_Parametric.svg + icons/Part_Line_Parametric.svg + icons/Part_Circle_Parametric.svg + icons/Part_Point_Parametric.svg translations/Part_af.qm translations/Part_de.qm translations/Part_fi.qm diff --git a/src/Mod/Part/Gui/Resources/icons/Part_Circle_Parametric.svg b/src/Mod/Part/Gui/Resources/icons/Part_Circle_Parametric.svg new file mode 100644 index 000000000..0f23f90ed --- /dev/null +++ b/src/Mod/Part/Gui/Resources/icons/Part_Circle_Parametric.svg @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/Mod/Part/Gui/Resources/icons/Part_Ellipse_Parametric.svg b/src/Mod/Part/Gui/Resources/icons/Part_Ellipse_Parametric.svg new file mode 100644 index 000000000..f3d6e5fa7 --- /dev/null +++ b/src/Mod/Part/Gui/Resources/icons/Part_Ellipse_Parametric.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/Mod/Part/Gui/Resources/icons/Part_Helix_Parametric.svg b/src/Mod/Part/Gui/Resources/icons/Part_Helix_Parametric.svg new file mode 100644 index 000000000..333781322 --- /dev/null +++ b/src/Mod/Part/Gui/Resources/icons/Part_Helix_Parametric.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/Mod/Part/Gui/Resources/icons/Part_Line_Parametric.svg b/src/Mod/Part/Gui/Resources/icons/Part_Line_Parametric.svg new file mode 100644 index 000000000..685498cf3 --- /dev/null +++ b/src/Mod/Part/Gui/Resources/icons/Part_Line_Parametric.svg @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/src/Mod/Part/Gui/Resources/icons/Part_Point_Parametric.svg b/src/Mod/Part/Gui/Resources/icons/Part_Point_Parametric.svg new file mode 100644 index 000000000..1a0509b48 --- /dev/null +++ b/src/Mod/Part/Gui/Resources/icons/Part_Point_Parametric.svg @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/Mod/Part/Gui/ViewProviderBox.cpp b/src/Mod/Part/Gui/ViewProviderBox.cpp index d04880dbe..f6a81705e 100644 --- a/src/Mod/Part/Gui/ViewProviderBox.cpp +++ b/src/Mod/Part/Gui/ViewProviderBox.cpp @@ -48,7 +48,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderBox, PartGui::ViewProviderPart) ViewProviderBox::ViewProviderBox() { - sPixmap = "PartFeatureImport"; + sPixmap = "Part_Box.svg"; } ViewProviderBox::~ViewProviderBox() diff --git a/src/Mod/Part/Gui/ViewProviderCircleParametric.cpp b/src/Mod/Part/Gui/ViewProviderCircleParametric.cpp new file mode 100644 index 000000000..e458624a5 --- /dev/null +++ b/src/Mod/Part/Gui/ViewProviderCircleParametric.cpp @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (c) 2004 Jürgen Riegel * + * * + * 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_ +#endif + +/// Here the FreeCAD includes sorted by Base,App,Gui...... +#include + +#include "ViewProviderCircleParametric.h" + + +//#include "Tree.h" + + + +using namespace PartGui; +using namespace std; + + +//************************************************************************** +// Construction/Destruction + +PROPERTY_SOURCE(PartGui::ViewProviderCircleParametric, PartGui::ViewProviderPart) + + +ViewProviderCircleParametric::ViewProviderCircleParametric() +{ + sPixmap = "Part_Circle_Parametric.svg"; +} + +ViewProviderCircleParametric::~ViewProviderCircleParametric() +{ + +} + + + +// ********************************************************************************** + +std::vector ViewProviderCircleParametric::getDisplayModes(void) const +{ + // get the modes of the father + std::vector StrList; + + // add your own modes + StrList.push_back("Flat Lines"); + StrList.push_back("Shaded"); + StrList.push_back("Wireframe"); + StrList.push_back("Points"); + + return StrList; +} diff --git a/src/Mod/Part/Gui/ViewProviderCircleParametric.h b/src/Mod/Part/Gui/ViewProviderCircleParametric.h new file mode 100644 index 000000000..888a0d98f --- /dev/null +++ b/src/Mod/Part/Gui/ViewProviderCircleParametric.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (c) 2004 Jürgen Riegel * + * * + * 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 PARTGUI_VIEWPROVIDERCIRCLEPARAMETRIC_H +#define PARTGUI_VIEWPROVIDERCIRCLEPARAMETRIC_H + +#include "ViewProvider.h" + + +class TopoDS_Shape; +class TopoDS_Face; +class SoSeparator; +class SbVec3f; +class SoTransform; + +namespace Gui { + class View3DInventorViewer; + class SoFCSelection; +} + +namespace PartGui { + + +class PartGuiExport ViewProviderCircleParametric:public ViewProviderPart +{ + PROPERTY_HEADER(PartGui::ViewProviderCircleParametric); + +public: + /// constructor + ViewProviderCircleParametric(); + /// destructor + virtual ~ViewProviderCircleParametric(); + + std::vector getDisplayModes(void) const; + +protected: + +}; + +} // namespace PartGui + + +#endif // PARTGUI_VIEWPROVIDERCIRCLEPARAMETRIC_H + diff --git a/src/Mod/Part/Gui/ViewProviderLineParametric.cpp b/src/Mod/Part/Gui/ViewProviderLineParametric.cpp new file mode 100644 index 000000000..f032fbe05 --- /dev/null +++ b/src/Mod/Part/Gui/ViewProviderLineParametric.cpp @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (c) 2004 Jürgen Riegel * + * * + * 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_ +#endif + +/// Here the FreeCAD includes sorted by Base,App,Gui...... +#include + +#include "ViewProviderLineParametric.h" + + +//#include "Tree.h" + + + +using namespace PartGui; +using namespace std; + + +//************************************************************************** +// Construction/Destruction + +PROPERTY_SOURCE(PartGui::ViewProviderLineParametric, PartGui::ViewProviderPart) + + +ViewProviderLineParametric::ViewProviderLineParametric() +{ + sPixmap = "Part_Line_Parametric.svg"; +} + +ViewProviderLineParametric::~ViewProviderLineParametric() +{ + +} + + + +// ********************************************************************************** + +std::vector ViewProviderLineParametric::getDisplayModes(void) const +{ + // get the modes of the father + std::vector StrList; + + // add your own modes + StrList.push_back("Flat Lines"); + StrList.push_back("Shaded"); + StrList.push_back("Wireframe"); + StrList.push_back("Points"); + + return StrList; +} diff --git a/src/Mod/Part/Gui/ViewProviderLineParametric.h b/src/Mod/Part/Gui/ViewProviderLineParametric.h new file mode 100644 index 000000000..aff41d1c0 --- /dev/null +++ b/src/Mod/Part/Gui/ViewProviderLineParametric.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (c) 2004 Jürgen Riegel * + * * + * 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 PARTGUI_VIEWPROVIDERLINEPARAMETRIC_H +#define PARTGUI_VIEWPROVIDERLINEPARAMETRIC_H + +#include "ViewProvider.h" + + +class TopoDS_Shape; +class TopoDS_Face; +class SoSeparator; +class SbVec3f; +class SoTransform; + +namespace Gui { + class View3DInventorViewer; + class SoFCSelection; +} + +namespace PartGui { + + +class PartGuiExport ViewProviderLineParametric:public ViewProviderPart +{ + PROPERTY_HEADER(PartGui::ViewProviderLineParametric); + +public: + /// constructor + ViewProviderLineParametric(); + /// destructor + virtual ~ViewProviderLineParametric(); + + std::vector getDisplayModes(void) const; + +protected: + +}; + +} // namespace PartGui + + +#endif // PARTGUI_VIEWPROVIDERCIRCLEPARAMETRIC_H +