00001 /*************************************************************************** 00002 * Copyright (c) 2006 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 GUI_VIEWPROVIDER_GEOMETRYOBJECT_H 00025 #define GUI_VIEWPROVIDER_GEOMETRYOBJECT_H 00026 00027 #include <Inventor/lists/SoPickedPointList.h> 00028 #include "ViewProviderDocumentObject.h" 00029 00030 class SoPickedPointList; 00031 class SoSwitch; 00032 class SoSensor; 00033 class SoDragger; 00034 class SbVec2s; 00035 00036 namespace Gui { 00037 00038 class SoFCSelection; 00039 class SoFCBoundingBox; 00040 class View3DInventorViewer; 00041 00046 class GuiExport ViewProviderGeometryObject : public ViewProviderDocumentObject 00047 { 00048 PROPERTY_HEADER(Gui::ViewProviderGeometryObject); 00049 00050 public: 00052 ViewProviderGeometryObject(); 00053 00055 virtual ~ViewProviderGeometryObject(); 00056 00057 // Display properties 00058 App::PropertyColor ShapeColor; 00059 App::PropertyPercent Transparency; 00060 App::PropertyMaterial ShapeMaterial; 00061 App::PropertyBool BoundingBox; 00062 App::PropertyBool Selectable; 00063 00067 void attach(App::DocumentObject *pcObject); 00068 void updateData(const App::Property*); 00069 00070 SoFCSelection* getHighlightNode() const { return pcHighlight; } 00071 bool isSelectable(void) const {return Selectable.getValue();} 00072 00078 SoPickedPointList getPickedPoints(const SbVec2s& pos, const View3DInventorViewer& viewer,bool pickAll=false) const; 00084 SoPickedPoint* getPickedPoint(const SbVec2s& pos, const View3DInventorViewer& viewer) const; 00085 00088 bool doubleClicked(void); 00089 void setupContextMenu(QMenu*, QObject*, const char*); 00090 protected: 00091 bool setEdit(int ModNum); 00092 void unsetEdit(int ModNum); 00093 void setEditViewer(View3DInventorViewer*, int ModNum); 00094 void unsetEditViewer(View3DInventorViewer*); 00096 00097 protected: 00098 void showBoundingBox(bool); 00100 void onChanged(const App::Property* prop); 00101 SoFCSelection* createFromSettings() const; 00102 void setSelectable(bool Selectable=true); 00103 00104 private: 00105 static void sensorCallback(void * data, SoSensor * sensor); 00106 static void dragStartCallback(void * data, SoDragger * d); 00107 static void dragFinishCallback(void * data, SoDragger * d); 00108 00109 protected: 00110 SoFCSelection * pcHighlight; 00111 SoMaterial * pcShapeMaterial; 00112 SoFCBoundingBox * pcBoundingBox; 00113 SoSwitch * pcBoundSwitch; 00114 }; 00115 00116 } // namespace Gui 00117 00118 00119 #endif // GUI_VIEWPROVIDER_GEOMETRYOBJECT_H 00120