File indexing completed on 2024-05-12 15:31:33

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Inge Wallin <inge@lysator.liu.se>
0004 //
0005 
0006 //
0007 // This class is a template Float Item plugin.
0008 //
0009 
0010 
0011 #ifndef FITEMPLATE_FLOAT_ITEM_H
0012 #define FITEMPLATE_FLOAT_ITEM_H
0013 
0014 
0015 // Qt
0016 
0017 // Marble
0018 #include "AbstractFloatItem.h"
0019 
0020 class QSvgRenderer;
0021 
0022 namespace Marble
0023 {
0024 
0025 /**
0026  * @short The class that creates a ... Float Item
0027  *
0028  */
0029 
0030 class FITemplateFloatItem  : public AbstractFloatItem
0031 {
0032     Q_OBJECT
0033     Q_PLUGIN_METADATA(IID "org.kde.marble.FITemplateFloatItem")
0034     Q_INTERFACES( Marble::RenderPluginInterface )
0035     MARBLE_PLUGIN(FITemplateFloatItem)
0036 
0037  public:
0038     explicit FITemplateFloatItem( const QPointF &point = QPointF( -1.0, 10.0 ),
0039                   const QSizeF &size = QSizeF( 75.0, 75.0 ) );
0040 
0041     // ----------------------------------------------------------------
0042     // The following functions are defined in RenderPluginInterface.h
0043     // and MUST be part of the plugin.  See that file for documentation.
0044     //
0045     // Note that the class AbstractFloatItem provides default 
0046     // implementations for many of them.
0047     //
0048 
0049     ~FITemplateFloatItem ();
0050 
0051     QStringList backendTypes() const;
0052 
0053     // Provided by AbstractFloatItem and should not be implemented.
0054     //
0055     // QString renderPolicy() const;
0056     // QStringList renderPosition() const;
0057 
0058     QString name() const;
0059 
0060     QString guiString() const;
0061 
0062     QString nameId() const;
0063 
0064     QString description() const;
0065 
0066     QIcon icon() const;
0067 
0068     void initialize();
0069 
0070     bool isInitialized() const;
0071 
0072     // Provided by AbstractFloatItem and should not be implemented.
0073     //
0074     // bool render( GeoPainter *painter, ViewportParams *viewport,
0075     //              const QString &renderPos, GeoSceneLayer *layer);
0076 
0077     QPainterPath backgroundShape() const;
0078 
0079     // End of RenderPluginInterface functions.
0080     // ----------------------------------------------------------------
0081 
0082     bool needsUpdate( ViewportParams *viewport );
0083 
0084     bool renderFloatItem( GeoPainter *painter, ViewportParams *viewport,
0085               GeoSceneLayer * layer = 0 );
0086 
0087  private:
0088     Q_DISABLE_COPY( FITemplateFloatItem )
0089 
0090     QSvgRenderer  *m_svgobj;
0091     QPixmap        m_compass;
0092 
0093     /// allowed values: -1, 0, 1; default here: 0. FIXME: Declare enum
0094     int            m_polarity;
0095 };
0096 
0097 }
0098 
0099 #endif