QGIS API Documentation 4.3.0-Master (d3b565c628d)
Loading...
Searching...
No Matches
qgspoint3dbillboardmaterial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspoint3dbillboardmaterial.h
3 --------------------------------------
4 Date : Jul 2019
5 Copyright : (C) 2019 by Ismail Sunni
6 Email : imajimatika at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSPOINT3DBILLBOARDMATERIAL_H
16#define QGSPOINT3DBILLBOARDMATERIAL_H
17
18#include "qgis.h"
19#include "qgis_3d.h"
20#include "qgsmaterial.h"
21
22#include <QObject>
23#include <Qt3DRender/QParameter>
24#include <Qt3DRender/QTexture>
25
26#define SIP_NO_FILE
27
28class QgsMarkerSymbol;
30
42{
43 Q_OBJECT
44
45 public:
51 enum class ExtraAttribute
52 {
53 Size = 1 << 1,
54 TextureData = 1 << 2,
55 PixelOffsets = 1 << 3,
56 VerticalOffset = 1 << 4,
57 };
58 Q_DECLARE_FLAGS( ExtraAttributes, ExtraAttribute )
59 Q_FLAG( ExtraAttributes )
60
61
66
68 void setSize( const QSizeF size );
70 QSizeF size() const;
71
80 void setVerticalOffset( float offset );
81
83 void setViewportSize( const QSizeF size );
85 QSizeF windowSize() const;
86
88 void useDefaultSymbol( const Qgs3DRenderContext &context, bool selected = false );
89
95 static QImage renderSymbolToImage( const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected = false );
96
98 void setTexture2DFromSymbol( const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected = false );
99
101 void setTexture2DFromImage( const QImage &image );
102
103 private:
105 void setTexture2DFromTextureImage( Qt3DRender::QAbstractTextureImage *textureImage );
106
107 Qt3DRender::QParameter *mSize = nullptr;
108 Qt3DRender::QParameter *mViewportSize = nullptr;
109 Qt3DRender::QParameter *mTexture2D = nullptr;
110 Qt3DRender::QParameter *mVerticalOffset = nullptr;
111
113};
114
116
117
118#endif // QGSPOINT3DBILLBOARDMATERIAL_H
BillboardScaleMode
3D billboard scaling modes.
Definition qgis.h:4441
@ ViewIndependent
Billboard has a fixed pixel size on the screen, regardless of the camera distance.
Definition qgis.h:4442
Rendering context for preparation of 3D entities.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsMaterial(Qt3DCore::QNode *parent=nullptr)
Constructor for QgsMaterial, with the specified parent node.
void useDefaultSymbol(const Qgs3DRenderContext &context, bool selected=false)
Set default symbol for the texture with context and selected parameter for rendering.
QFlags< ExtraAttribute > ExtraAttributes
static QImage renderSymbolToImage(const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected=false)
Renders a marker symbol to an image.
void setVerticalOffset(float offset)
Set the vertical offset.
QSizeF windowSize() const
Returns the size of the view port.
void setTexture2DFromImage(const QImage &image)
Set the texture2D of the billboard from an image.
~QgsPoint3DBillboardMaterial() override
QSizeF size() const
Returns the billboard size.
QgsPoint3DBillboardMaterial(ExtraAttributes attributes=ExtraAttributes(), Qgis::BillboardScaleMode scaleMode=Qgis::BillboardScaleMode::ViewIndependent)
Constructor for QgsPoint3DBillboardMaterial, using the specified additional attributes.
void setTexture2DFromSymbol(const QgsMarkerSymbol *markerSymbol, const Qgs3DRenderContext &context, bool selected=false)
Set markerSymbol for the texture with context and selected parameter for rendering.
void setViewportSize(const QSizeF size)
Set the size of the view port.
void setSize(const QSizeF size)
Set the billboard size.
ExtraAttribute
Additional material attributes.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)