Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/maps/KReportItemMaps.cpp
Show All 34 Lines | 30 | KReportItemMaps::KReportItemMaps(const QDomNode &element) | |||
---|---|---|---|---|---|
35 | , m_sectionId(0) | 35 | , m_sectionId(0) | ||
36 | , m_oroPicture(0) | 36 | , m_oroPicture(0) | ||
37 | , m_longDataSetFromScript(false) | 37 | , m_longDataSetFromScript(false) | ||
38 | , m_latDataSetFromScript(false) | 38 | , m_latDataSetFromScript(false) | ||
39 | , m_zoomDataSetFromScript(false) | 39 | , m_zoomDataSetFromScript(false) | ||
40 | { | 40 | { | ||
41 | createProperties(); | 41 | createProperties(); | ||
42 | 42 | | |||
43 | m_name->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 43 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | ||
44 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | 44 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | ||
45 | Z = element.toElement().attribute(QLatin1String("report:z-index")).toDouble(); | 45 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
46 | m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble()); | 46 | m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble()); | ||
47 | m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble()); | 47 | m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble()); | ||
48 | m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt()); | 48 | m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt()); | ||
49 | QString themeId(element.toElement().attribute(QLatin1String("report:theme"))); | 49 | QString themeId(element.toElement().attribute(QLatin1String("report:theme"))); | ||
50 | themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId; | 50 | themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId; | ||
51 | m_themeProperty->setValue(themeId); | 51 | m_themeProperty->setValue(themeId); | ||
52 | 52 | | |||
53 | parseReportRect(element.toElement(), &m_pos, &m_size); | 53 | parseReportRect(element.toElement()); | ||
54 | } | 54 | } | ||
55 | 55 | | |||
56 | KReportItemMaps::~KReportItemMaps() | 56 | KReportItemMaps::~KReportItemMaps() | ||
57 | { | 57 | { | ||
58 | delete m_set; | | |||
59 | } | 58 | } | ||
60 | 59 | | |||
61 | void KReportItemMaps::createProperties() | 60 | void KReportItemMaps::createProperties() | ||
62 | { | 61 | { | ||
63 | m_set = new KPropertySet; | | |||
64 | | ||||
65 | m_controlSource = new KProperty("item-data-source", QStringList(), QStringList(), QString(), tr("Data Source")); | 62 | m_controlSource = new KProperty("item-data-source", QStringList(), QStringList(), QString(), tr("Data Source")); | ||
66 | 63 | | |||
67 | m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), tr("Latitude"), KProperty::Double); | 64 | m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), tr("Latitude"), KProperty::Double); | ||
68 | m_latitudeProperty->setOption("min", -90); | 65 | m_latitudeProperty->setOption("min", -90); | ||
69 | m_latitudeProperty->setOption("max", 90); | 66 | m_latitudeProperty->setOption("max", 90); | ||
70 | m_latitudeProperty->setOption("unit", QString::fromUtf8("°")); | 67 | m_latitudeProperty->setOption("unit", QString::fromUtf8("°")); | ||
71 | m_latitudeProperty->setOption("precision", 7); | 68 | m_latitudeProperty->setOption("precision", 7); | ||
72 | 69 | | |||
Show All 14 Lines | 83 | m_themeProperty = new KProperty("theme", | |||
87 | mapThemIds, | 84 | mapThemIds, | ||
88 | mapThemIds, | 85 | mapThemIds, | ||
89 | mapThemIds[1]); | 86 | mapThemIds[1]); | ||
90 | 87 | | |||
91 | if (mapThemIds.contains(QLatin1String("earth/srtm/srtm.dgml"))) { | 88 | if (mapThemIds.contains(QLatin1String("earth/srtm/srtm.dgml"))) { | ||
92 | m_themeProperty->setValue(QLatin1String("earth/srtm/srtm.dgml"), false); | 89 | m_themeProperty->setValue(QLatin1String("earth/srtm/srtm.dgml"), false); | ||
93 | } | 90 | } | ||
94 | 91 | | |||
95 | addDefaultProperties(); | 92 | propertySet()->addProperty(m_controlSource); | ||
96 | m_set->addProperty(m_controlSource); | 93 | propertySet()->addProperty(m_latitudeProperty); | ||
97 | m_set->addProperty(m_latitudeProperty); | 94 | propertySet()->addProperty(m_longitudeProperty); | ||
98 | m_set->addProperty(m_longitudeProperty); | 95 | propertySet()->addProperty(m_zoomProperty); | ||
99 | m_set->addProperty(m_zoomProperty); | 96 | propertySet()->addProperty(m_themeProperty); | ||
100 | m_set->addProperty(m_themeProperty); | | |||
101 | } | 97 | } | ||
102 | 98 | | |||
103 | 99 | | |||
104 | void KReportItemMaps::setColumn(const QString &c) | 100 | void KReportItemMaps::setColumn(const QString &c) | ||
105 | { | 101 | { | ||
106 | m_controlSource->setValue(c); | 102 | m_controlSource->setValue(c); | ||
107 | } | 103 | } | ||
108 | 104 | | |||
Show All 14 Lines | 117 | { | |||
123 | 119 | | |||
124 | deserializeData(data); | 120 | deserializeData(data); | ||
125 | m_pageId = page; | 121 | m_pageId = page; | ||
126 | m_sectionId = section; | 122 | m_sectionId = section; | ||
127 | m_offset = offset; | 123 | m_offset = offset; | ||
128 | 124 | | |||
129 | 125 | | |||
130 | m_oroPicture = new OROPicture(); | 126 | m_oroPicture = new OROPicture(); | ||
131 | m_oroPicture->setPosition(m_pos.toScene() + m_offset); | 127 | m_oroPicture->setPosition(scenePosition(position()) + m_offset); | ||
132 | m_oroPicture->setSize(m_size.toScene()); | 128 | m_oroPicture->setSize(sceneSize(size())); | ||
133 | 129 | | |||
134 | if (m_pageId) { | 130 | if (m_pageId) { | ||
135 | m_pageId->addPrimitive(m_oroPicture); | 131 | m_pageId->addPrimitive(m_oroPicture); | ||
136 | } | 132 | } | ||
137 | 133 | | |||
138 | if (m_sectionId) { | 134 | if (m_sectionId) { | ||
139 | OROPicture *i2 = dynamic_cast<OROPicture*>(m_oroPicture->clone()); | 135 | OROPicture *i2 = dynamic_cast<OROPicture*>(m_oroPicture->clone()); | ||
140 | i2->setPosition(m_pos.toPoint()); | 136 | i2->setPosition(scenePosition(position())); | ||
141 | } | 137 | } | ||
142 | 138 | | |||
143 | m_mapRenderer.renderJob(this); | 139 | m_mapRenderer.renderJob(this); | ||
144 | 140 | | |||
145 | return 0; //Item doesn't stretch the section height | 141 | return 0; //Item doesn't stretch the section height | ||
146 | } | 142 | } | ||
147 | 143 | | |||
148 | void KReportItemMaps::deserializeData(const QVariant& serialized) | 144 | void KReportItemMaps::deserializeData(const QVariant& serialized) | ||
Show All 33 Lines | |||||
182 | 178 | | |||
183 | int KReportItemMaps::zoom() const | 179 | int KReportItemMaps::zoom() const | ||
184 | { | 180 | { | ||
185 | return m_zoom; | 181 | return m_zoom; | ||
186 | } | 182 | } | ||
187 | 183 | | |||
188 | QSize KReportItemMaps::size() const | 184 | QSize KReportItemMaps::size() const | ||
189 | { | 185 | { | ||
190 | return m_size.toScene().toSize(); | 186 | return sceneSize(size()).toSize(); | ||
191 | } | 187 | } | ||
192 | 188 | | |||
193 | QString KReportItemMaps::themeId() const | 189 | QString KReportItemMaps::themeId() const | ||
194 | { | 190 | { | ||
195 | return m_themeProperty->value().toString(); | 191 | return m_themeProperty->value().toString(); | ||
196 | } | 192 | } | ||
197 | 193 | | |||
198 | QVariant KReportItemMaps::realItemData(const QVariant& itemData) const | 194 | QVariant KReportItemMaps::realItemData(const QVariant& itemData) const | ||
Show All 31 Lines |