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
***************************************************************************/
23
#ifndef MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
24
#define MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
26
#include <Base/Observer.h>
27
#include <App/DocumentObserver.h>
28
#include "ViewProvider.h"
35
class SoIndexedFaceSet;
38
class SoLocateHighlight;
39
class SoTransformerManip;
43
class View3DInventorViewer;
47
class PropertyCurvatureList;
52
/** The ViewProviderMeshCurvature class is associated to the mesh curvature feature. It allows to display the most known types of
53
* curvatures, such as Gaussian curvature, mean curvature, minimum and maximum curvature.
54
* Moreover a color bar is also added to the scene.
56
* @author Werner Mayer
58
class MeshGuiExport ViewProviderMeshCurvature : public Gui::ViewProviderDocumentObject,
59
public App::DocumentObserver,
60
public Base::Observer<int> {
61
typedef Gui::ViewProviderDocumentObject inherited;
63
PROPERTY_HEADER(MeshGui::ViewProviderMeshCurvature);
66
ViewProviderMeshCurvature();
67
virtual ~ViewProviderMeshCurvature();
69
/// Extracts the mesh data from the feature \a pcFeature and creates an Inventor node \a SoNode with these data.
70
void attach(App::DocumentObject* pcFeature);
71
/// Sets the viewing mode
72
void setDisplayMode(const char* ModeName);
73
/// get the default display mode
74
virtual const char* getDefaultDisplayMode() const;
75
/// Returns a list of all possible modes
76
std::vector<std::string> getDisplayModes(void) const;
77
/// Updates the mesh feature representation
78
void updateData(const App::Property*);
79
/// Returns a pixmap for the associated feature type
80
QIcon getIcon() const;
81
/// Once the color bar settinhs has been changed this method gets called to update the feature's representation
82
void OnChange(Base::Subject<int> &rCaller,int rcReason);
83
/// Returns a color bar
84
SoSeparator* getFrontRoot(void) const;
87
static void curvatureInfoCallback(void * ud, SoEventCallback * n);
90
void setVertexCurvatureMode(int mode);
91
void curvatureInfo(int index1, int index2, int index3) const;
94
void init(const Mesh::PropertyCurvatureList *prop);
96
/** Checks if a new document was created */
97
void slotCreatedDocument(App::Document& Doc);
98
/** Checks if the given document is about to be closed */
99
void slotDeletedDocument(App::Document& Doc);
100
/** Checks if a new object was added. */
101
void slotCreatedObject(App::DocumentObject& Obj);
102
/** Checks if the given object is about to be removed. */
103
void slotDeletedObject(App::DocumentObject& Obj);
104
/** The property of an observed object has changed */
105
void slotChangedObject(App::DocumentObject& Obj, App::Property& Prop);
108
SoMaterial * pcColorMat;
109
SoGroup * pcLinkRoot;
110
Gui::SoFCColorBar* pcColorBar;
113
} // namespace MeshGui
116
#endif // MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H