Repository navigation
Expand file tree
/
Copy pathcity.cpp
More file actions
69 lines (60 loc) · 1.81 KB
/
Copy pathcity.cpp
File metadata and controls
69 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "city.h"
#include <QMessageBox>
#include "webviewbridge.h"
#include "overlay.h"
#include "sql.h"
City::City(QObject *parent) : QObject(parent)
{
setObjectName(name());
}
//QList<Overlay*> City::overlayList() {return overlays;}
void City::addOverlay(Overlay* ov)
{
if(!ov->name.isEmpty())
{
//Q_ASSERT(!ov->url().isEmpty());
city_overlayMap->insert(ov->name, ov);
bDirty = true;
}
}
void City::addConnection(Connection* connection)
{
if(connection->description().contains("\n"))
connection->description().remove("\n");
if(!connectionByUuid.contains(connection->uniqueId().toString()))
{
connectionByUuid.insert(connection->uniqueId().toString(), connection);
connections.append(connection);
connection->setId(connections.count()-1);
//curConnectionId = connections.count()-1;
// = connection->id();
_connectionUniqueId = connection->uniqueId();
descrByConnection.clear();
foreach (Connection * connect, connections) {
descrByConnection.insert(connect, connect->description());
}
}
emit connectionAdded(connection);
}
void City::removeOverlay(Overlay* ov)
{
while(city_overlayMap->contains(ov->name))
{
city_overlayMap->remove(ov->name);
bDirty = true;
}
}
void City::setDirty(bool b) {bDirty = b;}
bool City::isDirty() {return bDirty;}
void City::setCityBounds(WebViewBridge* m_bridge)
{
QMessageBox::question(nullptr, "Set City Bounds", "Zoom in or out until the entire 'region in the display covers the region. Then click on the Set Bounds' button");
m_bridge->processScript("addCityBoundsButton");
}
void City::setCenter(LatLng center){this->center = center;}
void City::setId(int id){this->id = id;}
QString City::createLabel(QString name)
{
_label = name.replace(" ","_").remove(',');
return _label;
}