ViewProviderCurvature.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
00024 #define MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
00025 
00026 #include <Base/Observer.h>
00027 #include <App/DocumentObserver.h>
00028 #include "ViewProvider.h"
00029 
00030 class SoSeparator;
00031 class SbVec3f;
00032 class SoSwitch;
00033 class SoCoordinate3;
00034 class SoNormal;
00035 class SoIndexedFaceSet;
00036 class SoFaceSet;
00037 class SoPath;
00038 class SoLocateHighlight;
00039 class SoTransformerManip;
00040 
00041 namespace Gui {
00042   class SoFCColorBar;
00043   class View3DInventorViewer;
00044 }
00045 
00046 namespace Mesh {
00047   class PropertyCurvatureList;
00048 }
00049 
00050 namespace MeshGui {
00051 
00058 class MeshGuiExport ViewProviderMeshCurvature : public Gui::ViewProviderDocumentObject,
00059                                                 public App::DocumentObserver,
00060                                                 public Base::Observer<int> {
00061     typedef Gui::ViewProviderDocumentObject inherited;
00062 
00063     PROPERTY_HEADER(MeshGui::ViewProviderMeshCurvature);
00064 
00065 public:
00066     ViewProviderMeshCurvature();
00067     virtual ~ViewProviderMeshCurvature();
00068 
00069     App::PropertyMaterial TextureMaterial;
00070 
00072     void attach(App::DocumentObject* pcFeature);
00074     void setDisplayMode(const char* ModeName);
00076     virtual const char* getDefaultDisplayMode() const;
00078     std::vector<std::string> getDisplayModes(void) const;
00080     void updateData(const App::Property*);
00082     QIcon getIcon() const;
00084     void OnChange(Base::Subject<int> &rCaller,int rcReason);
00086     SoSeparator* getFrontRoot(void) const;
00088     virtual void hide(void);
00090     virtual void show(void);
00091 
00092 public:
00093     static void curvatureInfoCallback(void * ud, SoEventCallback * n);
00094 
00095 protected:
00096     void onChanged(const App::Property* prop);
00097     void setVertexCurvatureMode(int mode);
00098     std::string curvatureInfo(bool detail, int index1, int index2, int index3) const;
00099 
00100 private:
00101     void init(const Mesh::PropertyCurvatureList *prop);
00102 
00104     void slotCreatedDocument(const App::Document& Doc);
00106     void slotDeletedDocument(const App::Document& Doc);
00108     void slotCreatedObject(const App::DocumentObject& Obj);
00110     void slotDeletedObject(const App::DocumentObject& Obj);
00112     void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);
00113 
00114 protected:
00115     SoMaterial       * pcColorMat;
00116     SoGroup          * pcLinkRoot;
00117     Gui::SoFCColorBar* pcColorBar;
00118     SoDrawStyle      * pcColorStyle;
00119     SoSeparator      * pcColorRoot;
00120 
00121 private:
00122     static bool addflag;
00123 };
00124 
00125 } // namespace MeshGui
00126 
00127 
00128 #endif // MESHGUI_VIEWPROVIDER_MESH_CURVATURE_H
00129 

Generated on Wed Nov 23 19:00:58 2011 for FreeCAD by  doxygen 1.6.1