1
/***************************************************************************
2
* Copyright (c) 2004 Werner Mayer <werner.wm.mayer@gmx.de> *
4
* This file is part of the FreeCAD CAx development system. *
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. *
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. *
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 *
21
***************************************************************************/
24
#include "PreCompiled.h"
27
# include <Inventor/nodes/SoDrawStyle.h>
28
# include <Inventor/nodes/SoMaterial.h>
29
# include <Inventor/nodes/SoNormalBinding.h>
30
# include <Inventor/nodes/SoIndexedFaceSet.h>
31
# include <Inventor/manips/SoTransformerManip.h>
34
/// Here the FreeCAD includes sorted by Base,App,Gui......
35
#include <Base/Console.h>
36
#include <Base/Parameter.h>
37
#include <Base/Exception.h>
38
#include <App/Application.h>
39
#include <Gui/Selection.h>
40
#include <Gui/SoFCSelection.h>
41
#include <Base/Sequencer.h>
43
#include "ViewProvider.h"
44
#include "ViewProviderTransform.h"
46
#include <Mod/Mesh/App/MeshFeature.h>
47
#include <Mod/Mesh/App/Mesh.h>
48
#include <Mod/Mesh/App/Core/Iterator.h>
50
using namespace MeshGui;
54
PROPERTY_SOURCE(MeshGui::ViewProviderMeshTransform, MeshGui::ViewProviderMesh)
57
ViewProviderMeshTransform::ViewProviderMeshTransform()
59
pcTransformerDragger = new SoTransformerManip();
60
pcTransformerDragger->ref();
63
ViewProviderMeshTransform::~ViewProviderMeshTransform()
65
pcTransformerDragger->unref();
68
void ViewProviderMeshTransform::attach(App::DocumentObject *pcFeat)
70
// creats the standard viewing modes
71
ViewProviderMesh::attach(pcFeat);
73
SoSeparator* pcEditRoot = new SoSeparator();
75
// flat shaded (Normal) ------------------------------------------
76
SoDrawStyle *pcFlatStyle = new SoDrawStyle();
77
pcFlatStyle->style = SoDrawStyle::FILLED;
78
SoNormalBinding* pcBinding = new SoNormalBinding();
79
pcBinding->value=SoNormalBinding::PER_FACE;
81
pcEditRoot->addChild(pcTransformerDragger);
82
pcEditRoot->addChild(pcFlatStyle);
83
pcEditRoot->addChild(pcShapeMaterial);
84
pcEditRoot->addChild(pcBinding);
85
pcEditRoot->addChild(pcHighlight);
87
// adding to the switch
88
addDisplayMaskMode(pcEditRoot, "Edit");
91
void ViewProviderMeshTransform::updateData(const App::Property* prop)
93
ViewProviderMesh::updateData(prop);
96
void ViewProviderMeshTransform::setDisplayMode(const char* ModeName)
98
if ( strcmp("Transform",ModeName) == 0 )
99
setDisplayMaskMode("Edit");
100
ViewProviderMesh::setDisplayMode(ModeName);
103
const char* ViewProviderMeshTransform::getDefaultDisplayMode() const
108
std::vector<std::string> ViewProviderMeshTransform::getDisplayModes(void) const
110
std::vector<std::string> StrList = ViewProviderMesh::getDisplayModes();
111
StrList.push_back("Transform");