diff --git a/CMakeLists.txt b/CMakeLists.txt index 50f7438a..fced599e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,65 +1,65 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) find_package(ECM 1.8.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(SetKReportCMakePolicies NO_POLICY_SCOPE) project(KReport VERSION 3.0.90) # Update this include(KReportAddTests) include(KReportAddExamples) kreport_add_tests(OFF) kreport_add_examples(OFF) # CMake include(CMakePackageConfigHelpers) # ECM include(ECMGeneratePriFile) include(ECMPoQmTools) include(ECMSetupVersion) include(ECMInstallIcons) include(ECMOptionalAddSubdirectory) include(KDEInstallDirs) include(KDECMakeSettings NO_POLICY_SCOPE) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) # Own include(KReportAddIconsRccFile) include(KReportAddQCH) include(KReportMacros) simple_option(BUILD_QCH "Build API documentation in QCH format" OFF) # Dependencies set(REQUIRED_QT_VERSION 5.4.0) set(REQUIRED_KF5_VERSION 5.16.0) -set(REQUIRED_KPROPERTY_VERSION 3.0.90) +set(REQUIRED_KPROPERTY_VERSION 3.0.91) # Required components to build this framework # TODO move Widgets/KF5WidgetsAddons-dependent part to a libKReportDesigner find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets Xml PrintSupport) find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED CoreAddons WidgetsAddons GuiAddons Config) find_package(KPropertyWidgets ${REQUIRED_KPROPERTY_VERSION} COMPONENTS KF) set_package_properties(KPropertyWidgets PROPERTIES TYPE REQUIRED PURPOSE "Required by KReport for handling properties") get_git_revision_and_branch() add_unfinished_features_option() add_pc_file(${PROJECT_NAME}) add_subdirectory(src) if(BUILD_TESTING) add_subdirectory(autotests) #add_subdirectory(tests) endif() if(BUILD_EXAMPLES) add_subdirectory(examples) endif() if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/plugins/maps/KReportItemMaps.cpp b/src/plugins/maps/KReportItemMaps.cpp index 93b77265..8409bdf4 100644 --- a/src/plugins/maps/KReportItemMaps.cpp +++ b/src/plugins/maps/KReportItemMaps.cpp @@ -1,218 +1,218 @@ /* * Copyright (C) 2007-2016 by Adam Pigg (adam@piggz.co.uk) * Copyright (C) 2011-2015 by Radoslaw Wicik (radoslaw@wicik.pl) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "KReportItemMaps.h" #include #include #include #include #include #define myDebug() if (0) kDebug(44021) //! @todo replace with ReportItemMaps(const QDomNode &element = QDomNode()) KReportItemMaps::KReportItemMaps() { createProperties(); } KReportItemMaps::KReportItemMaps(const QDomNode &element) : KReportItemMaps() { nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble()); m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble()); m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt()); QString themeId(element.toElement().attribute(QLatin1String("report:theme"))); themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId; m_themeProperty->setValue(themeId); parseReportRect(element.toElement()); } KReportItemMaps::~KReportItemMaps() { } void KReportItemMaps::createProperties() { m_controlSource = new KProperty("item-data-source", new KPropertyListData, QVariant(), tr("Data Source")); m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), QString(), KProperty::Double); m_latitudeProperty->setOption("min", -90); m_latitudeProperty->setOption("max", 90); m_latitudeProperty->setOption("unit", QString::fromUtf8("°")); m_latitudeProperty->setOption("precision", 7); m_longitudeProperty = new KProperty("longitude", 0.0, tr("Longitude"), QString(), KProperty::Double); m_longitudeProperty->setOption("min", -180); m_longitudeProperty->setOption("max", 180); m_longitudeProperty->setOption("unit", QString::fromUtf8("°")); m_longitudeProperty->setOption("precision", 7); m_zoomProperty = new KProperty("zoom", 1000, tr("Zoom") ); m_zoomProperty->setOption("min", 0); m_zoomProperty->setOption("max", 4000); m_zoomProperty->setOption("step", 100); m_zoomProperty->setOption("slider", true); QStringList mapThemIds(m_themeManager.mapThemeIds()); m_themeProperty = new KProperty("theme", new KPropertyListData(mapThemIds, mapThemIds), QVariant(mapThemIds[1]), tr("Theme")); if (mapThemIds.contains(QLatin1String("earth/srtm/srtm.dgml"))) { - m_themeProperty->setValue(QLatin1String("earth/srtm/srtm.dgml"), KProperty::DefaultValueOptions & ~KProperty::ValueOptions(KProperty::ValueOption::RememberOld)); + m_themeProperty->setValue(QLatin1String("earth/srtm/srtm.dgml"), KProperty::ValueOption::IgnoreOld); } propertySet()->addProperty(m_controlSource); propertySet()->addProperty(m_latitudeProperty); propertySet()->addProperty(m_longitudeProperty); propertySet()->addProperty(m_zoomProperty); propertySet()->addProperty(m_themeProperty); } void KReportItemMaps::setColumn(const QString &c) { m_controlSource->setValue(c); } QString KReportItemMaps::itemDataSource() const { return m_controlSource->value().toString(); } QString KReportItemMaps::typeName() const { return QLatin1String("maps"); } int KReportItemMaps::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) { Q_UNUSED(script) deserializeData(data); m_pageId = page; m_sectionId = section; m_offset = offset; m_oroPicture = new OROPicture(); m_oroPicture->setPosition(scenePosition(position()) + m_offset); m_oroPicture->setSize(sceneSize(size())); if (m_pageId) { m_pageId->insertPrimitive(m_oroPicture); } if (m_sectionId) { OROPicture *i2 = dynamic_cast(m_oroPicture->clone()); if (i2) { i2->setPosition(scenePosition(position())); } } m_mapRenderer.renderJob(this); return 0; //Item doesn't stretch the section height } void KReportItemMaps::deserializeData(const QVariant& serialized) { //kreportpluginDebug() << "Map data for this record is" << serialized; QStringList dataList = serialized.toString().split(QLatin1Char(';')); if (dataList.size() == 3) { m_latitude = dataList[0].toDouble(); m_longtitude = dataList[1].toDouble(); m_zoom = dataList[2].toInt(); } else { m_latitude = m_latitudeProperty->value().toReal(); m_longtitude = m_longitudeProperty->value().toReal(); m_zoom = m_zoomProperty->value().toInt(); } } void KReportItemMaps::renderFinished() { emit finishedRendering(); } OROPicture* KReportItemMaps::oroImage() { return m_oroPicture; } qreal KReportItemMaps::longtitude() const { return m_longtitude; } qreal KReportItemMaps::latitude() const { return m_latitude; } int KReportItemMaps::zoom() const { return m_zoom; } QString KReportItemMaps::themeId() const { return m_themeProperty->value().toString(); } QVariant KReportItemMaps::realItemData(const QVariant& itemData) const { double lat, lon; int zoom; QStringList dataList = itemData.toString().split(QLatin1Char(';')); if (dataList.size() == 3) { lat = dataList[0].toDouble(); lon = dataList[1].toDouble(); zoom = dataList[2].toInt(); } else if (dataList.size() == 2) { lat = dataList[0].toDouble(); lon = dataList[1].toDouble(); zoom = m_zoomProperty->value().toInt(); } else { lat = m_latitudeProperty->value().toReal(); lon = m_longitudeProperty->value().toReal(); zoom = m_zoomProperty->value().toInt(); } if (m_longDataSetFromScript) { lon = m_longtitude; } if (m_latDataSetFromScript) { lat = m_latitude; } if (m_zoomDataSetFromScript) { zoom = m_zoom; } return QString(QLatin1String("%1;%2;%3")).arg(lat).arg(lon).arg(zoom); }