00001 /*************************************************************************** 00002 * Copyright (c) 2011 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 00024 #ifndef INSPECTIOGUI_VIEWPROVIDERINSPECTION_H 00025 #define INSPECTIOGUI_VIEWPROVIDERINSPECTION_H 00026 00027 #include <Base/Observer.h> 00028 #include <Gui/ViewProviderDocumentObject.h> 00029 #include <Gui/ViewProviderDocumentObjectGroup.h> 00030 00031 class SoGroup; 00032 class SoMaterial; 00033 class SoMaterialBinding; 00034 class SoDrawStyle; 00035 class SoSeparator; 00036 class SoCoordinate3; 00037 00038 namespace Gui { 00039 class SoFCColorBar; 00040 class View3DInventorViewer; 00041 } 00042 00043 namespace InspectionGui { 00044 00048 class ViewProviderInspection : public Gui::ViewProviderDocumentObject, 00049 public Base::Observer<int>{ 00050 typedef ViewProviderDocumentObject inherited; 00051 00052 PROPERTY_HEADER(InspectionGui::ViewProviderInspection); 00053 00054 public: 00055 ViewProviderInspection(); 00056 virtual ~ViewProviderInspection(); 00057 00058 App::PropertyBool OutsideGrayed; 00059 App::PropertyFloatConstraint PointSize; 00060 00061 void attach(App::DocumentObject *pcFeat); 00063 void setDisplayMode(const char* ModeName); 00065 std::vector<std::string> getDisplayModes(void) const; 00067 void updateData(const App::Property*); 00069 void OnChange(Base::Subject<int> &rCaller,int rcReason); 00070 QIcon getIcon() const; 00072 SoSeparator* getFrontRoot(void) const; 00074 virtual void hide(void); 00076 virtual void show(void); 00077 00078 static void inspectCallback(void * ud, SoEventCallback * n); 00079 00080 protected: 00081 void onChanged(const App::Property* prop); 00082 void setDistances(); 00083 QString inspectDistance(const SoPickedPoint* pp) const; 00084 00085 protected: 00086 SoMaterial * pcColorMat; 00087 SoMaterialBinding* pcMatBinding; 00088 SoGroup * pcLinkRoot; 00089 Gui::SoFCColorBar* pcColorBar; 00090 SoDrawStyle * pcColorStyle; 00091 SoDrawStyle * pcPointStyle; 00092 SoSeparator * pcColorRoot; 00093 SoCoordinate3 * pcCoords; 00094 00095 private: 00096 float search_radius; 00097 static bool addflag; 00098 static App::PropertyFloatConstraint::Constraints floatRange; 00099 }; 00100 00101 class ViewProviderInspectionGroup : public Gui::ViewProviderDocumentObjectGroup 00102 { 00103 PROPERTY_HEADER(InspectionGui::ViewProviderInspectionGroup); 00104 00105 public: 00107 ViewProviderInspectionGroup(); 00109 virtual ~ViewProviderInspectionGroup(); 00110 QIcon getIcon() const; 00111 }; 00112 00113 } // namespace InspectionGui 00114 00115 00116 #endif // INSPECTIOGUI_VIEWPROVIDERINSPECTION_H 00117