Commit 28255c29 authored by Radoslaw Wicik's avatar Radoslaw Wicik

Kexi maps: choosing Theme Id in reports.

REVIEW: 122698
parent c31b8ac7
......@@ -120,6 +120,7 @@ void KoReportDesignerItemMaps::buildXML(QDomDocument & doc, QDomElement & parent
addPropertyAsAttribute(&entity, m_latitudeProperty);
addPropertyAsAttribute(&entity, m_longitudeProperty);
addPropertyAsAttribute(&entity, m_zoomProperty);
addPropertyAsAttribute(&entity, m_themeProperty);
//addPropertyAsAttribute(&entity, m_resizeMode);
entity.setAttribute("report:z-index", zValue());
buildXMLRect(doc, entity, &m_pos, &m_size);
......
......@@ -30,6 +30,7 @@
#define myDebug() if (0) kDebug(44021)
......@@ -42,9 +43,6 @@ KoReportItemMaps::KoReportItemMaps(QDomNode & element)
, m_oroPicture(0)
{
createProperties();
QDomNodeList nl = element.childNodes();
QString n;
QDomNode node;
m_name->setValue(element.toElement().attribute("report:name"));
m_controlSource->setValue(element.toElement().attribute("report:item-data-source"));
......@@ -52,12 +50,11 @@ KoReportItemMaps::KoReportItemMaps(QDomNode & element)
m_latitudeProperty->setValue(element.toElement().attribute("report:latitude").toDouble());
m_longitudeProperty->setValue(element.toElement().attribute("report:longitude").toDouble());
m_zoomProperty->setValue(element.toElement().attribute("report:zoom").toInt());
QString themeId(element.toElement().attribute("report:theme"));
themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId;
m_themeProperty->setValue(themeId);
parseReportRect(element.toElement(), &m_pos, &m_size);
for (int i = 0; i < nl.count(); i++) {
node = nl.item(i);
n = node.nodeName();
}
}
......@@ -83,11 +80,22 @@ void KoReportItemMaps::createProperties()
m_longitudeProperty->setOption("unit", "°");
m_zoomProperty = new KoProperty::Property("zoom", 1000, i18n("Zoom"), i18n("Zoom") );
QStringList mapThemIds(m_themeManager.mapThemeIds());
m_themeProperty = new KoProperty::Property("theme",
mapThemIds,
mapThemIds,
mapThemIds[1]);
if (!mapThemIds.isEmpty()) {
m_themeProperty->setValue(mapThemIds[0], false);
}
addDefaultProperties();
m_set->addProperty(m_controlSource);
m_set->addProperty(m_latitudeProperty);
m_set->addProperty(m_longitudeProperty);
m_set->addProperty(m_zoomProperty);
m_set->addProperty(m_themeProperty);
}
......@@ -98,7 +106,6 @@ void KoReportItemMaps::setColumn(const QString &c)
QString KoReportItemMaps::itemDataSource() const
{
kDebug() << m_controlSource->value().toString();
return m_controlSource->value().toString();
}
......@@ -112,7 +119,6 @@ int KoReportItemMaps::renderSimpleData(OROPage *page, OROSection *section, const
{
Q_UNUSED(script)
myDebug() << this << "data:" << data;
deserializeData(data);
m_pageId = page;
m_sectionId = section;
......@@ -153,7 +159,6 @@ void KoReportItemMaps::deserializeData(const QVariant& serialized)
void KoReportItemMaps::renderFinished()
{
myDebug() << m_pageId << ", " << m_sectionId;
emit finishedRendering();
}
......@@ -181,3 +186,8 @@ QSize KoReportItemMaps::size() const
{
return m_size.toScene().toSize();
}
QString KoReportItemMaps::themeId() const
{
return m_themeProperty->value().toString();
}
......@@ -30,6 +30,7 @@
#include <marble/MarbleWidget.h>
#include <QMap>
#include "MapRenderer.h"
#include <marble/MapThemeManager.h>
class OROImage;
class OROPicture;
......@@ -63,6 +64,7 @@ public:
qreal longtitude() const;
qreal latitude() const;
int zoom() const;
QString themeId() const;
QSize size() const;
OROPicture* oroImage();
......@@ -74,7 +76,7 @@ protected:
KoProperty::Property* m_latitudeProperty;
KoProperty::Property* m_longitudeProperty;
KoProperty::Property* m_zoomProperty;
// KoProperty::Property* m_mapThemeIdProperty;
KoProperty::Property* m_themeProperty;
void setMode(const QString&);
void setInlineImageData(QByteArray, const QString& = QString());
......@@ -91,6 +93,7 @@ protected:
QPointF m_offset;
OROPicture * m_oroPicture;
MapRenderer m_mapRenderer;
Marble::MapThemeManager m_themeManager;
private:
virtual void createProperties();
......
......@@ -65,7 +65,9 @@ void MapRenderer::renderJob(KoReportItemMaps* reportItemMaps)
{
m_currentJob = reportItemMaps;
int zoom = m_currentJob->zoom();
myDebug() << this << m_currentJob << m_currentJob->latitude() << m_currentJob->longtitude() << zoom;
m_marble.setMapThemeId(m_currentJob->themeId());
//some themes enable overview map, and this must be disabled after theme switch.
m_marble.setShowOverviewMap(false);
m_marble.setFixedSize(m_currentJob->size());
m_marble.centerOn(m_currentJob->longtitude(), m_currentJob->latitude(), false);
m_marble.setZoom(zoom);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment