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