hegyi@1
|
1 |
/* -*- C++ -*-
|
hegyi@1
|
2 |
*
|
hegyi@1
|
3 |
* This file is a part of LEMON, a generic C++ optimization library
|
hegyi@1
|
4 |
*
|
hegyi@1
|
5 |
* Copyright (C) 2003-2006
|
hegyi@1
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
hegyi@1
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
hegyi@1
|
8 |
*
|
hegyi@1
|
9 |
* Permission to use, modify and distribute this software is granted
|
hegyi@1
|
10 |
* provided that this copyright notice appears in all cop ies. For
|
hegyi@1
|
11 |
* precise terms see the accompanying LICENSE file.
|
hegyi@1
|
12 |
*
|
hegyi@1
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
hegyi@1
|
14 |
* express or implied, and with no claim as to its suitability for any
|
hegyi@1
|
15 |
* purpose.
|
hegyi@1
|
16 |
*
|
hegyi@1
|
17 |
*/
|
hegyi@1
|
18 |
|
hegyi@1
|
19 |
#include "i18n.h"
|
hegyi@1
|
20 |
#include <limits>
|
hegyi@1
|
21 |
#include <cmath>
|
hegyi@1
|
22 |
#include <iostream>
|
hegyi@1
|
23 |
#include <fstream>
|
hegyi@1
|
24 |
#include <string>
|
hegyi@1
|
25 |
#include <algorithm>
|
hegyi@1
|
26 |
#include <gtkmm.h>
|
hegyi@1
|
27 |
#include "file_import_dialog.h"
|
hegyi@1
|
28 |
#include <mapstorage.h>
|
hegyi@1
|
29 |
#include <gui_writer.h>
|
hegyi@1
|
30 |
#include <gui_reader.h>
|
hegyi@1
|
31 |
#include <lemon/graph_to_eps.h>
|
hegyi@1
|
32 |
#include <lemon/lgf_reader.h>
|
hegyi@1
|
33 |
#include <lemon/lgf_writer.h>
|
hegyi@1
|
34 |
|
hegyi@1
|
35 |
const int i_d=20;
|
hegyi@1
|
36 |
const double a_d=0.05;
|
hegyi@1
|
37 |
const double p_d=40000;
|
hegyi@1
|
38 |
|
hegyi@1
|
39 |
MapStorage::MapStorage() :
|
hegyi@1
|
40 |
gui_sect_save_dest(LGF_FILE),
|
hegyi@1
|
41 |
node_coords_save_dest(SpecMapSaveOpts::GUI_SECT),
|
hegyi@1
|
42 |
arrow_coords_save_dest(SpecMapSaveOpts::GUI_SECT),
|
hegyi@1
|
43 |
modified(false),
|
hegyi@1
|
44 |
file_name(""),
|
hegyi@1
|
45 |
max_node_label(0),
|
hegyi@1
|
46 |
max_arc_label(0),
|
hegyi@1
|
47 |
node_coords_one_map_name("coord"),
|
hegyi@1
|
48 |
node_coords_two_maps_1_name("coord_x"),
|
hegyi@1
|
49 |
node_coords_two_maps_2_name("coord_y"),
|
hegyi@1
|
50 |
arrow_coords_one_map_name("arrow"),
|
hegyi@1
|
51 |
arrow_coords_two_maps_1_name("arrow_x"),
|
hegyi@1
|
52 |
arrow_coords_two_maps_2_name("arrow_y"),
|
hegyi@1
|
53 |
iterations(i_d),
|
hegyi@1
|
54 |
attraction(a_d),
|
hegyi@1
|
55 |
propulsation(p_d),
|
hegyi@1
|
56 |
node_coords_x(digraph),
|
hegyi@1
|
57 |
node_coords_y(digraph),
|
hegyi@1
|
58 |
arrow_coords_x(digraph),
|
hegyi@1
|
59 |
arrow_coords_y(digraph),
|
hegyi@1
|
60 |
node_label(digraph),
|
hegyi@1
|
61 |
arc_label(digraph),
|
hegyi@1
|
62 |
background_set(false)
|
hegyi@1
|
63 |
{
|
hegyi@1
|
64 |
node_coords.setXMap(node_coords_x);
|
hegyi@1
|
65 |
node_coords.setYMap(node_coords_y);
|
hegyi@1
|
66 |
arrow_coords.setXMap(arrow_coords_x);
|
hegyi@1
|
67 |
arrow_coords.setYMap(arrow_coords_y);
|
hegyi@1
|
68 |
|
hegyi@1
|
69 |
active_nodemaps.resize(NODE_PROPERTY_NUM);
|
hegyi@1
|
70 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@1
|
71 |
{
|
hegyi@1
|
72 |
active_nodemaps[i]="";
|
hegyi@1
|
73 |
}
|
hegyi@1
|
74 |
|
hegyi@1
|
75 |
active_arcmaps.resize(EDGE_PROPERTY_NUM);
|
hegyi@1
|
76 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@1
|
77 |
{
|
hegyi@1
|
78 |
active_arcmaps[i]="";
|
hegyi@1
|
79 |
}
|
hegyi@1
|
80 |
}
|
hegyi@1
|
81 |
|
hegyi@1
|
82 |
MapStorage::~MapStorage()
|
hegyi@1
|
83 |
{
|
hegyi@1
|
84 |
clear();
|
hegyi@1
|
85 |
}
|
hegyi@1
|
86 |
|
hegyi@1
|
87 |
void MapStorage::createNodeMap(const std::string& name, MapValue::Type type,
|
hegyi@1
|
88 |
MapValue def_val)
|
hegyi@1
|
89 |
{
|
hegyi@1
|
90 |
NodeMapStore::const_iterator it = nodemaps.find(name);
|
hegyi@1
|
91 |
if (it != nodemaps.end())
|
hegyi@1
|
92 |
throw Error("Node map " + name + " already exists.");
|
hegyi@1
|
93 |
|
hegyi@1
|
94 |
switch (type)
|
hegyi@1
|
95 |
{
|
hegyi@1
|
96 |
case MapValue::NUMERIC:
|
hegyi@1
|
97 |
nodemaps[name] = new NumericNodeMapData(digraph, def_val);
|
hegyi@1
|
98 |
break;
|
hegyi@1
|
99 |
case MapValue::STRING:
|
hegyi@1
|
100 |
nodemaps[name] = new StringNodeMapData(digraph, def_val);
|
hegyi@1
|
101 |
break;
|
hegyi@1
|
102 |
}
|
hegyi@1
|
103 |
|
hegyi@1
|
104 |
nodemaps[name]->default_value = def_val;
|
hegyi@1
|
105 |
|
hegyi@1
|
106 |
signal_node_map.emit(name, type);
|
hegyi@1
|
107 |
}
|
hegyi@1
|
108 |
|
hegyi@1
|
109 |
void MapStorage::createArcMap(const std::string& name, MapValue::Type type,
|
hegyi@1
|
110 |
MapValue def_val)
|
hegyi@1
|
111 |
{
|
hegyi@1
|
112 |
ArcMapStore::const_iterator it = arcmaps.find(name);
|
hegyi@1
|
113 |
if (it != arcmaps.end())
|
hegyi@1
|
114 |
throw Error("Arc map " + name + " already exists.");
|
hegyi@1
|
115 |
|
hegyi@1
|
116 |
switch (type)
|
hegyi@1
|
117 |
{
|
hegyi@1
|
118 |
case MapValue::NUMERIC:
|
hegyi@1
|
119 |
arcmaps[name] = new NumericArcMapData(digraph, def_val);
|
hegyi@1
|
120 |
break;
|
hegyi@1
|
121 |
case MapValue::STRING:
|
hegyi@1
|
122 |
arcmaps[name] = new StringArcMapData(digraph, def_val);
|
hegyi@1
|
123 |
break;
|
hegyi@1
|
124 |
}
|
hegyi@1
|
125 |
|
hegyi@1
|
126 |
arcmaps[name]->default_value = def_val;
|
hegyi@1
|
127 |
|
hegyi@1
|
128 |
signal_arc_map.emit(name, type);
|
hegyi@1
|
129 |
}
|
hegyi@1
|
130 |
|
hegyi@1
|
131 |
void MapStorage::changeActiveMap(bool itisarc, int prop, std::string mapname)
|
hegyi@1
|
132 |
{
|
hegyi@1
|
133 |
if(itisarc)
|
hegyi@1
|
134 |
{
|
hegyi@1
|
135 |
active_arcmaps[prop]=mapname;
|
hegyi@1
|
136 |
}
|
hegyi@1
|
137 |
else
|
hegyi@1
|
138 |
{
|
hegyi@1
|
139 |
active_nodemaps[prop]=mapname;
|
hegyi@1
|
140 |
}
|
hegyi@1
|
141 |
signal_prop.emit(itisarc, prop);
|
hegyi@1
|
142 |
}
|
hegyi@1
|
143 |
|
hegyi@1
|
144 |
void MapStorage::broadcastActiveMaps()
|
hegyi@1
|
145 |
{
|
hegyi@1
|
146 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@1
|
147 |
{
|
hegyi@1
|
148 |
signal_map_win.emit(false, i, active_nodemaps[i]);
|
hegyi@1
|
149 |
}
|
hegyi@1
|
150 |
|
hegyi@1
|
151 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@1
|
152 |
{
|
hegyi@1
|
153 |
signal_map_win.emit(true, i, active_arcmaps[i]);
|
hegyi@1
|
154 |
}
|
hegyi@1
|
155 |
}
|
hegyi@1
|
156 |
|
hegyi@1
|
157 |
std::string MapStorage::getActiveArcMap(int prop)
|
hegyi@1
|
158 |
{
|
hegyi@1
|
159 |
return active_arcmaps[prop];
|
hegyi@1
|
160 |
}
|
hegyi@1
|
161 |
|
hegyi@1
|
162 |
std::string MapStorage::getActiveNodeMap(int prop)
|
hegyi@1
|
163 |
{
|
hegyi@1
|
164 |
return active_nodemaps[prop];
|
hegyi@1
|
165 |
}
|
hegyi@1
|
166 |
|
hegyi@1
|
167 |
std::vector<std::string> MapStorage::getArcMapList(MapType type)
|
hegyi@1
|
168 |
{
|
hegyi@1
|
169 |
if (type == ALL)
|
hegyi@1
|
170 |
{
|
hegyi@1
|
171 |
std::vector<std::string> ret;
|
hegyi@1
|
172 |
for (ArcMapStore::const_iterator it = arcmaps.begin();
|
hegyi@1
|
173 |
it != arcmaps.end(); ++it)
|
hegyi@1
|
174 |
{
|
hegyi@1
|
175 |
ret.push_back(it->first);
|
hegyi@1
|
176 |
}
|
hegyi@1
|
177 |
return ret;
|
hegyi@1
|
178 |
}
|
hegyi@1
|
179 |
else
|
hegyi@1
|
180 |
{
|
hegyi@1
|
181 |
std::vector<std::string> ret;
|
hegyi@1
|
182 |
for (ArcMapStore::const_iterator it = arcmaps.begin();
|
hegyi@1
|
183 |
it != arcmaps.end(); ++it)
|
hegyi@1
|
184 |
{
|
hegyi@1
|
185 |
ArcMapData* data = getArcMapData(it->first);
|
hegyi@1
|
186 |
MapValue::Type t = data->type();
|
hegyi@1
|
187 |
if ((t == MapValue::NUMERIC && (type & NUM)) ||
|
hegyi@1
|
188 |
(t == MapValue::STRING && (type & STR)))
|
hegyi@1
|
189 |
{
|
hegyi@1
|
190 |
ret.push_back(it->first);
|
hegyi@1
|
191 |
}
|
hegyi@1
|
192 |
}
|
hegyi@1
|
193 |
return ret;
|
hegyi@1
|
194 |
}
|
hegyi@1
|
195 |
}
|
hegyi@1
|
196 |
|
hegyi@1
|
197 |
std::vector<std::string> MapStorage::getNodeMapList(MapType type)
|
hegyi@1
|
198 |
{
|
hegyi@1
|
199 |
if (type == ALL)
|
hegyi@1
|
200 |
{
|
hegyi@1
|
201 |
std::vector<std::string> ret;
|
hegyi@1
|
202 |
for (NodeMapStore::const_iterator it = nodemaps.begin();
|
hegyi@1
|
203 |
it != nodemaps.end(); ++it)
|
hegyi@1
|
204 |
{
|
hegyi@1
|
205 |
ret.push_back(it->first);
|
hegyi@1
|
206 |
}
|
hegyi@1
|
207 |
return ret;
|
hegyi@1
|
208 |
}
|
hegyi@1
|
209 |
else
|
hegyi@1
|
210 |
{
|
hegyi@1
|
211 |
std::vector<std::string> ret;
|
hegyi@1
|
212 |
for (NodeMapStore::const_iterator it = nodemaps.begin();
|
hegyi@1
|
213 |
it != nodemaps.end(); ++it)
|
hegyi@1
|
214 |
{
|
hegyi@1
|
215 |
NodeMapData* data = getNodeMapData(it->first);
|
hegyi@1
|
216 |
MapValue::Type t = data->type();
|
hegyi@1
|
217 |
if ((t == MapValue::NUMERIC && (type & NUM)) ||
|
hegyi@1
|
218 |
(t == MapValue::STRING && (type & STR)))
|
hegyi@1
|
219 |
{
|
hegyi@1
|
220 |
ret.push_back(it->first);
|
hegyi@1
|
221 |
}
|
hegyi@1
|
222 |
}
|
hegyi@1
|
223 |
return ret;
|
hegyi@1
|
224 |
}
|
hegyi@1
|
225 |
}
|
hegyi@1
|
226 |
|
hegyi@1
|
227 |
sigc::signal<void, bool, int> MapStorage::signal_prop_ch()
|
hegyi@1
|
228 |
{
|
hegyi@1
|
229 |
return signal_prop;
|
hegyi@1
|
230 |
}
|
hegyi@1
|
231 |
|
hegyi@1
|
232 |
int MapStorage::readFromFile(const std::string &filename)
|
hegyi@1
|
233 |
{
|
hegyi@1
|
234 |
using std::vector;
|
hegyi@1
|
235 |
using std::map;
|
hegyi@1
|
236 |
using std::string;
|
hegyi@1
|
237 |
|
hegyi@1
|
238 |
//reading content of file
|
hegyi@1
|
239 |
LgfContents content(filename);
|
hegyi@1
|
240 |
try
|
hegyi@1
|
241 |
{
|
hegyi@1
|
242 |
content.run();
|
hegyi@1
|
243 |
}
|
hegyi@1
|
244 |
catch (Exception& error)
|
hegyi@1
|
245 |
{
|
hegyi@1
|
246 |
Gtk::MessageDialog mdialog(error.what());
|
hegyi@1
|
247 |
mdialog.run();
|
hegyi@1
|
248 |
clear();
|
hegyi@1
|
249 |
return 1;
|
hegyi@1
|
250 |
}
|
hegyi@1
|
251 |
|
hegyi@1
|
252 |
// check whether the .conf file exists
|
hegyi@1
|
253 |
bool gui_data_in_conf = g_file_test((filename + ".conf").c_str(),
|
hegyi@1
|
254 |
(GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR));
|
hegyi@1
|
255 |
|
hegyi@1
|
256 |
// check whether the .lgf file contains a gui section
|
hegyi@1
|
257 |
bool gui_data_in_lgf = false;
|
hegyi@1
|
258 |
{
|
hegyi@1
|
259 |
for(int i=0;i<content.extraSectionNum();i++)
|
hegyi@1
|
260 |
{
|
hegyi@1
|
261 |
if(content.extraSection(i)=="gui")
|
hegyi@1
|
262 |
{
|
hegyi@1
|
263 |
gui_data_in_lgf = true;
|
hegyi@1
|
264 |
}
|
hegyi@1
|
265 |
}
|
hegyi@1
|
266 |
}
|
hegyi@1
|
267 |
|
hegyi@1
|
268 |
bool gui_data_found = gui_data_in_lgf || gui_data_in_conf;
|
hegyi@1
|
269 |
|
hegyi@1
|
270 |
// ask for user input if both exist
|
hegyi@1
|
271 |
bool use_gui_data_in_lgf = false;
|
hegyi@1
|
272 |
if (gui_data_in_conf && gui_data_in_lgf)
|
hegyi@1
|
273 |
{
|
hegyi@1
|
274 |
Gtk::MessageDialog mdialog(_("<b>Found both ") + filename +
|
hegyi@1
|
275 |
_(".conf and a gui section in ") + filename + _(".</b>"), true,
|
hegyi@1
|
276 |
Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
|
hegyi@1
|
277 |
mdialog.add_button(_("Use the ._conf file"), 1);
|
hegyi@1
|
278 |
mdialog.add_button(_("Use the _gui section"), 2);
|
hegyi@1
|
279 |
switch (mdialog.run())
|
hegyi@1
|
280 |
{
|
hegyi@1
|
281 |
case 1:
|
hegyi@1
|
282 |
use_gui_data_in_lgf = false;
|
hegyi@1
|
283 |
break;
|
hegyi@1
|
284 |
case 2:
|
hegyi@1
|
285 |
use_gui_data_in_lgf = true;
|
hegyi@1
|
286 |
break;
|
hegyi@1
|
287 |
case Gtk::RESPONSE_NONE:
|
hegyi@1
|
288 |
return 1;
|
hegyi@1
|
289 |
}
|
hegyi@1
|
290 |
}
|
hegyi@1
|
291 |
else
|
hegyi@1
|
292 |
{
|
hegyi@1
|
293 |
use_gui_data_in_lgf = gui_data_in_lgf;
|
hegyi@1
|
294 |
}
|
hegyi@1
|
295 |
|
hegyi@1
|
296 |
if (gui_data_found)
|
hegyi@1
|
297 |
{
|
hegyi@1
|
298 |
GUISectData gui_data;
|
hegyi@1
|
299 |
if (use_gui_data_in_lgf)
|
hegyi@1
|
300 |
{
|
hegyi@1
|
301 |
// read the gui section from the .lgf file
|
hegyi@1
|
302 |
try
|
hegyi@1
|
303 |
{
|
hegyi@1
|
304 |
sectionReader(filename).sectionStream("gui", GuiReader(this, gui_data)).run();
|
hegyi@1
|
305 |
gui_sect_save_dest = LGF_FILE;
|
hegyi@1
|
306 |
}
|
hegyi@1
|
307 |
catch (Exception& error)
|
hegyi@1
|
308 |
{
|
hegyi@1
|
309 |
clear();
|
hegyi@1
|
310 |
return 1;
|
hegyi@1
|
311 |
}
|
hegyi@1
|
312 |
}
|
hegyi@1
|
313 |
else
|
hegyi@1
|
314 |
{
|
hegyi@1
|
315 |
// read the gui section from the .conf file
|
hegyi@1
|
316 |
try
|
hegyi@1
|
317 |
{
|
hegyi@1
|
318 |
sectionReader(filename + ".conf").sectionStream("gui", GuiReader(this, gui_data)).run();
|
hegyi@1
|
319 |
gui_sect_save_dest = CONF_FILE;
|
hegyi@1
|
320 |
}
|
hegyi@1
|
321 |
catch (Exception& error)
|
hegyi@1
|
322 |
{
|
hegyi@1
|
323 |
clear();
|
hegyi@1
|
324 |
return 1;
|
hegyi@1
|
325 |
}
|
hegyi@1
|
326 |
}
|
hegyi@1
|
327 |
|
hegyi@1
|
328 |
// read the digraph and maps form the .lgf file
|
hegyi@1
|
329 |
try
|
hegyi@1
|
330 |
{
|
hegyi@1
|
331 |
std::string node_coord_xmap_name, node_coord_ymap_name;
|
hegyi@1
|
332 |
std::string arrow_coord_xmap_name, arrow_coord_ymap_name;
|
hegyi@1
|
333 |
|
hegyi@1
|
334 |
if (gui_data.node_coords_save_dest ==
|
hegyi@1
|
335 |
MapStorage::SpecMapSaveOpts::NESET_SECT)
|
hegyi@1
|
336 |
{
|
hegyi@1
|
337 |
switch (gui_data.node_coords_save_map_num)
|
hegyi@1
|
338 |
{
|
hegyi@1
|
339 |
case SpecMapSaveOpts::ONE_MAP:
|
hegyi@1
|
340 |
node_coord_xmap_name = gui_data.node_coords_one_map_name + ":x";
|
hegyi@1
|
341 |
node_coord_ymap_name = gui_data.node_coords_one_map_name + ":y";
|
hegyi@1
|
342 |
node_coords_one_map_name = gui_data.node_coords_one_map_name;
|
hegyi@1
|
343 |
break;
|
hegyi@1
|
344 |
case SpecMapSaveOpts::TWO_MAPS:
|
hegyi@1
|
345 |
node_coord_xmap_name = gui_data.node_coords_two_maps_1_name;
|
hegyi@1
|
346 |
node_coord_ymap_name = gui_data.node_coords_two_maps_2_name;
|
hegyi@1
|
347 |
node_coords_two_maps_1_name = gui_data.node_coords_two_maps_1_name;
|
hegyi@1
|
348 |
node_coords_two_maps_2_name = gui_data.node_coords_two_maps_2_name;
|
hegyi@1
|
349 |
break;
|
hegyi@1
|
350 |
}
|
hegyi@1
|
351 |
node_coords_save_dest = gui_data.node_coords_save_dest;
|
hegyi@1
|
352 |
node_coords_save_map_num = gui_data.node_coords_save_map_num;
|
hegyi@1
|
353 |
}
|
hegyi@1
|
354 |
|
hegyi@1
|
355 |
if (gui_data.arrow_coords_save_dest ==
|
hegyi@1
|
356 |
MapStorage::SpecMapSaveOpts::NESET_SECT)
|
hegyi@1
|
357 |
{
|
hegyi@1
|
358 |
switch (gui_data.arrow_coords_save_map_num)
|
hegyi@1
|
359 |
{
|
hegyi@1
|
360 |
case SpecMapSaveOpts::ONE_MAP:
|
hegyi@1
|
361 |
arrow_coord_xmap_name = gui_data.arrow_coords_one_map_name + ":x";
|
hegyi@1
|
362 |
arrow_coord_ymap_name = gui_data.arrow_coords_one_map_name + ":y";
|
hegyi@1
|
363 |
arrow_coords_one_map_name = gui_data.arrow_coords_one_map_name;
|
hegyi@1
|
364 |
break;
|
hegyi@1
|
365 |
case SpecMapSaveOpts::TWO_MAPS:
|
hegyi@1
|
366 |
arrow_coord_xmap_name = gui_data.arrow_coords_two_maps_1_name;
|
hegyi@1
|
367 |
arrow_coord_ymap_name = gui_data.arrow_coords_two_maps_2_name;
|
hegyi@1
|
368 |
arrow_coords_two_maps_1_name =
|
hegyi@1
|
369 |
gui_data.arrow_coords_two_maps_1_name;
|
hegyi@1
|
370 |
arrow_coords_two_maps_2_name =
|
hegyi@1
|
371 |
gui_data.arrow_coords_two_maps_2_name;
|
hegyi@1
|
372 |
break;
|
hegyi@1
|
373 |
}
|
hegyi@1
|
374 |
arrow_coords_save_dest = gui_data.arrow_coords_save_dest;
|
hegyi@1
|
375 |
arrow_coords_save_map_num = gui_data.arrow_coords_save_map_num;
|
hegyi@1
|
376 |
}
|
hegyi@1
|
377 |
readLGF(filename, true,
|
hegyi@1
|
378 |
gui_data.main_node_map_names, gui_data.main_arc_map_names,
|
hegyi@1
|
379 |
gui_data.node_map_types, gui_data.arc_map_types,
|
hegyi@1
|
380 |
node_coord_xmap_name, node_coord_ymap_name,
|
hegyi@1
|
381 |
arrow_coord_xmap_name, arrow_coord_ymap_name);
|
hegyi@1
|
382 |
}
|
hegyi@1
|
383 |
catch (Exception& error)
|
hegyi@1
|
384 |
{
|
hegyi@1
|
385 |
clear();
|
hegyi@1
|
386 |
return 1;
|
hegyi@1
|
387 |
}
|
hegyi@1
|
388 |
|
hegyi@1
|
389 |
// add the maps from the gui section
|
hegyi@1
|
390 |
for (vector<string>::const_iterator
|
hegyi@1
|
391 |
it = gui_data.gui_node_map_names.begin();
|
hegyi@1
|
392 |
it != gui_data.gui_node_map_names.end(); ++it)
|
hegyi@1
|
393 |
{
|
hegyi@1
|
394 |
string map_name = *it;
|
hegyi@1
|
395 |
switch (gui_data.node_map_types[map_name])
|
hegyi@1
|
396 |
{
|
hegyi@1
|
397 |
case MapValue::NUMERIC:
|
hegyi@1
|
398 |
{
|
hegyi@1
|
399 |
createNodeMap(map_name, MapValue::NUMERIC, double());
|
hegyi@1
|
400 |
NumericNodeMap& dmap = getNumericNodeMap(map_name);
|
hegyi@1
|
401 |
map<int, double>& smap = *gui_data.numeric_node_maps[map_name];
|
hegyi@1
|
402 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
403 |
{
|
hegyi@1
|
404 |
dmap[n] = smap[node_label[n]];
|
hegyi@1
|
405 |
}
|
hegyi@1
|
406 |
break;
|
hegyi@1
|
407 |
}
|
hegyi@1
|
408 |
case MapValue::STRING:
|
hegyi@1
|
409 |
{
|
hegyi@1
|
410 |
createNodeMap(map_name, MapValue::STRING, string());
|
hegyi@1
|
411 |
StringNodeMap& dmap = getStringNodeMap(map_name);
|
hegyi@1
|
412 |
map<int, string>& smap = *gui_data.string_node_maps[map_name];
|
hegyi@1
|
413 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
414 |
{
|
hegyi@1
|
415 |
dmap[n] = smap[node_label[n]];
|
hegyi@1
|
416 |
}
|
hegyi@1
|
417 |
break;
|
hegyi@1
|
418 |
}
|
hegyi@1
|
419 |
}
|
hegyi@1
|
420 |
getNodeMapData(map_name)->save_dest = GUI_SECT;
|
hegyi@1
|
421 |
}
|
hegyi@1
|
422 |
for (vector<string>::const_iterator
|
hegyi@1
|
423 |
it = gui_data.gui_arc_map_names.begin();
|
hegyi@1
|
424 |
it != gui_data.gui_arc_map_names.end(); ++it)
|
hegyi@1
|
425 |
{
|
hegyi@1
|
426 |
string map_name = *it;
|
hegyi@1
|
427 |
switch (gui_data.arc_map_types[map_name])
|
hegyi@1
|
428 |
{
|
hegyi@1
|
429 |
case MapValue::NUMERIC:
|
hegyi@1
|
430 |
{
|
hegyi@1
|
431 |
createArcMap(map_name, MapValue::NUMERIC, double());
|
hegyi@1
|
432 |
NumericArcMap& dmap = getNumericArcMap(map_name);
|
hegyi@1
|
433 |
map<int, double>& smap = *gui_data.numeric_arc_maps[map_name];
|
hegyi@1
|
434 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
435 |
{
|
hegyi@1
|
436 |
dmap[e] = smap[arc_label[e]];
|
hegyi@1
|
437 |
}
|
hegyi@1
|
438 |
break;
|
hegyi@1
|
439 |
}
|
hegyi@1
|
440 |
case MapValue::STRING:
|
hegyi@1
|
441 |
{
|
hegyi@1
|
442 |
createArcMap(map_name, MapValue::STRING, string());
|
hegyi@1
|
443 |
StringArcMap& dmap = getStringArcMap(map_name);
|
hegyi@1
|
444 |
map<int, string>& smap = *gui_data.string_arc_maps[map_name];
|
hegyi@1
|
445 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
446 |
{
|
hegyi@1
|
447 |
dmap[e] = smap[arc_label[e]];
|
hegyi@1
|
448 |
}
|
hegyi@1
|
449 |
break;
|
hegyi@1
|
450 |
}
|
hegyi@1
|
451 |
}
|
hegyi@1
|
452 |
getArcMapData(map_name)->save_dest = GUI_SECT;
|
hegyi@1
|
453 |
}
|
hegyi@1
|
454 |
|
hegyi@1
|
455 |
// restore the node coordinate maps
|
hegyi@1
|
456 |
if (gui_data.node_coords_save_dest ==
|
hegyi@1
|
457 |
MapStorage::SpecMapSaveOpts::GUI_SECT)
|
hegyi@1
|
458 |
{
|
hegyi@1
|
459 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
460 |
{
|
hegyi@1
|
461 |
node_coords.set(n, gui_data.node_coord_map[node_label[n]]);
|
hegyi@1
|
462 |
}
|
hegyi@1
|
463 |
node_coords_save_dest = gui_data.node_coords_save_dest;
|
hegyi@1
|
464 |
}
|
hegyi@1
|
465 |
// restore the arrow coordinate maps
|
hegyi@1
|
466 |
if (gui_data.arrow_coords_save_dest ==
|
hegyi@1
|
467 |
MapStorage::SpecMapSaveOpts::GUI_SECT)
|
hegyi@1
|
468 |
{
|
hegyi@1
|
469 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
470 |
{
|
hegyi@1
|
471 |
arrow_coords.set(e, gui_data.arrow_coord_map[arc_label[e]]);
|
hegyi@1
|
472 |
}
|
hegyi@1
|
473 |
arrow_coords_save_dest = gui_data.arrow_coords_save_dest;
|
hegyi@1
|
474 |
}
|
hegyi@1
|
475 |
}
|
hegyi@1
|
476 |
else
|
hegyi@1
|
477 |
{
|
hegyi@1
|
478 |
// there is no gui section neither in the .lgf file nor in the .conf file
|
hegyi@1
|
479 |
{
|
hegyi@1
|
480 |
if (content.nodeSectionNum() < 1)
|
hegyi@1
|
481 |
{
|
hegyi@1
|
482 |
Gtk::MessageDialog mdialog("No nodeset found in file.");
|
hegyi@1
|
483 |
mdialog.run();
|
hegyi@1
|
484 |
clear();
|
hegyi@1
|
485 |
return 1;
|
hegyi@1
|
486 |
}
|
hegyi@1
|
487 |
|
hegyi@1
|
488 |
if (content.arcSectionNum() < 1)
|
hegyi@1
|
489 |
{
|
hegyi@1
|
490 |
Gtk::MessageDialog mdialog("No arcset found in file.");
|
hegyi@1
|
491 |
mdialog.run();
|
hegyi@1
|
492 |
clear();
|
hegyi@1
|
493 |
return 1;
|
hegyi@1
|
494 |
}
|
hegyi@1
|
495 |
|
hegyi@1
|
496 |
std::vector<std::string> nodeMapNames = content.nodeMapNames(0);
|
hegyi@1
|
497 |
std::vector<std::string> arcMapNames = content.arcMapNames(0);
|
hegyi@1
|
498 |
|
hegyi@1
|
499 |
bool read_arc_label = true;
|
hegyi@1
|
500 |
if (std::find(arcMapNames.begin(), arcMapNames.end(), "label") ==
|
hegyi@1
|
501 |
arcMapNames.end())
|
hegyi@1
|
502 |
{
|
hegyi@1
|
503 |
read_arc_label = false;
|
hegyi@1
|
504 |
}
|
hegyi@1
|
505 |
|
hegyi@1
|
506 |
nodeMapNames.erase(
|
hegyi@1
|
507 |
std::remove(nodeMapNames.begin(), nodeMapNames.end(), "label"),
|
hegyi@1
|
508 |
nodeMapNames.end());
|
hegyi@1
|
509 |
|
hegyi@1
|
510 |
arcMapNames.erase(
|
hegyi@1
|
511 |
std::remove(arcMapNames.begin(), arcMapNames.end(), "label"),
|
hegyi@1
|
512 |
arcMapNames.end());
|
hegyi@1
|
513 |
|
hegyi@1
|
514 |
FileImportDialog::ImportData data(nodeMapNames, arcMapNames);
|
hegyi@1
|
515 |
FileImportDialog fidialog(&data);
|
hegyi@1
|
516 |
int response = fidialog.run();
|
hegyi@1
|
517 |
if (response == Gtk::RESPONSE_OK)
|
hegyi@1
|
518 |
{
|
hegyi@1
|
519 |
try
|
hegyi@1
|
520 |
{
|
hegyi@1
|
521 |
std::string node_coord_xmap_name, node_coord_ymap_name;
|
hegyi@1
|
522 |
std::string arrow_coord_xmap_name, arrow_coord_ymap_name;
|
hegyi@1
|
523 |
bool gen_node_coords = false;
|
hegyi@1
|
524 |
bool gen_arrow_coords = false;
|
hegyi@1
|
525 |
|
hegyi@1
|
526 |
switch (data.node_coord_load_from)
|
hegyi@1
|
527 |
{
|
hegyi@1
|
528 |
case FileImportDialog::ImportData::ONE_MAP:
|
hegyi@1
|
529 |
node_coord_xmap_name = data.node_coord_one_map_name + ":x";
|
hegyi@1
|
530 |
node_coord_ymap_name = data.node_coord_one_map_name + ":y";
|
hegyi@1
|
531 |
node_coords_one_map_name = data.node_coord_one_map_name;
|
hegyi@1
|
532 |
|
hegyi@1
|
533 |
node_coords_save_dest = SpecMapSaveOpts::NESET_SECT;
|
hegyi@1
|
534 |
node_coords_save_map_num = SpecMapSaveOpts::ONE_MAP;
|
hegyi@1
|
535 |
break;
|
hegyi@1
|
536 |
case FileImportDialog::ImportData::TWO_MAPS:
|
hegyi@1
|
537 |
node_coord_xmap_name = data.node_coord_two_maps_1_name;
|
hegyi@1
|
538 |
node_coord_ymap_name = data.node_coord_two_maps_2_name;
|
hegyi@1
|
539 |
node_coords_two_maps_1_name = data.node_coord_two_maps_1_name;
|
hegyi@1
|
540 |
node_coords_two_maps_2_name = data.node_coord_two_maps_2_name;
|
hegyi@1
|
541 |
|
hegyi@1
|
542 |
node_coords_save_dest = SpecMapSaveOpts::NESET_SECT;
|
hegyi@1
|
543 |
node_coords_save_map_num = SpecMapSaveOpts::TWO_MAPS;
|
hegyi@1
|
544 |
break;
|
hegyi@1
|
545 |
case FileImportDialog::ImportData::DONT_READ:
|
hegyi@1
|
546 |
node_coord_xmap_name = "";
|
hegyi@1
|
547 |
node_coord_ymap_name = "";
|
hegyi@1
|
548 |
|
hegyi@1
|
549 |
node_coords_save_dest = SpecMapSaveOpts::GUI_SECT;
|
hegyi@1
|
550 |
gen_node_coords = true;
|
hegyi@1
|
551 |
break;
|
hegyi@1
|
552 |
}
|
hegyi@1
|
553 |
|
hegyi@1
|
554 |
switch (data.arrow_coord_load_from)
|
hegyi@1
|
555 |
{
|
hegyi@1
|
556 |
case FileImportDialog::ImportData::ONE_MAP:
|
hegyi@1
|
557 |
arrow_coord_xmap_name = data.arrow_coord_one_map_name + ":x";
|
hegyi@1
|
558 |
arrow_coord_ymap_name = data.arrow_coord_one_map_name + ":y";
|
hegyi@1
|
559 |
arrow_coords_one_map_name = data.arrow_coord_one_map_name;
|
hegyi@1
|
560 |
|
hegyi@1
|
561 |
arrow_coords_save_dest = SpecMapSaveOpts::NESET_SECT;
|
hegyi@1
|
562 |
arrow_coords_save_map_num = SpecMapSaveOpts::ONE_MAP;
|
hegyi@1
|
563 |
break;
|
hegyi@1
|
564 |
case FileImportDialog::ImportData::TWO_MAPS:
|
hegyi@1
|
565 |
arrow_coord_xmap_name = data.arrow_coord_two_maps_1_name;
|
hegyi@1
|
566 |
arrow_coord_ymap_name = data.arrow_coord_two_maps_2_name;
|
hegyi@1
|
567 |
arrow_coords_two_maps_1_name = data.arrow_coord_two_maps_1_name;
|
hegyi@1
|
568 |
arrow_coords_two_maps_2_name = data.arrow_coord_two_maps_2_name;
|
hegyi@1
|
569 |
|
hegyi@1
|
570 |
arrow_coords_save_dest = SpecMapSaveOpts::NESET_SECT;
|
hegyi@1
|
571 |
arrow_coords_save_map_num = SpecMapSaveOpts::TWO_MAPS;
|
hegyi@1
|
572 |
break;
|
hegyi@1
|
573 |
case FileImportDialog::ImportData::DONT_READ:
|
hegyi@1
|
574 |
arrow_coord_xmap_name = "";
|
hegyi@1
|
575 |
arrow_coord_ymap_name = "";
|
hegyi@1
|
576 |
|
hegyi@1
|
577 |
arrow_coords_save_dest = SpecMapSaveOpts::GUI_SECT;
|
hegyi@1
|
578 |
gen_arrow_coords = true;
|
hegyi@1
|
579 |
break;
|
hegyi@1
|
580 |
}
|
hegyi@1
|
581 |
|
hegyi@1
|
582 |
// read arc and node maps
|
hegyi@1
|
583 |
std::vector<std::string> node_map_names;
|
hegyi@1
|
584 |
std::vector<std::string> arc_map_names;
|
hegyi@1
|
585 |
std::map<std::string, MapValue::Type> node_map_types;
|
hegyi@1
|
586 |
std::map<std::string, MapValue::Type> arc_map_types;
|
hegyi@1
|
587 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
588 |
data.numeric_node_map_names.begin();
|
hegyi@1
|
589 |
it != data.numeric_node_map_names.end(); ++it)
|
hegyi@1
|
590 |
{
|
hegyi@1
|
591 |
node_map_names.push_back(*it);
|
hegyi@1
|
592 |
node_map_types[*it] = MapValue::NUMERIC;
|
hegyi@1
|
593 |
}
|
hegyi@1
|
594 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
595 |
data.string_node_map_names.begin();
|
hegyi@1
|
596 |
it != data.string_node_map_names.end(); ++it)
|
hegyi@1
|
597 |
{
|
hegyi@1
|
598 |
node_map_names.push_back(*it);
|
hegyi@1
|
599 |
node_map_types[*it] = MapValue::STRING;
|
hegyi@1
|
600 |
}
|
hegyi@1
|
601 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
602 |
data.numeric_arc_map_names.begin();
|
hegyi@1
|
603 |
it != data.numeric_arc_map_names.end(); ++it)
|
hegyi@1
|
604 |
{
|
hegyi@1
|
605 |
arc_map_names.push_back(*it);
|
hegyi@1
|
606 |
arc_map_types[*it] = MapValue::NUMERIC;
|
hegyi@1
|
607 |
}
|
hegyi@1
|
608 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
609 |
data.string_arc_map_names.begin();
|
hegyi@1
|
610 |
it != data.string_arc_map_names.end(); ++it)
|
hegyi@1
|
611 |
{
|
hegyi@1
|
612 |
arc_map_names.push_back(*it);
|
hegyi@1
|
613 |
arc_map_types[*it] = MapValue::STRING;
|
hegyi@1
|
614 |
}
|
hegyi@1
|
615 |
|
hegyi@1
|
616 |
readLGF(filename, read_arc_label,
|
hegyi@1
|
617 |
node_map_names, arc_map_names,
|
hegyi@1
|
618 |
node_map_types, arc_map_types,
|
hegyi@1
|
619 |
node_coord_xmap_name, node_coord_ymap_name,
|
hegyi@1
|
620 |
arrow_coord_xmap_name, arrow_coord_ymap_name);
|
hegyi@1
|
621 |
|
hegyi@1
|
622 |
// generate arc labels
|
hegyi@1
|
623 |
if (!read_arc_label)
|
hegyi@1
|
624 |
{
|
hegyi@1
|
625 |
int l = 0;
|
hegyi@1
|
626 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
627 |
{
|
hegyi@1
|
628 |
arc_label[e] = l++;
|
hegyi@1
|
629 |
}
|
hegyi@1
|
630 |
}
|
hegyi@1
|
631 |
|
hegyi@1
|
632 |
if (gen_node_coords)
|
hegyi@1
|
633 |
{
|
hegyi@1
|
634 |
// generate node coordinates
|
hegyi@1
|
635 |
int node_num = 0;
|
hegyi@1
|
636 |
for (NodeIt n(digraph); n != INVALID; ++n) { node_num++; }
|
hegyi@1
|
637 |
const double pi = 3.142;
|
hegyi@1
|
638 |
double step = 2 * pi / (double) node_num;
|
hegyi@1
|
639 |
int i = 0;
|
hegyi@1
|
640 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
641 |
{
|
hegyi@1
|
642 |
setNodeCoords(n,
|
hegyi@1
|
643 |
XY(250.0 * std::cos(i * step),
|
hegyi@1
|
644 |
250.0 * std::sin(i * step)));
|
hegyi@1
|
645 |
i++;
|
hegyi@1
|
646 |
}
|
hegyi@1
|
647 |
}
|
hegyi@1
|
648 |
if (gen_arrow_coords)
|
hegyi@1
|
649 |
{
|
hegyi@1
|
650 |
// generate arrow coordinates
|
hegyi@1
|
651 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
652 |
{
|
hegyi@1
|
653 |
if (digraph.source(e) == digraph.target(e))
|
hegyi@1
|
654 |
{
|
hegyi@1
|
655 |
setArrowCoords(e,
|
hegyi@1
|
656 |
getNodeCoords(digraph.source(e)) + XY(0.0, 80.0));
|
hegyi@1
|
657 |
}
|
hegyi@1
|
658 |
else
|
hegyi@1
|
659 |
{
|
hegyi@1
|
660 |
setArrowCoords(e,
|
hegyi@1
|
661 |
(getNodeCoords(digraph.source(e)) +
|
hegyi@1
|
662 |
getNodeCoords(digraph.target(e))) / 2.0);
|
hegyi@1
|
663 |
}
|
hegyi@1
|
664 |
}
|
hegyi@1
|
665 |
}
|
hegyi@1
|
666 |
}
|
hegyi@1
|
667 |
catch (Exception& error)
|
hegyi@1
|
668 |
{
|
hegyi@1
|
669 |
clear();
|
hegyi@1
|
670 |
return 1;
|
hegyi@1
|
671 |
}
|
hegyi@1
|
672 |
}
|
hegyi@1
|
673 |
else
|
hegyi@1
|
674 |
{
|
hegyi@1
|
675 |
clear();
|
hegyi@1
|
676 |
return 1;
|
hegyi@1
|
677 |
}
|
hegyi@1
|
678 |
}
|
hegyi@1
|
679 |
}
|
hegyi@1
|
680 |
|
hegyi@1
|
681 |
// set max_node_label
|
hegyi@1
|
682 |
{
|
hegyi@1
|
683 |
max_node_label = std::numeric_limits<int>::min();
|
hegyi@1
|
684 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
685 |
{
|
hegyi@1
|
686 |
if (node_label[n] > max_node_label)
|
hegyi@1
|
687 |
{
|
hegyi@1
|
688 |
max_node_label = node_label[n];
|
hegyi@1
|
689 |
}
|
hegyi@1
|
690 |
}
|
hegyi@1
|
691 |
}
|
hegyi@1
|
692 |
// set max_arc_label
|
hegyi@1
|
693 |
{
|
hegyi@1
|
694 |
max_arc_label = std::numeric_limits<int>::min();
|
hegyi@1
|
695 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
696 |
{
|
hegyi@1
|
697 |
if (arc_label[e] > max_arc_label)
|
hegyi@1
|
698 |
{
|
hegyi@1
|
699 |
max_arc_label = arc_label[e];
|
hegyi@1
|
700 |
}
|
hegyi@1
|
701 |
}
|
hegyi@1
|
702 |
}
|
hegyi@1
|
703 |
|
hegyi@1
|
704 |
return 0;
|
hegyi@1
|
705 |
}
|
hegyi@1
|
706 |
|
hegyi@1
|
707 |
void MapStorage::writeToFile(const std::string &filename)
|
hegyi@1
|
708 |
{
|
hegyi@1
|
709 |
// relabel nodes and arcs
|
hegyi@1
|
710 |
int i = 0;
|
hegyi@1
|
711 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
712 |
{
|
hegyi@1
|
713 |
node_label[n] = i++;
|
hegyi@1
|
714 |
}
|
hegyi@1
|
715 |
max_node_label = i-1;
|
hegyi@1
|
716 |
i = 0;
|
hegyi@1
|
717 |
for (ArcIt e(digraph); e != INVALID; ++e)
|
hegyi@1
|
718 |
{
|
hegyi@1
|
719 |
arc_label[e] = i++;
|
hegyi@1
|
720 |
}
|
hegyi@1
|
721 |
max_arc_label = i-1;
|
hegyi@1
|
722 |
|
hegyi@1
|
723 |
// write .lgf file
|
hegyi@1
|
724 |
{
|
hegyi@1
|
725 |
DigraphWriter<Digraph> gwriter(filename, digraph);
|
hegyi@1
|
726 |
|
hegyi@1
|
727 |
gwriter.nodeMap("label", node_label);
|
hegyi@1
|
728 |
gwriter.arcMap("label", arc_label);
|
hegyi@1
|
729 |
|
hegyi@1
|
730 |
// write node maps
|
hegyi@1
|
731 |
for (NodeMapStore::const_iterator it = nodemaps.begin();
|
hegyi@1
|
732 |
it != nodemaps.end(); ++it)
|
hegyi@1
|
733 |
{
|
hegyi@1
|
734 |
if (it->second->save_dest == NESET_SECT)
|
hegyi@1
|
735 |
{
|
hegyi@1
|
736 |
switch (it->second->type())
|
hegyi@1
|
737 |
{
|
hegyi@1
|
738 |
case MapValue::NUMERIC:
|
hegyi@1
|
739 |
gwriter.nodeMap(it->first, getNumericNodeMap(it->first));
|
hegyi@1
|
740 |
break;
|
hegyi@1
|
741 |
case MapValue::STRING:
|
hegyi@1
|
742 |
gwriter.nodeMap(it->first, getStringNodeMap(it->first));
|
hegyi@1
|
743 |
break;
|
hegyi@1
|
744 |
}
|
hegyi@1
|
745 |
}
|
hegyi@1
|
746 |
}
|
hegyi@1
|
747 |
|
hegyi@1
|
748 |
// write arc maps
|
hegyi@1
|
749 |
for (ArcMapStore::const_iterator it = arcmaps.begin();
|
hegyi@1
|
750 |
it != arcmaps.end(); ++it)
|
hegyi@1
|
751 |
{
|
hegyi@1
|
752 |
if (it->second->save_dest == NESET_SECT)
|
hegyi@1
|
753 |
{
|
hegyi@1
|
754 |
switch (it->second->type())
|
hegyi@1
|
755 |
{
|
hegyi@1
|
756 |
case MapValue::NUMERIC:
|
hegyi@1
|
757 |
gwriter.arcMap(it->first, getNumericArcMap(it->first));
|
hegyi@1
|
758 |
break;
|
hegyi@1
|
759 |
case MapValue::STRING:
|
hegyi@1
|
760 |
gwriter.arcMap(it->first, getStringArcMap(it->first));
|
hegyi@1
|
761 |
break;
|
hegyi@1
|
762 |
}
|
hegyi@1
|
763 |
}
|
hegyi@1
|
764 |
}
|
hegyi@1
|
765 |
|
hegyi@1
|
766 |
// write node coordinates
|
hegyi@1
|
767 |
switch (getNodeCoordsSaveDest())
|
hegyi@1
|
768 |
{
|
hegyi@1
|
769 |
case MapStorage::SpecMapSaveOpts::GUI_SECT:
|
hegyi@1
|
770 |
break;
|
hegyi@1
|
771 |
case MapStorage::SpecMapSaveOpts::NESET_SECT:
|
hegyi@1
|
772 |
switch (getNodeCoordsSaveMapNum())
|
hegyi@1
|
773 |
{
|
hegyi@1
|
774 |
case MapStorage::SpecMapSaveOpts::ONE_MAP:
|
hegyi@1
|
775 |
gwriter.nodeMap(node_coords_one_map_name + ":x",
|
hegyi@1
|
776 |
node_coords_x);
|
hegyi@1
|
777 |
gwriter.nodeMap(node_coords_one_map_name + ":y",
|
hegyi@1
|
778 |
node_coords_y);
|
hegyi@1
|
779 |
break;
|
hegyi@1
|
780 |
case MapStorage::SpecMapSaveOpts::TWO_MAPS:
|
hegyi@1
|
781 |
gwriter.nodeMap(node_coords_two_maps_1_name,
|
hegyi@1
|
782 |
node_coords_x);
|
hegyi@1
|
783 |
gwriter.nodeMap(node_coords_two_maps_2_name,
|
hegyi@1
|
784 |
node_coords_y);
|
hegyi@1
|
785 |
break;
|
hegyi@1
|
786 |
}
|
hegyi@1
|
787 |
break;
|
hegyi@1
|
788 |
}
|
hegyi@1
|
789 |
|
hegyi@1
|
790 |
// write arrow coordinates
|
hegyi@1
|
791 |
switch (getArrowCoordsSaveDest())
|
hegyi@1
|
792 |
{
|
hegyi@1
|
793 |
case MapStorage::SpecMapSaveOpts::GUI_SECT:
|
hegyi@1
|
794 |
break;
|
hegyi@1
|
795 |
case MapStorage::SpecMapSaveOpts::NESET_SECT:
|
hegyi@1
|
796 |
switch (getArrowCoordsSaveMapNum())
|
hegyi@1
|
797 |
{
|
hegyi@1
|
798 |
case MapStorage::SpecMapSaveOpts::ONE_MAP:
|
hegyi@1
|
799 |
gwriter.arcMap(arrow_coords_one_map_name + ":x",
|
hegyi@1
|
800 |
arrow_coords_x);
|
hegyi@1
|
801 |
gwriter.arcMap(arrow_coords_one_map_name + ":y",
|
hegyi@1
|
802 |
arrow_coords_y);
|
hegyi@1
|
803 |
break;
|
hegyi@1
|
804 |
case MapStorage::SpecMapSaveOpts::TWO_MAPS:
|
hegyi@1
|
805 |
gwriter.arcMap(arrow_coords_two_maps_1_name,
|
hegyi@1
|
806 |
arrow_coords_x);
|
hegyi@1
|
807 |
gwriter.arcMap(arrow_coords_two_maps_2_name,
|
hegyi@1
|
808 |
arrow_coords_y);
|
hegyi@1
|
809 |
break;
|
hegyi@1
|
810 |
}
|
hegyi@1
|
811 |
break;
|
hegyi@1
|
812 |
}
|
hegyi@1
|
813 |
|
hegyi@1
|
814 |
if (gui_sect_save_dest == LGF_FILE)
|
hegyi@1
|
815 |
{
|
hegyi@1
|
816 |
GuiWriter gui_writer(this);
|
hegyi@1
|
817 |
gui_writer.write(gwriter.ostream());
|
hegyi@1
|
818 |
gwriter.run();
|
hegyi@1
|
819 |
}
|
hegyi@1
|
820 |
else
|
hegyi@1
|
821 |
{
|
hegyi@1
|
822 |
gwriter.run();
|
hegyi@1
|
823 |
}
|
hegyi@1
|
824 |
}
|
hegyi@1
|
825 |
|
hegyi@1
|
826 |
// write .conf file
|
hegyi@1
|
827 |
if (gui_sect_save_dest == CONF_FILE)
|
hegyi@1
|
828 |
{
|
hegyi@1
|
829 |
DigraphWriter<Digraph> lwriter(filename + ".conf", digraph);
|
hegyi@1
|
830 |
GuiWriter gui_writer(this);
|
hegyi@1
|
831 |
gui_writer.write(lwriter.ostream());
|
hegyi@1
|
832 |
lwriter.run();
|
hegyi@1
|
833 |
}
|
hegyi@1
|
834 |
}
|
hegyi@1
|
835 |
|
hegyi@1
|
836 |
void MapStorage::clear()
|
hegyi@1
|
837 |
{
|
hegyi@1
|
838 |
for (NodeMapStore::iterator it = nodemaps.begin(); it != nodemaps.end(); ++it)
|
hegyi@1
|
839 |
{
|
hegyi@1
|
840 |
delete it->second;
|
hegyi@1
|
841 |
nodemaps.erase(it);
|
hegyi@1
|
842 |
}
|
hegyi@1
|
843 |
for (ArcMapStore::iterator it = arcmaps.begin(); it != arcmaps.end(); ++it)
|
hegyi@1
|
844 |
{
|
hegyi@1
|
845 |
delete it->second;
|
hegyi@1
|
846 |
arcmaps.erase(it);
|
hegyi@1
|
847 |
}
|
hegyi@1
|
848 |
digraph.clear();
|
hegyi@1
|
849 |
file_name = "";
|
hegyi@1
|
850 |
modified = false;
|
hegyi@1
|
851 |
max_node_label = 0;
|
hegyi@1
|
852 |
max_arc_label = 0;
|
hegyi@1
|
853 |
background_set = false;
|
hegyi@1
|
854 |
|
hegyi@1
|
855 |
gui_sect_save_dest = LGF_FILE;
|
hegyi@1
|
856 |
node_coords_save_dest = SpecMapSaveOpts::GUI_SECT;
|
hegyi@1
|
857 |
arrow_coords_save_dest = SpecMapSaveOpts::GUI_SECT;
|
hegyi@1
|
858 |
node_coords_one_map_name = "coord";
|
hegyi@1
|
859 |
node_coords_two_maps_1_name = "coord_x";
|
hegyi@1
|
860 |
node_coords_two_maps_2_name = "coord_y";
|
hegyi@1
|
861 |
arrow_coords_one_map_name = "arrow";
|
hegyi@1
|
862 |
arrow_coords_two_maps_1_name = "arrow_x";
|
hegyi@1
|
863 |
arrow_coords_two_maps_2_name = "arrow_y";
|
hegyi@1
|
864 |
|
hegyi@1
|
865 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@1
|
866 |
{
|
hegyi@1
|
867 |
changeActiveMap(false, i, "");
|
hegyi@1
|
868 |
signal_map_win.emit(false, i, "");
|
hegyi@1
|
869 |
}
|
hegyi@1
|
870 |
|
hegyi@1
|
871 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@1
|
872 |
{
|
hegyi@1
|
873 |
changeActiveMap(true, i, "");
|
hegyi@1
|
874 |
signal_map_win.emit(true, i, "");
|
hegyi@1
|
875 |
}
|
hegyi@1
|
876 |
|
hegyi@1
|
877 |
attraction=a_d;
|
hegyi@1
|
878 |
propulsation=p_d;
|
hegyi@1
|
879 |
iterations=i_d;
|
hegyi@1
|
880 |
|
hegyi@1
|
881 |
signal_design_win.emit(attraction, propulsation, iterations);
|
hegyi@1
|
882 |
}
|
hegyi@1
|
883 |
|
hegyi@1
|
884 |
void MapStorage::mapChanged(bool itisarc, std::string mapname)
|
hegyi@1
|
885 |
{
|
hegyi@1
|
886 |
if(itisarc)
|
hegyi@1
|
887 |
{
|
hegyi@1
|
888 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@1
|
889 |
{
|
hegyi@1
|
890 |
if(active_arcmaps[i]==mapname)
|
hegyi@1
|
891 |
{
|
hegyi@1
|
892 |
signal_prop.emit(itisarc, i);
|
hegyi@1
|
893 |
}
|
hegyi@1
|
894 |
}
|
hegyi@1
|
895 |
}
|
hegyi@1
|
896 |
else
|
hegyi@1
|
897 |
{
|
hegyi@1
|
898 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@1
|
899 |
{
|
hegyi@1
|
900 |
if(active_nodemaps[i]==mapname)
|
hegyi@1
|
901 |
{
|
hegyi@1
|
902 |
signal_prop.emit(itisarc, i);
|
hegyi@1
|
903 |
}
|
hegyi@1
|
904 |
}
|
hegyi@1
|
905 |
}
|
hegyi@1
|
906 |
}
|
hegyi@1
|
907 |
|
hegyi@1
|
908 |
void MapStorage::get_design_data(double & attraction_p, double & propulsation_p, int & iterations_p)
|
hegyi@1
|
909 |
{
|
hegyi@1
|
910 |
attraction_p=attraction;
|
hegyi@1
|
911 |
propulsation_p=propulsation;
|
hegyi@1
|
912 |
iterations_p=iterations;
|
hegyi@1
|
913 |
}
|
hegyi@1
|
914 |
|
hegyi@1
|
915 |
void MapStorage::set_attraction(double attraction_p)
|
hegyi@1
|
916 |
{
|
hegyi@1
|
917 |
attraction=attraction_p;
|
hegyi@1
|
918 |
}
|
hegyi@1
|
919 |
|
hegyi@1
|
920 |
void MapStorage::set_propulsation(double propulsation_p)
|
hegyi@1
|
921 |
{
|
hegyi@1
|
922 |
propulsation=propulsation_p;
|
hegyi@1
|
923 |
}
|
hegyi@1
|
924 |
|
hegyi@1
|
925 |
void MapStorage::set_iteration(int iterations_p)
|
hegyi@1
|
926 |
{
|
hegyi@1
|
927 |
iterations=iterations_p;
|
hegyi@1
|
928 |
}
|
hegyi@1
|
929 |
|
hegyi@1
|
930 |
void MapStorage::redesign_data_changed()
|
hegyi@1
|
931 |
{
|
hegyi@1
|
932 |
signal_design_win.emit(attraction, propulsation, iterations);
|
hegyi@1
|
933 |
}
|
hegyi@1
|
934 |
|
hegyi@1
|
935 |
XY MapStorage::getNodeCoords(Node n) const
|
hegyi@1
|
936 |
{
|
hegyi@1
|
937 |
return node_coords[n];
|
hegyi@1
|
938 |
}
|
hegyi@1
|
939 |
|
hegyi@1
|
940 |
void MapStorage::setNodeCoords(Node n, XY c)
|
hegyi@1
|
941 |
{
|
hegyi@1
|
942 |
node_coords.set(n, c);
|
hegyi@1
|
943 |
}
|
hegyi@1
|
944 |
|
hegyi@1
|
945 |
XY MapStorage::getArrowCoords(Arc e) const
|
hegyi@1
|
946 |
{
|
hegyi@1
|
947 |
return arrow_coords[e];
|
hegyi@1
|
948 |
}
|
hegyi@1
|
949 |
|
hegyi@1
|
950 |
void MapStorage::setArrowCoords(Arc e, XY c)
|
hegyi@1
|
951 |
{
|
hegyi@1
|
952 |
arrow_coords.set(e, c);
|
hegyi@1
|
953 |
}
|
hegyi@1
|
954 |
|
hegyi@1
|
955 |
MapValue MapStorage::get(const std::string& name, Node node) const
|
hegyi@1
|
956 |
{
|
hegyi@1
|
957 |
NodeMapData* data = getNodeMapData(name);
|
hegyi@1
|
958 |
return data->get(node);
|
hegyi@1
|
959 |
}
|
hegyi@1
|
960 |
|
hegyi@1
|
961 |
void MapStorage::set(const std::string& name, Node node, MapValue val)
|
hegyi@1
|
962 |
{
|
hegyi@1
|
963 |
NodeMapData* data = getNodeMapData(name);
|
hegyi@1
|
964 |
data->set(node, val);
|
hegyi@1
|
965 |
}
|
hegyi@1
|
966 |
|
hegyi@1
|
967 |
MapValue MapStorage::get(const std::string& name, Arc arc) const
|
hegyi@1
|
968 |
{
|
hegyi@1
|
969 |
ArcMapData* data = getArcMapData(name);
|
hegyi@1
|
970 |
return data->get(arc);
|
hegyi@1
|
971 |
}
|
hegyi@1
|
972 |
|
hegyi@1
|
973 |
void MapStorage::set(const std::string& name, Arc arc, MapValue val)
|
hegyi@1
|
974 |
{
|
hegyi@1
|
975 |
ArcMapData* data = getArcMapData(name);
|
hegyi@1
|
976 |
data->set(arc, val);
|
hegyi@1
|
977 |
}
|
hegyi@1
|
978 |
|
hegyi@1
|
979 |
const std::string& MapStorage::getFileName() const
|
hegyi@1
|
980 |
{
|
hegyi@1
|
981 |
return file_name;
|
hegyi@1
|
982 |
}
|
hegyi@1
|
983 |
|
hegyi@1
|
984 |
void MapStorage::setFileName(const std::string& fn)
|
hegyi@1
|
985 |
{
|
hegyi@1
|
986 |
file_name = fn;
|
hegyi@1
|
987 |
}
|
hegyi@1
|
988 |
|
hegyi@1
|
989 |
bool MapStorage::getModified() const
|
hegyi@1
|
990 |
{
|
hegyi@1
|
991 |
return modified;
|
hegyi@1
|
992 |
}
|
hegyi@1
|
993 |
|
hegyi@1
|
994 |
void MapStorage::setModified(bool m)
|
hegyi@1
|
995 |
{
|
hegyi@1
|
996 |
modified = m;
|
hegyi@1
|
997 |
}
|
hegyi@1
|
998 |
|
hegyi@1
|
999 |
Node MapStorage::addNode(XY coords)
|
hegyi@1
|
1000 |
{
|
hegyi@1
|
1001 |
Node node = digraph.addNode();
|
hegyi@1
|
1002 |
|
hegyi@1
|
1003 |
setNodeCoords(node, coords);
|
hegyi@1
|
1004 |
|
hegyi@1
|
1005 |
max_node_label++;
|
hegyi@1
|
1006 |
|
hegyi@1
|
1007 |
node_label[node] = max_node_label;
|
hegyi@1
|
1008 |
|
hegyi@1
|
1009 |
std::vector<std::string> node_maps = getNodeMapList();
|
hegyi@1
|
1010 |
for (std::vector<std::string>::const_iterator it = node_maps.begin();
|
hegyi@1
|
1011 |
it != node_maps.end(); ++it)
|
hegyi@1
|
1012 |
{
|
hegyi@1
|
1013 |
NodeMapData* data = getNodeMapData(*it);
|
hegyi@1
|
1014 |
set(*it, node, data->default_value);
|
hegyi@1
|
1015 |
}
|
hegyi@1
|
1016 |
|
hegyi@1
|
1017 |
return node;
|
hegyi@1
|
1018 |
}
|
hegyi@1
|
1019 |
|
hegyi@1
|
1020 |
Arc MapStorage::addArc(Node from, Node to)
|
hegyi@1
|
1021 |
{
|
hegyi@1
|
1022 |
Arc arc = digraph.addArc(from, to);
|
hegyi@1
|
1023 |
|
hegyi@1
|
1024 |
if (from == to)
|
hegyi@1
|
1025 |
{
|
hegyi@1
|
1026 |
setArrowCoords(arc, getNodeCoords(from) + XY(0.0, 80.0));
|
hegyi@1
|
1027 |
}
|
hegyi@1
|
1028 |
else
|
hegyi@1
|
1029 |
{
|
hegyi@1
|
1030 |
setArrowCoords(arc, (getNodeCoords(from) + getNodeCoords(to)) / 2.0);
|
hegyi@1
|
1031 |
}
|
hegyi@1
|
1032 |
|
hegyi@1
|
1033 |
max_arc_label++;
|
hegyi@1
|
1034 |
|
hegyi@1
|
1035 |
arc_label[arc] = max_arc_label;
|
hegyi@1
|
1036 |
|
hegyi@1
|
1037 |
std::vector<std::string> arc_maps = getArcMapList();
|
hegyi@1
|
1038 |
for (std::vector<std::string>::const_iterator it = arc_maps.begin();
|
hegyi@1
|
1039 |
it != arc_maps.end(); ++it)
|
hegyi@1
|
1040 |
{
|
hegyi@1
|
1041 |
ArcMapData* data = getArcMapData(*it);
|
hegyi@1
|
1042 |
set(*it, arc, data->default_value);
|
hegyi@1
|
1043 |
}
|
hegyi@1
|
1044 |
return arc;
|
hegyi@1
|
1045 |
}
|
hegyi@1
|
1046 |
|
hegyi@1
|
1047 |
MapStorage::NumericNodeMap& MapStorage::getNumericNodeMap(const std::string& name)
|
hegyi@1
|
1048 |
{
|
hegyi@1
|
1049 |
NodeMapData* data = getNodeMapData(name);
|
hegyi@1
|
1050 |
if (data->type() != MapValue::NUMERIC)
|
hegyi@1
|
1051 |
throw Error("Numeric node map " + name + " does not exists.");
|
hegyi@1
|
1052 |
return static_cast<NumericNodeMapData*>(data)->map;
|
hegyi@1
|
1053 |
}
|
hegyi@1
|
1054 |
|
hegyi@1
|
1055 |
MapStorage::StringNodeMap& MapStorage::getStringNodeMap(const std::string& name)
|
hegyi@1
|
1056 |
{
|
hegyi@1
|
1057 |
NodeMapData* data = getNodeMapData(name);
|
hegyi@1
|
1058 |
if (data->type() != MapValue::STRING)
|
hegyi@1
|
1059 |
throw Error("String node map " + name + " does not exists.");
|
hegyi@1
|
1060 |
return static_cast<StringNodeMapData*>(data)->map;
|
hegyi@1
|
1061 |
}
|
hegyi@1
|
1062 |
|
hegyi@1
|
1063 |
MapStorage::NumericArcMap& MapStorage::getNumericArcMap(const std::string& name)
|
hegyi@1
|
1064 |
{
|
hegyi@1
|
1065 |
ArcMapData* data = getArcMapData(name);
|
hegyi@1
|
1066 |
if (data->type() != MapValue::NUMERIC)
|
hegyi@1
|
1067 |
throw Error("Numeric arc map " + name + " does not exists.");
|
hegyi@1
|
1068 |
return static_cast<NumericArcMapData*>(data)->map;
|
hegyi@1
|
1069 |
}
|
hegyi@1
|
1070 |
|
hegyi@1
|
1071 |
MapStorage::StringArcMap& MapStorage::getStringArcMap(const std::string& name)
|
hegyi@1
|
1072 |
{
|
hegyi@1
|
1073 |
ArcMapData* data = getArcMapData(name);
|
hegyi@1
|
1074 |
if (data->type() != MapValue::STRING)
|
hegyi@1
|
1075 |
throw Error("String arc map " + name + " does not exists.");
|
hegyi@1
|
1076 |
return static_cast<StringArcMapData*>(data)->map;
|
hegyi@1
|
1077 |
}
|
hegyi@1
|
1078 |
|
hegyi@1
|
1079 |
MapValueArcMap MapStorage::getArcMap(const std::string& name)
|
hegyi@1
|
1080 |
{
|
hegyi@1
|
1081 |
return MapValueArcMap(name, this);
|
hegyi@1
|
1082 |
}
|
hegyi@1
|
1083 |
|
hegyi@1
|
1084 |
MapValueNodeMap MapStorage::getNodeMap(const std::string& name)
|
hegyi@1
|
1085 |
{
|
hegyi@1
|
1086 |
return MapValueNodeMap(name, this);
|
hegyi@1
|
1087 |
}
|
hegyi@1
|
1088 |
|
hegyi@1
|
1089 |
int MapStorage::getLabel(Node n) const
|
hegyi@1
|
1090 |
{
|
hegyi@1
|
1091 |
return node_label[n];
|
hegyi@1
|
1092 |
}
|
hegyi@1
|
1093 |
|
hegyi@1
|
1094 |
int MapStorage::getLabel(Arc e) const
|
hegyi@1
|
1095 |
{
|
hegyi@1
|
1096 |
return arc_label[e];
|
hegyi@1
|
1097 |
}
|
hegyi@1
|
1098 |
|
hegyi@1
|
1099 |
MapStorage::GuiSectSaveDest MapStorage::getGUIDataSaveLocation()
|
hegyi@1
|
1100 |
{
|
hegyi@1
|
1101 |
return gui_sect_save_dest;
|
hegyi@1
|
1102 |
}
|
hegyi@1
|
1103 |
|
hegyi@1
|
1104 |
void MapStorage::setGUIDataSaveLocation(MapStorage::GuiSectSaveDest dest)
|
hegyi@1
|
1105 |
{
|
hegyi@1
|
1106 |
gui_sect_save_dest = dest;
|
hegyi@1
|
1107 |
}
|
hegyi@1
|
1108 |
|
hegyi@1
|
1109 |
MapStorage::MapSaveDest MapStorage::getNodeMapSaveDest(std::string name) const
|
hegyi@1
|
1110 |
{
|
hegyi@1
|
1111 |
NodeMapData *data = getNodeMapData(name);
|
hegyi@1
|
1112 |
return data->save_dest;
|
hegyi@1
|
1113 |
}
|
hegyi@1
|
1114 |
|
hegyi@1
|
1115 |
MapStorage::MapSaveDest MapStorage::getArcMapSaveDest(std::string name) const
|
hegyi@1
|
1116 |
{
|
hegyi@1
|
1117 |
ArcMapData *data = getArcMapData(name);
|
hegyi@1
|
1118 |
return data->save_dest;
|
hegyi@1
|
1119 |
}
|
hegyi@1
|
1120 |
|
hegyi@1
|
1121 |
void MapStorage::setNodeMapSaveDest(std::string name, MapStorage::MapSaveDest dest)
|
hegyi@1
|
1122 |
{
|
hegyi@1
|
1123 |
NodeMapData *data = getNodeMapData(name);
|
hegyi@1
|
1124 |
data->save_dest = dest;
|
hegyi@1
|
1125 |
}
|
hegyi@1
|
1126 |
|
hegyi@1
|
1127 |
void MapStorage::setArcMapSaveDest(std::string name, MapStorage::MapSaveDest dest)
|
hegyi@1
|
1128 |
{
|
hegyi@1
|
1129 |
ArcMapData *data = getArcMapData(name);
|
hegyi@1
|
1130 |
data->save_dest = dest;
|
hegyi@1
|
1131 |
}
|
hegyi@1
|
1132 |
|
hegyi@1
|
1133 |
MapStorage::ArcMapData* MapStorage::getArcMapData(std::string name) const
|
hegyi@1
|
1134 |
{
|
hegyi@1
|
1135 |
ArcMapStore::const_iterator it = arcmaps.find(name);
|
hegyi@1
|
1136 |
if (it != arcmaps.end())
|
hegyi@1
|
1137 |
return it->second;
|
hegyi@1
|
1138 |
else
|
hegyi@1
|
1139 |
throw Error("Arc map " + name + " does not exists.");
|
hegyi@1
|
1140 |
}
|
hegyi@1
|
1141 |
|
hegyi@1
|
1142 |
MapStorage::NodeMapData* MapStorage::getNodeMapData(std::string name) const
|
hegyi@1
|
1143 |
{
|
hegyi@1
|
1144 |
NodeMapStore::const_iterator it = nodemaps.find(name);
|
hegyi@1
|
1145 |
if (it != nodemaps.end())
|
hegyi@1
|
1146 |
return it->second;
|
hegyi@1
|
1147 |
else
|
hegyi@1
|
1148 |
throw Error("Node map " + name + " does not exists.");
|
hegyi@1
|
1149 |
}
|
hegyi@1
|
1150 |
|
hegyi@1
|
1151 |
MapValue::Type MapStorage::getNodeMapElementType(std::string name) const
|
hegyi@1
|
1152 |
{
|
hegyi@1
|
1153 |
NodeMapData *data = getNodeMapData(name);
|
hegyi@1
|
1154 |
return data->type();
|
hegyi@1
|
1155 |
}
|
hegyi@1
|
1156 |
|
hegyi@1
|
1157 |
MapValue::Type MapStorage::getArcMapElementType(std::string name) const
|
hegyi@1
|
1158 |
{
|
hegyi@1
|
1159 |
ArcMapData *data = getArcMapData(name);
|
hegyi@1
|
1160 |
return data->type();
|
hegyi@1
|
1161 |
}
|
hegyi@1
|
1162 |
|
hegyi@1
|
1163 |
const MapStorage::NodeLabelMap& MapStorage::getNodeLabelMap()
|
hegyi@1
|
1164 |
{
|
hegyi@1
|
1165 |
return node_label;
|
hegyi@1
|
1166 |
}
|
hegyi@1
|
1167 |
|
hegyi@1
|
1168 |
const MapStorage::ArcLabelMap& MapStorage::getArcLabelMap()
|
hegyi@1
|
1169 |
{
|
hegyi@1
|
1170 |
return arc_label;
|
hegyi@1
|
1171 |
}
|
hegyi@1
|
1172 |
|
hegyi@1
|
1173 |
const Digraph& MapStorage::getDigraph()
|
hegyi@1
|
1174 |
{
|
hegyi@1
|
1175 |
return digraph;
|
hegyi@1
|
1176 |
}
|
hegyi@1
|
1177 |
|
hegyi@1
|
1178 |
bool MapStorage::nodeMapExists(std::string name)
|
hegyi@1
|
1179 |
{
|
hegyi@1
|
1180 |
NodeMapStore::const_iterator it = nodemaps.find(name);
|
hegyi@1
|
1181 |
if (it == nodemaps.end())
|
hegyi@1
|
1182 |
return false;
|
hegyi@1
|
1183 |
else
|
hegyi@1
|
1184 |
return true;
|
hegyi@1
|
1185 |
}
|
hegyi@1
|
1186 |
|
hegyi@1
|
1187 |
bool MapStorage::arcMapExists(std::string name)
|
hegyi@1
|
1188 |
{
|
hegyi@1
|
1189 |
ArcMapStore::const_iterator it = arcmaps.find(name);
|
hegyi@1
|
1190 |
if (it == arcmaps.end())
|
hegyi@1
|
1191 |
return false;
|
hegyi@1
|
1192 |
else
|
hegyi@1
|
1193 |
return true;
|
hegyi@1
|
1194 |
}
|
hegyi@1
|
1195 |
|
hegyi@1
|
1196 |
std::vector<std::string> MapStorage::getArcMaps(MapType type)
|
hegyi@1
|
1197 |
{
|
hegyi@1
|
1198 |
std::vector<std::string> maps;
|
hegyi@1
|
1199 |
for (ArcMapStore::const_iterator it = arcmaps.begin(); it != arcmaps.end(); ++it)
|
hegyi@1
|
1200 |
{
|
hegyi@1
|
1201 |
if (it->second->type() & type)
|
hegyi@1
|
1202 |
{
|
hegyi@1
|
1203 |
maps.push_back(it->first);
|
hegyi@1
|
1204 |
}
|
hegyi@1
|
1205 |
}
|
hegyi@1
|
1206 |
return maps;
|
hegyi@1
|
1207 |
}
|
hegyi@1
|
1208 |
|
hegyi@1
|
1209 |
std::vector<std::string> MapStorage::getNodeMaps(MapType type)
|
hegyi@1
|
1210 |
{
|
hegyi@1
|
1211 |
std::vector<std::string> maps;
|
hegyi@1
|
1212 |
for (NodeMapStore::const_iterator it = nodemaps.begin(); it != nodemaps.end(); ++it)
|
hegyi@1
|
1213 |
{
|
hegyi@1
|
1214 |
if (it->second->type() & type)
|
hegyi@1
|
1215 |
{
|
hegyi@1
|
1216 |
maps.push_back(it->first);
|
hegyi@1
|
1217 |
}
|
hegyi@1
|
1218 |
}
|
hegyi@1
|
1219 |
return maps;
|
hegyi@1
|
1220 |
}
|
hegyi@1
|
1221 |
|
hegyi@1
|
1222 |
MapStorage::NodeCoordMap& MapStorage::getNodeCoordMap()
|
hegyi@1
|
1223 |
{
|
hegyi@1
|
1224 |
return node_coords;
|
hegyi@1
|
1225 |
}
|
hegyi@1
|
1226 |
|
hegyi@1
|
1227 |
MapStorage::ArrowCoordMap& MapStorage::getArrowCoordMap()
|
hegyi@1
|
1228 |
{
|
hegyi@1
|
1229 |
return arrow_coords;
|
hegyi@1
|
1230 |
}
|
hegyi@1
|
1231 |
|
hegyi@1
|
1232 |
MapStorage::SpecMapSaveOpts::Dest MapStorage::getNodeCoordsSaveDest()
|
hegyi@1
|
1233 |
{
|
hegyi@1
|
1234 |
return node_coords_save_dest;
|
hegyi@1
|
1235 |
}
|
hegyi@1
|
1236 |
|
hegyi@1
|
1237 |
MapStorage::SpecMapSaveOpts::Dest MapStorage::getArrowCoordsSaveDest()
|
hegyi@1
|
1238 |
{
|
hegyi@1
|
1239 |
return arrow_coords_save_dest;
|
hegyi@1
|
1240 |
}
|
hegyi@1
|
1241 |
|
hegyi@1
|
1242 |
void MapStorage::setNodeCoordsSaveDest(MapStorage::SpecMapSaveOpts::Dest dest)
|
hegyi@1
|
1243 |
{
|
hegyi@1
|
1244 |
node_coords_save_dest = dest;
|
hegyi@1
|
1245 |
}
|
hegyi@1
|
1246 |
|
hegyi@1
|
1247 |
void MapStorage::setArrowCoordsSaveDest(MapStorage::SpecMapSaveOpts::Dest dest)
|
hegyi@1
|
1248 |
{
|
hegyi@1
|
1249 |
arrow_coords_save_dest = dest;
|
hegyi@1
|
1250 |
}
|
hegyi@1
|
1251 |
|
hegyi@1
|
1252 |
MapStorage::SpecMapSaveOpts::MapNum MapStorage::getNodeCoordsSaveMapNum()
|
hegyi@1
|
1253 |
{
|
hegyi@1
|
1254 |
return node_coords_save_map_num;
|
hegyi@1
|
1255 |
}
|
hegyi@1
|
1256 |
|
hegyi@1
|
1257 |
MapStorage::SpecMapSaveOpts::MapNum MapStorage::getArrowCoordsSaveMapNum()
|
hegyi@1
|
1258 |
{
|
hegyi@1
|
1259 |
return arrow_coords_save_map_num;
|
hegyi@1
|
1260 |
}
|
hegyi@1
|
1261 |
|
hegyi@1
|
1262 |
void MapStorage::setNodeCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::MapNum num)
|
hegyi@1
|
1263 |
{
|
hegyi@1
|
1264 |
node_coords_save_map_num = num;
|
hegyi@1
|
1265 |
}
|
hegyi@1
|
1266 |
|
hegyi@1
|
1267 |
void MapStorage::setArrowCoordsSaveMapNum(MapStorage::SpecMapSaveOpts::MapNum num)
|
hegyi@1
|
1268 |
{
|
hegyi@1
|
1269 |
arrow_coords_save_map_num = num;
|
hegyi@1
|
1270 |
}
|
hegyi@1
|
1271 |
|
hegyi@1
|
1272 |
const std::string& MapStorage::getNodeCoordsOneMapName()
|
hegyi@1
|
1273 |
{
|
hegyi@1
|
1274 |
return node_coords_one_map_name;
|
hegyi@1
|
1275 |
}
|
hegyi@1
|
1276 |
const std::string& MapStorage::getNodeCoordsTwoMaps1Name()
|
hegyi@1
|
1277 |
{
|
hegyi@1
|
1278 |
return node_coords_two_maps_1_name;
|
hegyi@1
|
1279 |
}
|
hegyi@1
|
1280 |
const std::string& MapStorage::getNodeCoordsTwoMaps2Name()
|
hegyi@1
|
1281 |
{
|
hegyi@1
|
1282 |
return node_coords_two_maps_2_name;
|
hegyi@1
|
1283 |
}
|
hegyi@1
|
1284 |
|
hegyi@1
|
1285 |
void MapStorage::setNodeCoordsOneMapName(const std::string& name)
|
hegyi@1
|
1286 |
{
|
hegyi@1
|
1287 |
node_coords_one_map_name = name;
|
hegyi@1
|
1288 |
}
|
hegyi@1
|
1289 |
void MapStorage::setNodeCoordsTwoMaps1Name(const std::string& name)
|
hegyi@1
|
1290 |
{
|
hegyi@1
|
1291 |
node_coords_two_maps_1_name = name;
|
hegyi@1
|
1292 |
}
|
hegyi@1
|
1293 |
void MapStorage::setNodeCoordsTwoMaps2Name(const std::string& name)
|
hegyi@1
|
1294 |
{
|
hegyi@1
|
1295 |
node_coords_two_maps_2_name = name;
|
hegyi@1
|
1296 |
}
|
hegyi@1
|
1297 |
|
hegyi@1
|
1298 |
const std::string& MapStorage::getArrowCoordsOneMapName()
|
hegyi@1
|
1299 |
{
|
hegyi@1
|
1300 |
return arrow_coords_one_map_name;
|
hegyi@1
|
1301 |
}
|
hegyi@1
|
1302 |
const std::string& MapStorage::getArrowCoordsTwoMaps1Name()
|
hegyi@1
|
1303 |
{
|
hegyi@1
|
1304 |
return arrow_coords_two_maps_1_name;
|
hegyi@1
|
1305 |
}
|
hegyi@1
|
1306 |
const std::string& MapStorage::getArrowCoordsTwoMaps2Name()
|
hegyi@1
|
1307 |
{
|
hegyi@1
|
1308 |
return arrow_coords_two_maps_2_name;
|
hegyi@1
|
1309 |
}
|
hegyi@1
|
1310 |
|
hegyi@1
|
1311 |
void MapStorage::setArrowCoordsOneMapName(const std::string& name)
|
hegyi@1
|
1312 |
{
|
hegyi@1
|
1313 |
arrow_coords_one_map_name = name;
|
hegyi@1
|
1314 |
}
|
hegyi@1
|
1315 |
void MapStorage::setArrowCoordsTwoMaps1Name(const std::string& name)
|
hegyi@1
|
1316 |
{
|
hegyi@1
|
1317 |
arrow_coords_two_maps_1_name = name;
|
hegyi@1
|
1318 |
}
|
hegyi@1
|
1319 |
void MapStorage::setArrowCoordsTwoMaps2Name(const std::string& name)
|
hegyi@1
|
1320 |
{
|
hegyi@1
|
1321 |
arrow_coords_two_maps_2_name = name;
|
hegyi@1
|
1322 |
}
|
hegyi@1
|
1323 |
|
hegyi@1
|
1324 |
void MapStorage::readLGF(
|
hegyi@1
|
1325 |
const std::string& filename,
|
hegyi@1
|
1326 |
bool read_arc_label,
|
hegyi@1
|
1327 |
const std::vector<std::string>& node_map_names,
|
hegyi@1
|
1328 |
const std::vector<std::string>& arc_map_names,
|
hegyi@1
|
1329 |
const std::map<std::string, MapValue::Type>& node_map_types,
|
hegyi@1
|
1330 |
const std::map<std::string, MapValue::Type>& arc_map_types,
|
hegyi@1
|
1331 |
const std::string& node_coord_xmap_name,
|
hegyi@1
|
1332 |
const std::string& node_coord_ymap_name,
|
hegyi@1
|
1333 |
const std::string& arrow_coord_xmap_name,
|
hegyi@1
|
1334 |
const std::string& arrow_coord_ymap_name)
|
hegyi@1
|
1335 |
{
|
hegyi@1
|
1336 |
using std::vector;
|
hegyi@1
|
1337 |
using std::map;
|
hegyi@1
|
1338 |
using std::string;
|
hegyi@1
|
1339 |
|
hegyi@1
|
1340 |
DigraphReader<Digraph> greader(filename, digraph);
|
hegyi@1
|
1341 |
|
hegyi@1
|
1342 |
// read the label maps
|
hegyi@1
|
1343 |
greader.nodeMap("label", node_label);
|
hegyi@1
|
1344 |
if (read_arc_label)
|
hegyi@1
|
1345 |
greader.arcMap("label", arc_label);
|
hegyi@1
|
1346 |
|
hegyi@1
|
1347 |
// read the node maps
|
hegyi@1
|
1348 |
for (vector<string>::const_iterator
|
hegyi@1
|
1349 |
it = node_map_names.begin();
|
hegyi@1
|
1350 |
it != node_map_names.end(); ++it)
|
hegyi@1
|
1351 |
{
|
hegyi@1
|
1352 |
switch (node_map_types.find(*it)->second)
|
hegyi@1
|
1353 |
{
|
hegyi@1
|
1354 |
case MapValue::NUMERIC:
|
hegyi@1
|
1355 |
{
|
hegyi@1
|
1356 |
createNodeMap(*it, MapValue::NUMERIC, double());
|
hegyi@1
|
1357 |
greader.nodeMap(*it, getNumericNodeMap(*it));
|
hegyi@1
|
1358 |
break;
|
hegyi@1
|
1359 |
}
|
hegyi@1
|
1360 |
case MapValue::STRING:
|
hegyi@1
|
1361 |
{
|
hegyi@1
|
1362 |
createNodeMap(*it, MapValue::STRING, string());
|
hegyi@1
|
1363 |
greader.nodeMap(*it, getStringNodeMap(*it));
|
hegyi@1
|
1364 |
break;
|
hegyi@1
|
1365 |
}
|
hegyi@1
|
1366 |
}
|
hegyi@1
|
1367 |
getNodeMapData(*it)->save_dest = NESET_SECT;
|
hegyi@1
|
1368 |
}
|
hegyi@1
|
1369 |
|
hegyi@1
|
1370 |
// read the arc maps
|
hegyi@1
|
1371 |
for (vector<string>::const_iterator
|
hegyi@1
|
1372 |
it = arc_map_names.begin();
|
hegyi@1
|
1373 |
it != arc_map_names.end(); ++it)
|
hegyi@1
|
1374 |
{
|
hegyi@1
|
1375 |
switch (arc_map_types.find(*it)->second)
|
hegyi@1
|
1376 |
{
|
hegyi@1
|
1377 |
case MapValue::NUMERIC:
|
hegyi@1
|
1378 |
{
|
hegyi@1
|
1379 |
createArcMap(*it, MapValue::NUMERIC, double());
|
hegyi@1
|
1380 |
greader.arcMap(*it, getNumericArcMap(*it));
|
hegyi@1
|
1381 |
break;
|
hegyi@1
|
1382 |
}
|
hegyi@1
|
1383 |
case MapValue::STRING:
|
hegyi@1
|
1384 |
{
|
hegyi@1
|
1385 |
createArcMap(*it, MapValue::STRING, string());
|
hegyi@1
|
1386 |
greader.arcMap(*it, getStringArcMap(*it));
|
hegyi@1
|
1387 |
break;
|
hegyi@1
|
1388 |
}
|
hegyi@1
|
1389 |
}
|
hegyi@1
|
1390 |
getArcMapData(*it)->save_dest = NESET_SECT;
|
hegyi@1
|
1391 |
}
|
hegyi@1
|
1392 |
|
hegyi@1
|
1393 |
// read the node coordinate maps
|
hegyi@1
|
1394 |
if (node_coord_xmap_name != "")
|
hegyi@1
|
1395 |
greader.nodeMap(node_coord_xmap_name, node_coords_x);
|
hegyi@1
|
1396 |
if (node_coord_ymap_name != "")
|
hegyi@1
|
1397 |
greader.nodeMap(node_coord_ymap_name, node_coords_y);
|
hegyi@1
|
1398 |
|
hegyi@1
|
1399 |
// read the arrow coordinate maps
|
hegyi@1
|
1400 |
if (arrow_coord_xmap_name != "")
|
hegyi@1
|
1401 |
greader.arcMap(arrow_coord_xmap_name, arrow_coords_x);
|
hegyi@1
|
1402 |
if (arrow_coord_ymap_name != "")
|
hegyi@1
|
1403 |
greader.arcMap(arrow_coord_ymap_name, arrow_coords_y);
|
hegyi@1
|
1404 |
|
hegyi@1
|
1405 |
greader.run();
|
hegyi@1
|
1406 |
}
|
hegyi@1
|
1407 |
|
hegyi@1
|
1408 |
void MapStorage::setBackground(const std::string& file_name)
|
hegyi@1
|
1409 |
{
|
hegyi@1
|
1410 |
if (file_name == background_file_name) return;
|
hegyi@1
|
1411 |
if (file_name == "")
|
hegyi@1
|
1412 |
{
|
hegyi@1
|
1413 |
background_file_name = "";
|
hegyi@1
|
1414 |
background_set = false;
|
hegyi@1
|
1415 |
}
|
hegyi@1
|
1416 |
else
|
hegyi@1
|
1417 |
{
|
hegyi@1
|
1418 |
background_file_name = file_name;
|
hegyi@1
|
1419 |
background_set = true;
|
hegyi@1
|
1420 |
}
|
hegyi@1
|
1421 |
signal_background.emit();
|
hegyi@1
|
1422 |
}
|
hegyi@1
|
1423 |
|
hegyi@1
|
1424 |
const std::string& MapStorage::getBackgroundFilename()
|
hegyi@1
|
1425 |
{
|
hegyi@1
|
1426 |
return background_file_name;
|
hegyi@1
|
1427 |
}
|
hegyi@1
|
1428 |
|
hegyi@1
|
1429 |
bool MapStorage::isBackgroundSet()
|
hegyi@1
|
1430 |
{
|
hegyi@1
|
1431 |
return background_set;
|
hegyi@1
|
1432 |
}
|
hegyi@1
|
1433 |
|
hegyi@1
|
1434 |
double MapStorage::getBackgroundScaling()
|
hegyi@1
|
1435 |
{
|
hegyi@1
|
1436 |
return background_scaling;
|
hegyi@1
|
1437 |
}
|
hegyi@1
|
1438 |
|
hegyi@1
|
1439 |
void MapStorage::setBackgroundScaling(double scaling)
|
hegyi@1
|
1440 |
{
|
hegyi@1
|
1441 |
background_scaling = scaling;
|
hegyi@1
|
1442 |
}
|
hegyi@1
|
1443 |
|
hegyi@1
|
1444 |
void MapStorage::exportDigraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
|
hegyi@1
|
1445 |
{
|
hegyi@1
|
1446 |
Digraph::NodeMap<int> _shapes(digraph, 0);
|
hegyi@1
|
1447 |
Digraph::NodeMap<int> _nodeColors(digraph, 0);
|
hegyi@1
|
1448 |
Digraph::ArcMap<int> _arcColors(digraph, 0);
|
hegyi@1
|
1449 |
Digraph::NodeMap<double> _nodeSizes(digraph, 6.0);
|
hegyi@1
|
1450 |
Digraph::ArcMap<double> _arcWidths(digraph, 1.0);
|
hegyi@1
|
1451 |
bool _drawArrows=options[ARROWS];
|
hegyi@1
|
1452 |
bool _enableParallel=options[PAR];
|
hegyi@1
|
1453 |
|
hegyi@1
|
1454 |
std::string emptyString="";
|
hegyi@1
|
1455 |
Digraph::NodeMap<std::string> _nodeTextMap(digraph,emptyString);
|
hegyi@1
|
1456 |
|
hegyi@1
|
1457 |
//_nodeTextMap=(Digraph::NodeMap<void> *)&emptyStringMap;
|
hegyi@1
|
1458 |
|
hegyi@1
|
1459 |
if(options[N_MAPS])
|
hegyi@1
|
1460 |
{
|
hegyi@1
|
1461 |
if(active_nodemaps[N_RADIUS]!="")
|
hegyi@1
|
1462 |
{
|
hegyi@1
|
1463 |
_nodeSizes=getNumericNodeMap(active_nodemaps[N_RADIUS]);
|
hegyi@1
|
1464 |
}
|
hegyi@1
|
1465 |
if(active_nodemaps[N_COLOR]!="")
|
hegyi@1
|
1466 |
{
|
hegyi@1
|
1467 |
for(NodeIt ni(digraph);ni!=INVALID;++ni)
|
hegyi@1
|
1468 |
{
|
hegyi@1
|
1469 |
_nodeColors[ni]=(int)get(active_nodemaps[N_COLOR], ni);
|
hegyi@1
|
1470 |
}
|
hegyi@1
|
1471 |
}
|
hegyi@1
|
1472 |
if(active_nodemaps[N_TEXT]!="")
|
hegyi@1
|
1473 |
{
|
hegyi@1
|
1474 |
for(NodeIt ni(digraph);ni!=INVALID;++ni)
|
hegyi@1
|
1475 |
{
|
hegyi@1
|
1476 |
std::ostringstream o;
|
hegyi@1
|
1477 |
o << get(active_nodemaps[N_TEXT], ni);
|
hegyi@1
|
1478 |
_nodeTextMap[ni]=o.str();
|
hegyi@1
|
1479 |
}
|
hegyi@1
|
1480 |
}
|
hegyi@1
|
1481 |
}
|
hegyi@1
|
1482 |
if(options[E_MAPS])
|
hegyi@1
|
1483 |
{
|
hegyi@1
|
1484 |
if(active_arcmaps[E_WIDTH]!="")
|
hegyi@1
|
1485 |
{
|
hegyi@1
|
1486 |
_arcWidths=getNumericArcMap(active_arcmaps[E_WIDTH]);
|
hegyi@1
|
1487 |
}
|
hegyi@1
|
1488 |
if(active_arcmaps[E_COLOR]!="")
|
hegyi@1
|
1489 |
{
|
hegyi@1
|
1490 |
for(ArcIt ei(digraph);ei!=INVALID;++ei)
|
hegyi@1
|
1491 |
{
|
hegyi@1
|
1492 |
_arcColors[ei]=(int)get(active_arcmaps[E_COLOR], ei);
|
hegyi@1
|
1493 |
}
|
hegyi@1
|
1494 |
}
|
hegyi@1
|
1495 |
}
|
hegyi@1
|
1496 |
if(shapemap!="Default values")
|
hegyi@1
|
1497 |
{
|
hegyi@1
|
1498 |
double min = std::numeric_limits<double>::max();
|
hegyi@1
|
1499 |
double max = std::numeric_limits<double>::min();
|
hegyi@1
|
1500 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
1501 |
{
|
hegyi@1
|
1502 |
double v = static_cast<double>(get(shapemap, n));
|
hegyi@1
|
1503 |
if (v < min) min = v;
|
hegyi@1
|
1504 |
if (v > max) max = v;
|
hegyi@1
|
1505 |
}
|
hegyi@1
|
1506 |
if((min>=0)&&(max<=4))
|
hegyi@1
|
1507 |
{
|
hegyi@1
|
1508 |
NumericNodeMap& map = static_cast<NumericNodeMapData*>(getNodeMapData(shapemap))->map;
|
hegyi@1
|
1509 |
for (NodeIt n(digraph); n != INVALID; ++n)
|
hegyi@1
|
1510 |
{
|
hegyi@1
|
1511 |
_shapes[n] = static_cast<int>(map[n]);
|
hegyi@1
|
1512 |
}
|
hegyi@1
|
1513 |
}
|
hegyi@1
|
1514 |
}
|
hegyi@1
|
1515 |
|
hegyi@1
|
1516 |
Palette palette;
|
hegyi@1
|
1517 |
Palette paletteW(true);
|
hegyi@1
|
1518 |
|
hegyi@1
|
1519 |
graphToEps(digraph,filename).
|
hegyi@1
|
1520 |
title("Sample .eps figure (fits to A4)").
|
hegyi@1
|
1521 |
copyright("(C) 2006 LEMON Project").
|
hegyi@1
|
1522 |
absoluteNodeSizes().absoluteArcWidths().
|
hegyi@1
|
1523 |
nodeScale(2).nodeSizes(_nodeSizes).
|
hegyi@1
|
1524 |
coords(node_coords).
|
hegyi@1
|
1525 |
nodeShapes(_shapes).
|
hegyi@1
|
1526 |
nodeColors(composeMap(paletteW,_nodeColors)).
|
hegyi@1
|
1527 |
arcColors(composeMap(palette,_arcColors)).
|
hegyi@1
|
1528 |
arcWidthScale(0.3).arcWidths(_arcWidths).
|
hegyi@1
|
1529 |
nodeTexts(_nodeTextMap).nodeTextSize(7).
|
hegyi@1
|
1530 |
enableParallel(_enableParallel).parArcDist(5).
|
hegyi@1
|
1531 |
drawArrows(_drawArrows).arrowWidth(7).arrowLength(7).
|
hegyi@1
|
1532 |
run();
|
hegyi@1
|
1533 |
|
hegyi@1
|
1534 |
}
|