~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Mod/Mesh/Gui/ViewProviderCurvature.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (c) 2004 Werner Mayer <werner.wm.mayer@gmx.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
#ifndef MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
 
24
#define MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
 
25
 
 
26
#include <Base/Observer.h>
 
27
#include <App/DocumentObserver.h>
 
28
#include "ViewProvider.h"
 
29
 
 
30
class SoSeparator;
 
31
class SbVec3f;
 
32
class SoSwitch;
 
33
class SoCoordinate3;
 
34
class SoNormal;
 
35
class SoIndexedFaceSet;
 
36
class SoFaceSet;
 
37
class SoPath;
 
38
class SoLocateHighlight;
 
39
class SoTransformerManip;
 
40
 
 
41
namespace Gui {
 
42
  class SoFCColorBar;
 
43
  class View3DInventorViewer;
 
44
}
 
45
 
 
46
namespace Mesh {
 
47
  class PropertyCurvatureList;
 
48
}
 
49
 
 
50
namespace MeshGui {
 
51
 
 
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.
 
55
 *
 
56
 * @author Werner Mayer
 
57
 */
 
58
class MeshGuiExport ViewProviderMeshCurvature : public Gui::ViewProviderDocumentObject,
 
59
                                                public App::DocumentObserver,
 
60
                                                public Base::Observer<int> {
 
61
    typedef Gui::ViewProviderDocumentObject inherited;
 
62
 
 
63
    PROPERTY_HEADER(MeshGui::ViewProviderMeshCurvature);
 
64
 
 
65
public:
 
66
    ViewProviderMeshCurvature();
 
67
    virtual ~ViewProviderMeshCurvature();
 
68
 
 
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;
 
85
 
 
86
public:
 
87
    static void curvatureInfoCallback(void * ud, SoEventCallback * n);
 
88
 
 
89
protected:
 
90
    void setVertexCurvatureMode(int mode);
 
91
    void curvatureInfo(int index1, int index2, int index3) const;
 
92
 
 
93
private:
 
94
    void init(const Mesh::PropertyCurvatureList *prop);
 
95
 
 
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);
 
106
 
 
107
protected:
 
108
    SoMaterial       * pcColorMat;
 
109
    SoGroup          * pcLinkRoot;
 
110
    Gui::SoFCColorBar* pcColorBar;
 
111
};
 
112
 
 
113
} // namespace MeshGui
 
114
 
 
115
 
 
116
#endif // MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
 
117