ViewProviderExt.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2011 Juergen Riegel <juergen.riegel@web.de>             *
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 PARTGUI_VIEWPROVIDERPARTEXT_H
00025 #define PARTGUI_VIEWPROVIDERPARTEXT_H
00026 
00027 #include <Standard_math.hxx>
00028 #include <Standard_Boolean.hxx>
00029 #include <TopoDS_Shape.hxx>
00030 #include <Gui/ViewProviderGeometryObject.h>
00031 #include <map>
00032 
00033 class TopoDS_Shape;
00034 class TopoDS_Edge;
00035 class TopoDS_Wire;
00036 class TopoDS_Face;
00037 class SoSeparator;
00038 class SoGroup;
00039 class SoSwitch;
00040 class SoVertexShape;
00041 class SoPickedPoint;
00042 class SoShapeHints;
00043 class SoEventCallback;
00044 class SbVec3f;
00045 class SoSphere;
00046 class SoScale;
00047 class SoCoordinate3;
00048 class SoIndexedFaceSet;
00049 class SoNormal;
00050 class SoNormalBinding;
00051 class SoMaterialBinding;
00052 class SoIndexedLineSet;
00053 
00054 namespace PartGui {
00055 
00056 class SoBrepFaceSet;
00057 class SoBrepEdgeSet;
00058 class SoBrepPointSet;
00059 
00060 class PartGuiExport ViewProviderPartExt : public Gui::ViewProviderGeometryObject
00061 {
00062     PROPERTY_HEADER(PartGui::ViewProviderPartExt);
00063 
00064 public:
00066     ViewProviderPartExt();
00068     virtual ~ViewProviderPartExt();
00069 
00070     // Display properties
00071     App::PropertyFloatConstraint LineWidth;
00072     App::PropertyFloatConstraint PointSize;
00073     App::PropertyFloatConstraint Deviation;
00074     App::PropertyColor LineColor;
00075     App::PropertyColor PointColor;
00076     App::PropertyMaterial LineMaterial;
00077     App::PropertyMaterial PointMaterial;
00078     App::PropertyBool ControlPoints;
00079     App::PropertyEnumeration Lighting;
00080 
00081     App::PropertyColorList DiffuseColor;
00082 
00083 
00084     virtual void attach(App::DocumentObject *);
00085     virtual void setDisplayMode(const char* ModeName);
00087     virtual std::vector<std::string> getDisplayModes(void) const;
00089     void reload();
00090 
00091     virtual void updateData(const App::Property*);
00092 
00099 
00100     virtual bool useNewSelectionModel(void) const {return true;}
00102     virtual std::string getElement(const SoPickedPoint*) const;
00104     virtual std::vector<Base::Vector3d> getSelectionShape(const char* Element) const;
00106 
00109     void setupContextMenu(QMenu*, QObject*, const char*);
00110 protected:
00111     bool setEdit(int ModNum);
00112     void unsetEdit(int ModNum);
00114 
00115 protected:
00117     virtual void onChanged(const App::Property* prop);
00118     bool loadParameter();
00119     void updateVisual(const TopoDS_Shape &);
00120 
00121     // nodes for the data representation
00122     SoMaterialBinding * pcShapeBind;
00123     SoMaterial        * pcLineMaterial;
00124     SoMaterial        * pcPointMaterial;
00125     SoDrawStyle       * pcLineStyle;
00126     SoDrawStyle       * pcPointStyle;
00127     //SoSwitch        * pcControlPoints;
00128     SoShapeHints      * pShapeHints;
00129 
00130     SoCoordinate3     * coords;
00131     SoBrepFaceSet     * faceset;
00132     SoNormal          * norm;
00133     SoNormalBinding   * normb;
00134     SoBrepEdgeSet     * lineset;
00135     SoBrepPointSet    * nodeset;
00136 
00137     bool VisualTouched;
00138 
00139 private:
00140     // settings stuff
00141     bool noPerVertexNormals;
00142     bool qualityNormals;
00143     static App::PropertyFloatConstraint::Constraints sizeRange;
00144     static App::PropertyFloatConstraint::Constraints tessRange;
00145     static const char* LightingEnums[];
00146 };
00147 
00148 }
00149 
00150 #endif // PARTGUI_VIEWPROVIDERPARTEXT_H
00151 

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