FreeCAD

Форк
0
/
ViewProviderTransform.cpp 
102 строки · 3.8 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net>     *
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
#ifndef _PreComp_
25
#include <Inventor/manips/SoTransformerManip.h>
26
#include <Inventor/nodes/SoDrawStyle.h>
27
#include <Inventor/nodes/SoMaterial.h>
28
#include <Inventor/nodes/SoNormalBinding.h>
29
#include <Inventor/nodes/SoSeparator.h>
30
#endif
31

32
#include <Gui/SoFCSelection.h>
33
#include <Mod/Mesh/App/MeshFeature.h>
34

35
#include "ViewProviderTransform.h"
36

37

38
using namespace MeshGui;
39
using Mesh::Feature;
40

41
PROPERTY_SOURCE(MeshGui::ViewProviderMeshTransform, MeshGui::ViewProviderMesh)
42

43
ViewProviderMeshTransform::ViewProviderMeshTransform()
44
{
45
    // NOLINTBEGIN
46
    pcTransformerDragger = new SoTransformerManip();
47
    pcTransformerDragger->ref();
48
    // NOLINTEND
49
}
50

51
ViewProviderMeshTransform::~ViewProviderMeshTransform()
52
{
53
    pcTransformerDragger->unref();
54
}
55

56
void ViewProviderMeshTransform::attach(App::DocumentObject* pcFeat)
57
{
58
    // creates the standard viewing modes
59
    ViewProviderMesh::attach(pcFeat);
60

61
    SoSeparator* pcEditRoot = new SoSeparator();
62

63
    // flat shaded (Normal) ------------------------------------------
64
    SoDrawStyle* pcFlatStyle = new SoDrawStyle();
65
    pcFlatStyle->style = SoDrawStyle::FILLED;
66
    SoNormalBinding* pcBinding = new SoNormalBinding();
67
    pcBinding->value = SoNormalBinding::PER_FACE;
68

69
    pcEditRoot->addChild(pcTransformerDragger);
70
    pcEditRoot->addChild(pcFlatStyle);
71
    pcEditRoot->addChild(pcShapeMaterial);
72
    pcEditRoot->addChild(pcBinding);
73
    pcEditRoot->addChild(pcHighlight);
74

75
    // adding to the switch
76
    addDisplayMaskMode(pcEditRoot, "Edit");
77
}
78

79
void ViewProviderMeshTransform::updateData(const App::Property* prop)
80
{
81
    ViewProviderMesh::updateData(prop);
82
}
83

84
void ViewProviderMeshTransform::setDisplayMode(const char* ModeName)
85
{
86
    if (strcmp("Transform", ModeName) == 0) {
87
        setDisplayMaskMode("Edit");
88
    }
89
    ViewProviderMesh::setDisplayMode(ModeName);
90
}
91

92
const char* ViewProviderMeshTransform::getDefaultDisplayMode() const
93
{
94
    return "Transform";
95
}
96

97
std::vector<std::string> ViewProviderMeshTransform::getDisplayModes() const
98
{
99
    std::vector<std::string> StrList = ViewProviderMesh::getDisplayModes();
100
    StrList.emplace_back("Transform");
101
    return StrList;
102
}
103

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

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

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

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