ladanyi@98
|
1 |
#include "gui_reader.h"
|
ladanyi@98
|
2 |
#include "xml.h"
|
ladanyi@98
|
3 |
#include "mapstorage.h"
|
hegyi@150
|
4 |
#include <lemon/dim2.h>
|
ladanyi@98
|
5 |
#include <vector>
|
ladanyi@98
|
6 |
|
ladanyi@98
|
7 |
bool GuiReader::header(const std::string& line)
|
ladanyi@98
|
8 |
{
|
ladanyi@98
|
9 |
std::istringstream ls(line);
|
ladanyi@98
|
10 |
std::string head;
|
ladanyi@98
|
11 |
ls >> head;
|
ladanyi@98
|
12 |
return head == "@gui";
|
ladanyi@98
|
13 |
}
|
ladanyi@98
|
14 |
|
ladanyi@98
|
15 |
void GuiReader::read(std::istream& is)
|
ladanyi@98
|
16 |
{
|
ladanyi@98
|
17 |
XmlIo x(is);
|
hegyi@150
|
18 |
std::map<int, XY > m;
|
ladanyi@98
|
19 |
x("arrow_pos", m);
|
ladanyi@98
|
20 |
|
ladanyi@98
|
21 |
if ((int)m.size() != countEdges(mapstorage->graph)) return;
|
ladanyi@98
|
22 |
|
ladanyi@98
|
23 |
for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
|
ladanyi@98
|
24 |
{
|
ladanyi@134
|
25 |
int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e];
|
ladanyi@98
|
26 |
mapstorage->arrow_pos.set(e, m[edgeid]);
|
ladanyi@98
|
27 |
}
|
ladanyi@98
|
28 |
mapstorage->ArrowPosReadOK();
|
hegyi@172
|
29 |
|
hegyi@172
|
30 |
std::map<int, std::string> nm;
|
hegyi@172
|
31 |
x("active_nodemaps", nm);
|
hegyi@172
|
32 |
|
hegyi@172
|
33 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@172
|
34 |
{
|
hegyi@172
|
35 |
mapstorage->changeActiveMap(false, i, nm[i]);
|
hegyi@172
|
36 |
}
|
hegyi@172
|
37 |
|
hegyi@172
|
38 |
std::map<int, std::string> em;
|
hegyi@172
|
39 |
x("active_edgemaps", em);
|
hegyi@172
|
40 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@172
|
41 |
{
|
hegyi@172
|
42 |
mapstorage->changeActiveMap(true, i, em[i]);
|
hegyi@172
|
43 |
}
|
ladanyi@98
|
44 |
}
|
ladanyi@98
|
45 |
|
ladanyi@98
|
46 |
GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
|
ladanyi@98
|
47 |
{
|
ladanyi@98
|
48 |
}
|