|
1 | 1 | /*************************************************************************** |
2 | | - * Copyright (C) by GFZ Potsdam * |
| 2 | + * Copyright (C) by GFZ Potsdam, gempa GmbH * |
3 | 3 | * * |
4 | 4 | * You can redistribute and/or modify this program under the * |
5 | 5 | * terms of the SeisComP Public License. * |
|
10 | 10 | * SeisComP Public License for more details. * |
11 | 11 | ***************************************************************************/ |
12 | 12 |
|
| 13 | + |
13 | 14 | #include <seiscomp3/gui/map/layers/citieslayer.h> |
14 | 15 |
|
15 | 16 | #include <seiscomp3/gui/core/application.h> |
16 | 17 | #include <seiscomp3/gui/map/canvas.h> |
17 | 18 | #include <seiscomp3/gui/map/projection.h> |
| 19 | +#include <seiscomp3/gui/map/standardlegend.h> |
| 20 | + |
18 | 21 |
|
19 | 22 | namespace Seiscomp { |
20 | 23 | namespace Gui { |
21 | 24 | namespace Map { |
22 | 25 |
|
| 26 | +#define CITY_NORMAL_SYMBOL_SIZE 4 |
| 27 | +#define CITY_BIG_SYMBOL_SIZE 6 |
| 28 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
23 | 34 | CitiesLayer::CitiesLayer(QObject* parent) : Layer(parent), _selectedCity(NULL) { |
24 | 35 | setName("cities"); |
25 | | -} |
26 | 36 |
|
27 | | -CitiesLayer::~CitiesLayer() { |
| 37 | + StandardLegend *legend = new StandardLegend(this); |
| 38 | + legend->setTitle(tr("Cities")); |
| 39 | + legend->setArea(Qt::Alignment(Qt::AlignTop | Qt::AlignRight)); |
| 40 | + legend->addItem(new StandardLegendItem(SCScheme.colors.map.cityOutlines, |
| 41 | + SCScheme.colors.map.cityNormal, tr("1Mio- inhabitants"), |
| 42 | + CITY_NORMAL_SYMBOL_SIZE)); |
| 43 | + legend->addItem(new StandardLegendItem(SCScheme.colors.map.cityOutlines, |
| 44 | + SCScheme.colors.map.cityNormal, tr("1Mio+ inhabitants"), |
| 45 | + CITY_BIG_SYMBOL_SIZE)); |
| 46 | + legend->addItem(new StandardLegendItem(SCScheme.colors.map.cityOutlines, |
| 47 | + SCScheme.colors.map.cityCapital, tr("Capital"), |
| 48 | + CITY_BIG_SYMBOL_SIZE)); |
| 49 | + addLegend(legend); |
28 | 50 | } |
| 51 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 57 | +CitiesLayer::~CitiesLayer() {} |
| 58 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 59 | + |
| 60 | + |
29 | 61 |
|
| 62 | + |
| 63 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
30 | 64 | void CitiesLayer::draw(const Seiscomp::Gui::Map::Canvas* canvas, |
31 | 65 | QPainter& painter) { |
32 | 66 | if ( !isVisible() ) return; |
@@ -71,7 +105,12 @@ void CitiesLayer::draw(const Seiscomp::Gui::Map::Canvas* canvas, |
71 | 105 |
|
72 | 106 | painter.restore(); |
73 | 107 | } |
| 108 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 109 | + |
| 110 | + |
| 111 | + |
74 | 112 |
|
| 113 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
75 | 114 | void CitiesLayer::drawCity(QPainter& painter, Grid &grid, QFont &font, |
76 | 115 | bool &lastUnderline, bool &lastBold, |
77 | 116 | const Projection* projection, |
@@ -165,15 +204,30 @@ void CitiesLayer::drawCity(QPainter& painter, Grid &grid, QFont &font, |
165 | 204 | painter.drawText(labelRect, Qt::AlignLeft | Qt::AlignTop | |
166 | 205 | Qt::TextSingleLine, city.name().c_str()); |
167 | 206 | } |
| 207 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 208 | + |
| 209 | + |
| 210 | + |
168 | 211 |
|
| 212 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
169 | 213 | void CitiesLayer::setSelectedCity(const Math::Geo::CityD* c) { |
170 | 214 | _selectedCity = c; |
171 | 215 | } |
| 216 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
172 | 217 |
|
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
173 | 222 | const Math::Geo::CityD* CitiesLayer::selectedCity() const { |
174 | 223 | return _selectedCity; |
175 | 224 | } |
| 225 | +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 226 | + |
| 227 | + |
| 228 | + |
176 | 229 |
|
| 230 | +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
177 | 231 | } // namespace Map |
178 | 232 | } // namespce Gui |
179 | 233 | } // namespace Seiscomp |
0 commit comments