File indexing completed on 2024-05-12 04:43:21

0001 /*
0002  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0003  * Copyright (C) 2011-2015 by Radoslaw Wicik (radoslaw@wicik.pl)
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef KREPORTITEMMAPS_H
0020 #define KREPORTITEMMAPS_H
0021 
0022 #include "KReportAsyncItemBase.h"
0023 
0024 #include <marble/MarbleWidget.h>
0025 #include <marble/MapThemeManager.h>
0026 
0027 #include <KProperty>
0028 
0029 #include "KReportMapRenderer.h"
0030 
0031 #include <QDomNode>
0032 
0033 class OROImage;
0034 class OROPicture;
0035 class OROPage;
0036 class OROSection;
0037 
0038 namespace Scripting
0039 {
0040 class Maps;
0041 }
0042 
0043 class KReportItemMaps : public KReportAsyncItemBase
0044 {
0045     Q_OBJECT
0046 public:
0047     KReportItemMaps();
0048     explicit KReportItemMaps(const QDomNode &element);
0049     ~KReportItemMaps() override;
0050 
0051     QString typeName() const override;
0052     int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
0053 
0054     QVariant realItemData(const QVariant &itemData) const override;
0055 
0056     void renderFinished();
0057 
0058     qreal longtitude() const;
0059     qreal latitude() const;
0060     int zoom() const;
0061     QString themeId() const;
0062 
0063     OROPicture* oroImage();
0064 
0065 protected:
0066     KProperty* m_latitudeProperty;
0067     KProperty* m_longitudeProperty;
0068     KProperty* m_zoomProperty;
0069     KProperty* m_themeProperty;
0070 
0071     qreal m_longtitude = 0.0;
0072     qreal m_latitude = 0.0;
0073     int m_zoom = 1200;
0074     OROPage *m_pageId = nullptr;
0075     OROSection *m_sectionId = nullptr;
0076     QPointF m_offset;
0077     OROPicture * m_oroPicture = nullptr;
0078     KReportMapRenderer m_mapRenderer;
0079     Marble::MapThemeManager m_themeManager;
0080 
0081 private:
0082     void createProperties() override;
0083     void deserializeData(const QVariant& serialized);
0084 
0085     bool m_longDataSetFromScript = false;
0086     bool m_latDataSetFromScript = false;
0087     bool m_zoomDataSetFromScript = false;
0088 
0089     friend class Scripting::Maps;
0090 };
0091 
0092 #endif