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 POINTSGUI_VIEWPROVIDERPOINTS_H 00024 #define POINTSGUI_VIEWPROVIDERPOINTS_H 00025 00026 #include <Base/Vector3D.h> 00027 #include <Gui/ViewProviderGeometryObject.h> 00028 #include <Gui/ViewProviderPythonFeature.h> 00029 #include <Gui/ViewProviderBuilder.h> 00030 #include <Inventor/SbVec2f.h> 00031 00032 00033 class SoSwitch; 00034 class SoPointSet; 00035 class SoLocateHighlight; 00036 class SoCoordinate3; 00037 class SoNormal; 00038 class SoEventCallback; 00039 00040 namespace App { 00041 class PropertyColorList; 00042 } 00043 00044 namespace Gui { 00045 class SoFCSelection; 00046 } 00047 00048 namespace Points { 00049 class PropertyGreyValueList; 00050 class PropertyNormalList; 00051 class PointKernel; 00052 class Feature; 00053 } 00054 00055 namespace PointsGui { 00056 00057 class ViewProviderPointsBuilder : public Gui::ViewProviderBuilder 00058 { 00059 public: 00060 ViewProviderPointsBuilder(){} 00061 ~ViewProviderPointsBuilder(){} 00062 virtual void buildNodes(const App::Property*, std::vector<SoNode*>&) const; 00063 void createPoints(const App::Property*, SoCoordinate3*, SoPointSet*) const; 00064 }; 00065 00071 class PointsGuiExport ViewProviderPoints : public Gui::ViewProviderGeometryObject 00072 { 00073 PROPERTY_HEADER(PointsGui::ViewProviderPoints); 00074 00075 public: 00076 ViewProviderPoints(); 00077 virtual ~ViewProviderPoints(); 00078 00079 App::PropertyFloatConstraint PointSize; 00080 00085 virtual void attach(App::DocumentObject *); 00087 virtual void setDisplayMode(const char* ModeName); 00089 virtual std::vector<std::string> getDisplayModes(void) const; 00091 virtual void updateData(const App::Property*); 00092 virtual QIcon getIcon() const; 00093 00095 bool setEdit(int ModNum); 00097 void unsetEdit(int ModNum); 00098 00099 public: 00100 static void clipPointsCallback(void * ud, SoEventCallback * n); 00101 00102 protected: 00103 void onChanged(const App::Property* prop); 00104 void setVertexColorMode(App::PropertyColorList*); 00105 void setVertexGreyvalueMode(Points::PropertyGreyValueList*); 00106 void setVertexNormalMode(Points::PropertyNormalList*); 00107 virtual void cut( const std::vector<SbVec2f>& picked, Gui::View3DInventorViewer &Viewer); 00108 00109 protected: 00110 SoCoordinate3 *pcPointsCoord; 00111 SoPointSet *pcPoints; 00112 SoMaterial *pcColorMat; 00113 SoNormal *pcPointsNormal; 00114 SoDrawStyle *pcPointStyle; 00115 00116 private: 00117 static App::PropertyFloatConstraint::Constraints floatRange; 00118 }; 00119 00120 typedef Gui::ViewProviderPythonFeatureT<ViewProviderPoints> ViewProviderPython; 00121 00122 } // namespace PointsGui 00123 00124 00125 #endif // POINTSGUI_VIEWPROVIDERPOINTS_H 00126