00001 /*************************************************************************** 00002 * Copyright (c) 2008 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_VIEWPROVIDERMEASUREDISTANCE_H 00025 #define GUI_VIEWPROVIDERMEASUREDISTANCE_H 00026 00027 #include "ViewProviderDocumentObject.h" 00028 #include <QObject> 00029 00030 class SoFontStyle; 00031 class SoText2; 00032 class SoBaseColor; 00033 class SoTranslation; 00034 class SoCoordinate3; 00035 class SoIndexedLineSet; 00036 class SoEventCallback; 00037 class SoMarkerSet; 00038 00039 namespace Gui 00040 { 00041 00042 class View3DInventorViewer; 00043 class ViewProviderPointMarker; 00044 class PointMarker : public QObject 00045 { 00046 public: 00047 PointMarker(View3DInventorViewer* view); 00048 ~PointMarker(); 00049 00050 void addPoint(const SbVec3f&); 00051 int countPoints() const; 00052 00053 protected: 00054 void customEvent(QEvent* e); 00055 00056 private: 00057 View3DInventorViewer *view; 00058 ViewProviderPointMarker *vp; 00059 }; 00060 00061 class GuiExport ViewProviderPointMarker : public ViewProviderDocumentObject 00062 { 00063 PROPERTY_HEADER(Gui::ViewProviderPointMarker); 00064 00065 public: 00066 ViewProviderPointMarker(); 00067 virtual ~ViewProviderPointMarker(); 00068 00069 protected: 00070 SoCoordinate3 * pCoords; 00071 SoMarkerSet * pMarker; 00072 friend class PointMarker; 00073 }; 00074 00075 class GuiExport ViewProviderMeasureDistance : public ViewProviderDocumentObject 00076 { 00077 PROPERTY_HEADER(Gui::ViewProviderMeasureDistance); 00078 00079 public: 00081 ViewProviderMeasureDistance(void); 00082 virtual ~ViewProviderMeasureDistance(); 00083 00084 // Display properties 00085 App::PropertyColor TextColor; 00086 App::PropertyColor LineColor; 00087 App::PropertyInteger FontSize; 00088 App::PropertyFloat DistFactor; 00089 App::PropertyBool Mirror; 00090 00091 void attach(App::DocumentObject *); 00092 void updateData(const App::Property*); 00093 std::vector<std::string> getDisplayModes(void) const; 00094 void setDisplayMode(const char* ModeName); 00095 00096 static void measureDistanceCallback(void * ud, SoEventCallback * n); 00097 00098 protected: 00099 void onChanged(const App::Property* prop); 00100 00101 private: 00102 SoFontStyle * pFont; 00103 SoText2 * pLabel; 00104 SoBaseColor * pColor; 00105 SoBaseColor * pTextColor; 00106 SoTranslation * pTranslation; 00107 SoCoordinate3 * pCoords; 00108 SoIndexedLineSet * pLines; 00109 }; 00110 00111 } //namespace Gui 00112 00113 00114 #endif // GUI_VIEWPROVIDERMEASUREDISTANCE_H