FreeCAD

Форк
0
/
ViewProviderRuledSurface.cpp 
108 строк · 4.5 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de>              *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24

25
#include <Gui/Application.h>
26
#include <Mod/Part/App/PartFeatures.h>
27

28
#include "ViewProviderRuledSurface.h"
29

30

31
using namespace PartGui;
32
using namespace std;
33

34
//**************************************************************************
35
// Construction/Destruction
36

37
PROPERTY_SOURCE(PartGui::ViewProviderRuledSurface, PartGui::ViewProviderPart)
38

39

40
ViewProviderRuledSurface::ViewProviderRuledSurface()
41
{
42
  sPixmap = "Part_RuledSurface.svg";
43
}
44

45
ViewProviderRuledSurface::~ViewProviderRuledSurface() = default;
46

47
std::vector<App::DocumentObject*> ViewProviderRuledSurface::claimChildren() const
48
{
49
    // in a set each element is unique
50
    std::set<App::DocumentObject*> temp;
51
    temp.insert(static_cast<Part::RuledSurface*>(getObject())->Curve1.getValue());
52
    temp.insert(static_cast<Part::RuledSurface*>(getObject())->Curve2.getValue());
53

54
    std::vector<App::DocumentObject*> array;
55
    array.insert(array.begin(), temp.begin(), temp.end());
56
    return array;
57
}
58

59
void ViewProviderRuledSurface::updateData(const App::Property* prop)
60
{
61
    PartGui::ViewProviderPart::updateData(prop);
62
    if (prop->is<Part::PropertyShapeHistory>()) {
63
        //const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
64
        //    (prop)->getValues();
65
    }
66
    /*  //The following hides the Children shapes. If the edges from which the Ruled Surface was created
67
     * were selected from the subshapes of another shape, it is likely that one would not want to hide the shape
68
     * hence this section is commented out
69
    Part::RuledSurface* pRuledSurface = static_cast<Part::RuledSurface*>(getObject());
70
    App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue();
71
    App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue();
72
    if (pCurve1)
73
        Gui::Application::Instance->hideViewProvider(pCurve1);
74
    if (pCurve2)
75
        Gui::Application::Instance->hideViewProvider(pCurve2);*/
76

77
    }
78

79
bool ViewProviderRuledSurface::onDelete(const std::vector<std::string> &)
80
{
81
    // get the input shape
82
    Part::RuledSurface* pRuledSurface = static_cast<Part::RuledSurface*>(getObject());
83
    App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue();
84
    App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue();
85
    if (pCurve1)
86
        Gui::Application::Instance->showViewProvider(pCurve1);
87
    if (pCurve2)
88
        Gui::Application::Instance->showViewProvider(pCurve2);
89

90
    return true;
91
}
92

93

94
// **********************************************************************************
95

96
std::vector<std::string> ViewProviderRuledSurface::getDisplayModes() const
97
{
98
  // get the modes of the father
99
  std::vector<std::string> StrList;
100

101
  // add your own modes
102
  StrList.emplace_back("Flat Lines");
103
  StrList.emplace_back("Shaded");
104
  StrList.emplace_back("Wireframe");
105
  StrList.emplace_back("Points");
106

107
  return StrList;
108
}
109

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.