author | hegyi |
Fri, 06 Jan 2006 23:16:51 +0000 | |
branch | gui |
changeset 115 | 9e5196647a5a |
child 134 | 82e19031c319 |
permissions | -rw-r--r-- |
ladanyi@98 | 1 |
#include "gui_reader.h" |
ladanyi@98 | 2 |
#include "xml.h" |
ladanyi@98 | 3 |
#include "mapstorage.h" |
ladanyi@98 | 4 |
#include <lemon/xy.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); |
ladanyi@98 | 18 |
std::map<int, xy<double> > 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@98 | 25 |
int edgeid = (int)(*mapstorage->edgemap_storage["id"])[e]; |
ladanyi@98 | 26 |
mapstorage->arrow_pos.set(e, m[edgeid]); |
ladanyi@98 | 27 |
} |
ladanyi@98 | 28 |
mapstorage->ArrowPosReadOK(); |
ladanyi@98 | 29 |
} |
ladanyi@98 | 30 |
|
ladanyi@98 | 31 |
GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms) |
ladanyi@98 | 32 |
{ |
ladanyi@98 | 33 |
} |