Debian Codegraph @

src/Gui/ViewProviderImagePlane.h

raw
1 /***************************************************************************
2 * Copyright (c) 2011 Jürgen Riegel ([email protected]) *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #ifndef GUI_ViewProviderImagePlane_H
24 #define GUI_ViewProviderImagePlane_H
25
26 #include <Gui/ViewProviderGeometryObject.h>
27
28
29 class SoCoordinate3;
30 class SoDrawStyle;
31 class SoShapeHints;
32 class SoTexture2;
33 class QImage;
34
35 namespace Gui
36 {
37
38 class GuiExport ViewProviderImagePlane: public Gui::ViewProviderGeometryObject
39 {
40 PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderImagePlane);
41
42 public:
43 ViewProviderImagePlane();
44 ~ViewProviderImagePlane() override;
45
46 App::PropertyEnumeration Lighting;
47
48 void attach(App::DocumentObject* pcObject) override;
49 void setDisplayMode(const char* ModeName) override;
50 std::vector<std::string> getDisplayModes() const override;
51 void updateData(const App::Property*) override;
52 void setupContextMenu(QMenu*, QObject*, const char*) override;
53 bool doubleClicked() override;
54 void onChanged(const App::Property* prop) override;
55
56 private:
57 void resizePlane(float xsize, float ysize);
58 void loadImage();
59 void setPlaneSize(const QSizeF& size, const QImage& img);
60 void reloadIfSvg();
61 bool isSvgFile(const char*) const;
62 QSizeF getSizeInMM(const QImage&) const;
63 QSizeF defaultSizeOfSvg(const char*) const;
64 QSizeF pixelSize(const char*, const QSizeF&) const;
65 QImage loadSvg(const char*) const;
66 QImage loadSvgOfSize(const char*, const QSizeF&) const;
67 QImage loadRaster(const char*) const;
68 void convertToSFImage(const QImage& img);
69 void manipulateImage();
70
71 private:
72 SoCoordinate3* pcCoords;
73 SoTexture2* texture;
74 SoShapeHints* shapeHints;
75 static const char* LightingEnums[];
76 };
77
78 } // namespace Gui
79
80
81 #endif // GUI_ViewProviderImagePlane_H