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 copies. 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 |
#ifndef MAPSTORAGE_H
|
hegyi@1
|
20 |
#define MAPSTORAGE_H
|
hegyi@1
|
21 |
|
hegyi@1
|
22 |
class Mapstorage;
|
hegyi@1
|
23 |
|
hegyi@1
|
24 |
#include <vector>
|
hegyi@1
|
25 |
#include <map>
|
hegyi@1
|
26 |
#include <string>
|
hegyi@1
|
27 |
#include "all_include.h"
|
hegyi@1
|
28 |
#include "xymap.h"
|
hegyi@1
|
29 |
#include <libgnomecanvasmm.h>
|
hegyi@1
|
30 |
#include "map_value.h"
|
hegyi@1
|
31 |
#include "map_value_map.h"
|
hegyi@1
|
32 |
|
hegyi@1
|
33 |
///class MapStorage handles NodeMaps and ArcMaps.
|
hegyi@1
|
34 |
|
hegyi@1
|
35 |
///Class MapStorage is responsible for storing
|
hegyi@1
|
36 |
///NodeMaps and ArcMaps that can be shown later
|
hegyi@1
|
37 |
///on GUI. Therefore maps can be added to it,
|
hegyi@1
|
38 |
///and datas over the added maps can be queried.
|
hegyi@1
|
39 |
///The maps will be stored in an std::map,
|
hegyi@1
|
40 |
///referenced with their names. Unfortunately at
|
hegyi@1
|
41 |
///the moment it works only with double type maps
|
hegyi@1
|
42 |
///
|
hegyi@1
|
43 |
///\todo too many things are public!!
|
hegyi@1
|
44 |
class MapStorage
|
hegyi@1
|
45 |
{
|
hegyi@1
|
46 |
private:
|
hegyi@1
|
47 |
std::string background_file_name;
|
hegyi@1
|
48 |
bool background_set;
|
hegyi@1
|
49 |
double background_scaling;
|
hegyi@1
|
50 |
public:
|
hegyi@1
|
51 |
class Error : public std::exception
|
hegyi@1
|
52 |
{
|
hegyi@1
|
53 |
private:
|
hegyi@1
|
54 |
std::string message;
|
hegyi@1
|
55 |
public:
|
hegyi@1
|
56 |
Error(const std::string& msg) : message(msg) {}
|
hegyi@1
|
57 |
virtual const char* what() const throw()
|
hegyi@1
|
58 |
{
|
hegyi@1
|
59 |
return message.c_str();
|
hegyi@1
|
60 |
}
|
hegyi@1
|
61 |
~Error() throw() {}
|
hegyi@1
|
62 |
};
|
hegyi@1
|
63 |
|
hegyi@1
|
64 |
void setBackground(const std::string& file_name);
|
hegyi@1
|
65 |
const std::string& getBackgroundFilename();
|
hegyi@1
|
66 |
bool isBackgroundSet();
|
hegyi@1
|
67 |
double getBackgroundScaling();
|
hegyi@1
|
68 |
void setBackgroundScaling(double scaling);
|
hegyi@1
|
69 |
|
hegyi@1
|
70 |
enum MapSaveDest { GUI_SECT, NESET_SECT, DONT_SAVE };
|
hegyi@1
|
71 |
enum GuiSectSaveDest { LGF_FILE, CONF_FILE };
|
hegyi@1
|
72 |
struct SpecMapSaveOpts
|
hegyi@1
|
73 |
{
|
hegyi@1
|
74 |
enum Dest { GUI_SECT, NESET_SECT };
|
hegyi@1
|
75 |
enum MapNum { ONE_MAP, TWO_MAPS };
|
hegyi@1
|
76 |
};
|
hegyi@1
|
77 |
|
hegyi@1
|
78 |
typedef Digraph::NodeMap<double> NumericNodeMap;
|
hegyi@1
|
79 |
typedef Digraph::NodeMap<std::string> StringNodeMap;
|
hegyi@1
|
80 |
typedef Digraph::ArcMap<double> NumericArcMap;
|
hegyi@1
|
81 |
typedef Digraph::ArcMap<std::string> StringArcMap;
|
hegyi@1
|
82 |
typedef Digraph::NodeMap<int> NodeLabelMap;
|
hegyi@1
|
83 |
typedef Digraph::ArcMap<int> ArcLabelMap;
|
hegyi@1
|
84 |
typedef XYMap<Digraph::NodeMap<double> > NodeCoordMap;
|
hegyi@1
|
85 |
typedef XYMap<Digraph::ArcMap<double> > ArrowCoordMap;
|
hegyi@1
|
86 |
|
hegyi@1
|
87 |
struct ArcMapData
|
hegyi@1
|
88 |
{
|
hegyi@1
|
89 |
/// where to save the map
|
hegyi@1
|
90 |
MapSaveDest save_dest;
|
hegyi@1
|
91 |
/// read-only or read-write
|
hegyi@1
|
92 |
bool writeable;
|
hegyi@1
|
93 |
/// default value
|
hegyi@1
|
94 |
MapValue default_value;
|
hegyi@1
|
95 |
virtual MapValue::Type type() = 0;
|
hegyi@1
|
96 |
virtual MapValue get(Arc e) = 0;
|
hegyi@1
|
97 |
virtual void set(Arc e, MapValue v) = 0;
|
hegyi@1
|
98 |
ArcMapData(MapValue def_val) :
|
hegyi@1
|
99 |
save_dest(GUI_SECT),
|
hegyi@1
|
100 |
writeable(true),
|
hegyi@1
|
101 |
default_value(def_val)
|
hegyi@1
|
102 |
{}
|
hegyi@1
|
103 |
};
|
hegyi@1
|
104 |
|
hegyi@1
|
105 |
struct NumericArcMapData : public ArcMapData
|
hegyi@1
|
106 |
{
|
hegyi@1
|
107 |
NumericArcMap map;
|
hegyi@1
|
108 |
MapValue::Type type() { return MapValue::NUMERIC; }
|
hegyi@1
|
109 |
MapValue get(Arc e) { return MapValue(map[e]); }
|
hegyi@1
|
110 |
void set(Arc e, MapValue v) { map.set(e, static_cast<double>(v)); }
|
hegyi@1
|
111 |
NumericArcMapData(Digraph& g, double def_val) :
|
hegyi@1
|
112 |
ArcMapData(MapValue(def_val)),
|
hegyi@1
|
113 |
map(g, def_val)
|
hegyi@1
|
114 |
{}
|
hegyi@1
|
115 |
};
|
hegyi@1
|
116 |
|
hegyi@1
|
117 |
struct StringArcMapData : public ArcMapData
|
hegyi@1
|
118 |
{
|
hegyi@1
|
119 |
StringArcMap map;
|
hegyi@1
|
120 |
MapValue::Type type() { return MapValue::STRING; }
|
hegyi@1
|
121 |
MapValue get(Arc e) { return MapValue(map[e]); }
|
hegyi@1
|
122 |
void set(Arc e, MapValue v) { map.set(e, static_cast<std::string>(v)); }
|
hegyi@1
|
123 |
StringArcMapData(Digraph& g, std::string def_val) :
|
hegyi@1
|
124 |
ArcMapData(MapValue(def_val)),
|
hegyi@1
|
125 |
map(g, def_val)
|
hegyi@1
|
126 |
{}
|
hegyi@1
|
127 |
};
|
hegyi@1
|
128 |
|
hegyi@1
|
129 |
struct NodeMapData
|
hegyi@1
|
130 |
{
|
hegyi@1
|
131 |
/// where to save the map
|
hegyi@1
|
132 |
MapSaveDest save_dest;
|
hegyi@1
|
133 |
/// read-only or read-write
|
hegyi@1
|
134 |
bool writeable;
|
hegyi@1
|
135 |
/// default value
|
hegyi@1
|
136 |
MapValue default_value;
|
hegyi@1
|
137 |
virtual MapValue::Type type() = 0;
|
hegyi@1
|
138 |
virtual MapValue get(Node e) = 0;
|
hegyi@1
|
139 |
virtual void set(Node e, MapValue v) = 0;
|
hegyi@1
|
140 |
NodeMapData(MapValue def_val) :
|
hegyi@1
|
141 |
save_dest(GUI_SECT),
|
hegyi@1
|
142 |
writeable(true),
|
hegyi@1
|
143 |
default_value(def_val)
|
hegyi@1
|
144 |
{}
|
hegyi@1
|
145 |
};
|
hegyi@1
|
146 |
|
hegyi@1
|
147 |
struct NumericNodeMapData : public NodeMapData
|
hegyi@1
|
148 |
{
|
hegyi@1
|
149 |
NumericNodeMap map;
|
hegyi@1
|
150 |
MapValue::Type type() { return MapValue::NUMERIC; }
|
hegyi@1
|
151 |
MapValue get(Node e) { return MapValue(map[e]); }
|
hegyi@1
|
152 |
void set(Node e, MapValue v) { map.set(e, static_cast<double>(v)); }
|
hegyi@1
|
153 |
NumericNodeMapData(Digraph& g, double def_val) :
|
hegyi@1
|
154 |
NodeMapData(MapValue(def_val)),
|
hegyi@1
|
155 |
map(g, def_val)
|
hegyi@1
|
156 |
{}
|
hegyi@1
|
157 |
};
|
hegyi@1
|
158 |
|
hegyi@1
|
159 |
struct StringNodeMapData : public NodeMapData
|
hegyi@1
|
160 |
{
|
hegyi@1
|
161 |
StringNodeMap map;
|
hegyi@1
|
162 |
MapValue::Type type() { return MapValue::STRING; }
|
hegyi@1
|
163 |
MapValue get(Node e) { return MapValue(map[e]); }
|
hegyi@1
|
164 |
void set(Node e, MapValue v) { map.set(e, static_cast<std::string>(v)); }
|
hegyi@1
|
165 |
StringNodeMapData(Digraph& g, std::string def_val) :
|
hegyi@1
|
166 |
NodeMapData(MapValue(def_val)),
|
hegyi@1
|
167 |
map(g, def_val)
|
hegyi@1
|
168 |
{}
|
hegyi@1
|
169 |
};
|
hegyi@1
|
170 |
|
hegyi@1
|
171 |
typedef std::map<std::string, NodeMapData*> NodeMapStore;
|
hegyi@1
|
172 |
typedef std::map<std::string, ArcMapData*> ArcMapStore;
|
hegyi@1
|
173 |
|
hegyi@1
|
174 |
struct GUISectData
|
hegyi@1
|
175 |
{
|
hegyi@1
|
176 |
std::vector<std::string> main_node_map_names;
|
hegyi@1
|
177 |
std::vector<std::string> main_arc_map_names;
|
hegyi@1
|
178 |
|
hegyi@1
|
179 |
std::vector<std::string> gui_node_map_names;
|
hegyi@1
|
180 |
std::vector<std::string> gui_arc_map_names;
|
hegyi@1
|
181 |
|
hegyi@1
|
182 |
std::map<std::string, MapValue::Type> node_map_types;
|
hegyi@1
|
183 |
std::map<std::string, MapValue::Type> arc_map_types;
|
hegyi@1
|
184 |
|
hegyi@1
|
185 |
std::map<std::string, std::map<int, double>* > numeric_node_maps;
|
hegyi@1
|
186 |
std::map<std::string, std::map<int, std::string>* > string_node_maps;
|
hegyi@1
|
187 |
|
hegyi@1
|
188 |
std::map<std::string, std::map<int, double>* > numeric_arc_maps;
|
hegyi@1
|
189 |
std::map<std::string, std::map<int, std::string>* > string_arc_maps;
|
hegyi@1
|
190 |
|
hegyi@1
|
191 |
std::map<int, XY> node_coord_map;
|
hegyi@1
|
192 |
std::map<int, XY> arrow_coord_map;
|
hegyi@1
|
193 |
|
hegyi@1
|
194 |
SpecMapSaveOpts::Dest node_coords_save_dest;
|
hegyi@1
|
195 |
SpecMapSaveOpts::MapNum node_coords_save_map_num;
|
hegyi@1
|
196 |
std::string node_coords_one_map_name;
|
hegyi@1
|
197 |
std::string node_coords_two_maps_1_name;
|
hegyi@1
|
198 |
std::string node_coords_two_maps_2_name;
|
hegyi@1
|
199 |
|
hegyi@1
|
200 |
SpecMapSaveOpts::Dest arrow_coords_save_dest;
|
hegyi@1
|
201 |
SpecMapSaveOpts::MapNum arrow_coords_save_map_num;
|
hegyi@1
|
202 |
std::string arrow_coords_one_map_name;
|
hegyi@1
|
203 |
std::string arrow_coords_two_maps_1_name;
|
hegyi@1
|
204 |
std::string arrow_coords_two_maps_2_name;
|
hegyi@1
|
205 |
|
hegyi@1
|
206 |
~GUISectData()
|
hegyi@1
|
207 |
{
|
hegyi@1
|
208 |
using std::map;
|
hegyi@1
|
209 |
using std::vector;
|
hegyi@1
|
210 |
using std::pair;
|
hegyi@1
|
211 |
using std::string;
|
hegyi@1
|
212 |
|
hegyi@1
|
213 |
for (map<string, map<int, double>* >::iterator it =
|
hegyi@1
|
214 |
numeric_node_maps.begin(); it != numeric_node_maps.end(); ++it)
|
hegyi@1
|
215 |
{
|
hegyi@1
|
216 |
delete it->second;
|
hegyi@1
|
217 |
}
|
hegyi@1
|
218 |
for (map<string, map<int, string>* >::iterator it =
|
hegyi@1
|
219 |
string_node_maps.begin(); it != string_node_maps.end(); ++it)
|
hegyi@1
|
220 |
{
|
hegyi@1
|
221 |
delete it->second;
|
hegyi@1
|
222 |
}
|
hegyi@1
|
223 |
for (map<string, map<int, double>* >::iterator it =
|
hegyi@1
|
224 |
numeric_arc_maps.begin(); it != numeric_arc_maps.end(); ++it)
|
hegyi@1
|
225 |
{
|
hegyi@1
|
226 |
delete it->second;
|
hegyi@1
|
227 |
}
|
hegyi@1
|
228 |
for (map<string, map<int, string>* >::iterator it =
|
hegyi@1
|
229 |
string_arc_maps.begin(); it != string_arc_maps.end(); ++it)
|
hegyi@1
|
230 |
{
|
hegyi@1
|
231 |
delete it->second;
|
hegyi@1
|
232 |
}
|
hegyi@1
|
233 |
}
|
hegyi@1
|
234 |
};
|
hegyi@1
|
235 |
public:
|
hegyi@1
|
236 |
///The digraph for which the datas are stored.
|
hegyi@1
|
237 |
Digraph digraph;
|
hegyi@1
|
238 |
const Digraph& getDigraph();
|
hegyi@1
|
239 |
|
hegyi@1
|
240 |
private:
|
hegyi@1
|
241 |
GuiSectSaveDest gui_sect_save_dest;
|
hegyi@1
|
242 |
|
hegyi@1
|
243 |
SpecMapSaveOpts::Dest node_coords_save_dest;
|
hegyi@1
|
244 |
SpecMapSaveOpts::MapNum node_coords_save_map_num;
|
hegyi@1
|
245 |
SpecMapSaveOpts::Dest arrow_coords_save_dest;
|
hegyi@1
|
246 |
SpecMapSaveOpts::MapNum arrow_coords_save_map_num;
|
hegyi@1
|
247 |
|
hegyi@1
|
248 |
NodeMapStore nodemaps;
|
hegyi@1
|
249 |
ArcMapStore arcmaps;
|
hegyi@1
|
250 |
|
hegyi@1
|
251 |
NodeLabelMap node_label;
|
hegyi@1
|
252 |
ArcLabelMap arc_label;
|
hegyi@1
|
253 |
|
hegyi@1
|
254 |
/// the coordinates of the nodes
|
hegyi@1
|
255 |
NodeCoordMap node_coords;
|
hegyi@1
|
256 |
Digraph::NodeMap<double> node_coords_x;
|
hegyi@1
|
257 |
Digraph::NodeMap<double> node_coords_y;
|
hegyi@1
|
258 |
|
hegyi@1
|
259 |
/// the coordinates of the arrows on the arcs
|
hegyi@1
|
260 |
ArrowCoordMap arrow_coords;
|
hegyi@1
|
261 |
Digraph::ArcMap<double> arrow_coords_x;
|
hegyi@1
|
262 |
Digraph::ArcMap<double> arrow_coords_y;
|
hegyi@1
|
263 |
|
hegyi@1
|
264 |
///The content of the object has changed, update is needed.
|
hegyi@1
|
265 |
bool modified;
|
hegyi@1
|
266 |
|
hegyi@1
|
267 |
///Name of file loaded in object.
|
hegyi@1
|
268 |
std::string file_name;
|
hegyi@1
|
269 |
|
hegyi@1
|
270 |
// the largest node label
|
hegyi@1
|
271 |
int max_node_label;
|
hegyi@1
|
272 |
|
hegyi@1
|
273 |
// the largest arc label
|
hegyi@1
|
274 |
int max_arc_label;
|
hegyi@1
|
275 |
|
hegyi@1
|
276 |
std::string node_coords_one_map_name;
|
hegyi@1
|
277 |
std::string node_coords_two_maps_1_name;
|
hegyi@1
|
278 |
std::string node_coords_two_maps_2_name;
|
hegyi@1
|
279 |
|
hegyi@1
|
280 |
std::string arrow_coords_one_map_name;
|
hegyi@1
|
281 |
std::string arrow_coords_two_maps_1_name;
|
hegyi@1
|
282 |
std::string arrow_coords_two_maps_2_name;
|
hegyi@1
|
283 |
|
hegyi@1
|
284 |
public:
|
hegyi@1
|
285 |
///Stores the default values for the different visualization node attributes
|
hegyi@1
|
286 |
std::vector<Digraph::NodeMap<double> > default_nodemaps;
|
hegyi@1
|
287 |
|
hegyi@1
|
288 |
///Stores the default values for the different visualization arc attributes
|
hegyi@1
|
289 |
std::vector<Digraph::ArcMap<double> > default_arcmaps;
|
hegyi@1
|
290 |
|
hegyi@1
|
291 |
///Stores the active maps for the different visualization node attributes
|
hegyi@1
|
292 |
std::vector< std::string > active_nodemaps;
|
hegyi@1
|
293 |
|
hegyi@1
|
294 |
/// Stores the active maps for the different visualization arc attributes
|
hegyi@1
|
295 |
std::vector< std::string > active_arcmaps;
|
hegyi@1
|
296 |
|
hegyi@1
|
297 |
protected:
|
hegyi@1
|
298 |
|
hegyi@1
|
299 |
/// Signal emitted on any change made on map values
|
hegyi@1
|
300 |
|
hegyi@1
|
301 |
/// Signal emitted if the visualization of the maps might have to be updated.
|
hegyi@1
|
302 |
/// bool shows us whether the changed map is arc or nodemap.
|
hegyi@1
|
303 |
/// int tells us the refreshed property
|
hegyi@1
|
304 |
sigc::signal<void, bool, int> signal_prop;
|
hegyi@1
|
305 |
|
hegyi@1
|
306 |
/// Signal emitted in the case of nodemap addition
|
hegyi@1
|
307 |
|
hegyi@1
|
308 |
/// std::string is the
|
hegyi@1
|
309 |
///name of the new map
|
hegyi@1
|
310 |
sigc::signal<void, std::string, MapValue::Type> signal_node_map;
|
hegyi@1
|
311 |
|
hegyi@1
|
312 |
/// Signal emitted in the case of arcmap addition
|
hegyi@1
|
313 |
|
hegyi@1
|
314 |
/// std::string is the
|
hegyi@1
|
315 |
///name of the new map
|
hegyi@1
|
316 |
sigc::signal<void, std::string, MapValue::Type> signal_arc_map;
|
hegyi@1
|
317 |
|
hegyi@1
|
318 |
/// Signal emitted, when entry in \ref MapWin should be changed.
|
hegyi@1
|
319 |
sigc::signal<void, bool, int, std::string> signal_map_win;
|
hegyi@1
|
320 |
|
hegyi@1
|
321 |
/// Signal emitted, when entry in \ref DesignWin should be changed.
|
hegyi@1
|
322 |
sigc::signal<void, double, double, int> signal_design_win;
|
hegyi@1
|
323 |
|
hegyi@1
|
324 |
///Signal emitted when background should be set by \ref NoteBookTab
|
hegyi@1
|
325 |
sigc::signal<void> signal_background;
|
hegyi@1
|
326 |
|
hegyi@1
|
327 |
///Iteration number during digraph design
|
hegyi@1
|
328 |
int iterations;
|
hegyi@1
|
329 |
|
hegyi@1
|
330 |
///Attraction factor during digraph design
|
hegyi@1
|
331 |
double attraction;
|
hegyi@1
|
332 |
|
hegyi@1
|
333 |
///Propulsation factor during digraph design
|
hegyi@1
|
334 |
double propulsation;
|
hegyi@1
|
335 |
|
hegyi@1
|
336 |
public:
|
hegyi@1
|
337 |
///Constructor of MapStorage.
|
hegyi@1
|
338 |
|
hegyi@1
|
339 |
///Its all activity is initializing default values
|
hegyi@1
|
340 |
///for different visualization attributes.
|
hegyi@1
|
341 |
MapStorage();
|
hegyi@1
|
342 |
|
hegyi@1
|
343 |
///Destructor of MapStorage
|
hegyi@1
|
344 |
|
hegyi@1
|
345 |
///Maps stored here are created with new. Destructor
|
hegyi@1
|
346 |
///deletes them to free up the reserved memory.
|
hegyi@1
|
347 |
~MapStorage();
|
hegyi@1
|
348 |
|
hegyi@1
|
349 |
/// Registrates if the shown map by any attribute has changed to another.
|
hegyi@1
|
350 |
|
hegyi@1
|
351 |
///It handles the \ref active_arcmaps and
|
hegyi@1
|
352 |
///\ref active_nodemaps vectors. It also emits \ref signal_prop signal to let
|
hegyi@1
|
353 |
///know the interested objects that the visible map of a certain
|
hegyi@1
|
354 |
///attribute has changed.
|
hegyi@1
|
355 |
///\param itisarc arcmap or nodemap has changed
|
hegyi@1
|
356 |
///\param prop the property of which the map is changed
|
hegyi@1
|
357 |
///\param mapname the visible map
|
hegyi@1
|
358 |
void changeActiveMap(bool itisarc , int prop , std::string mapname);
|
hegyi@1
|
359 |
|
hegyi@1
|
360 |
///Emits signals that let change the active maps in \ref MapWin.
|
hegyi@1
|
361 |
void broadcastActiveMaps();
|
hegyi@1
|
362 |
|
hegyi@1
|
363 |
/// Returns the active arcmap shown by a visualization property.
|
hegyi@1
|
364 |
|
hegyi@1
|
365 |
/// \param prop is the property
|
hegyi@1
|
366 |
///that shows the requested map.
|
hegyi@1
|
367 |
std::string getActiveArcMap(int prop);
|
hegyi@1
|
368 |
|
hegyi@1
|
369 |
/// Returns the active nodemap shown by a visualization property.
|
hegyi@1
|
370 |
|
hegyi@1
|
371 |
/// \param prop is the property
|
hegyi@1
|
372 |
///that shows the requested map.
|
hegyi@1
|
373 |
std::string getActiveNodeMap(int prop);
|
hegyi@1
|
374 |
|
hegyi@1
|
375 |
/// Returns the names of the arcmaps stored here.
|
hegyi@1
|
376 |
std::vector<std::string> getArcMapList(MapType type = ALL);
|
hegyi@1
|
377 |
|
hegyi@1
|
378 |
/// Returns the names of the nodemaps stored here.
|
hegyi@1
|
379 |
std::vector<std::string> getNodeMapList(MapType type = ALL);
|
hegyi@1
|
380 |
|
hegyi@1
|
381 |
///returns \ref signal_prop to be able to connect functions to it
|
hegyi@1
|
382 |
sigc::signal<void, bool, int> signal_prop_ch();
|
hegyi@1
|
383 |
|
hegyi@1
|
384 |
///returns \ref signal_node_map to be able to connect functions to it
|
hegyi@1
|
385 |
sigc::signal<void, std::string, MapValue::Type> signal_node_map_ch(){return signal_node_map;};
|
hegyi@1
|
386 |
|
hegyi@1
|
387 |
///returns \ref signal_arc_map to be able to connect functions to it
|
hegyi@1
|
388 |
sigc::signal<void, std::string, MapValue::Type> signal_arc_map_ch(){return signal_arc_map;};
|
hegyi@1
|
389 |
|
hegyi@1
|
390 |
///returns \ref signal_map_win to be able to connect functions to it
|
hegyi@1
|
391 |
sigc::signal<void, bool, int, std::string> signal_map_win_ch(){return signal_map_win;};
|
hegyi@1
|
392 |
|
hegyi@1
|
393 |
///returns \ref signal_design_win to be able to connect functions to it
|
hegyi@1
|
394 |
sigc::signal<void, double, double, int> signal_design_win_ch(){return signal_design_win;};
|
hegyi@1
|
395 |
|
hegyi@1
|
396 |
void createNodeMap(const std::string& name, MapValue::Type type,
|
hegyi@1
|
397 |
MapValue def_val);
|
hegyi@1
|
398 |
void createArcMap(const std::string& name, MapValue::Type type,
|
hegyi@1
|
399 |
MapValue def_val);
|
hegyi@1
|
400 |
|
hegyi@1
|
401 |
///returns \ref signal_background to be able to connect functions to it
|
hegyi@1
|
402 |
sigc::signal<void> signal_background_ch(){return signal_background;};
|
hegyi@1
|
403 |
|
hegyi@1
|
404 |
|
hegyi@1
|
405 |
///Adds given map to storage.
|
hegyi@1
|
406 |
|
hegyi@1
|
407 |
///Emits \ref signal_prop if mapvalues have changed, and MapStorage gets to know it.
|
hegyi@1
|
408 |
|
hegyi@1
|
409 |
///If values in a map have changed, this function checks, whether it is displayed.
|
hegyi@1
|
410 |
///This check means searching the given mapname between active maps
|
hegyi@1
|
411 |
///(\ref active_nodemaps, \ref active_arcmaps). If it is there at a certain property,
|
hegyi@1
|
412 |
///it emits a signal with the property, where the gotten mapname was found. One signal
|
hegyi@1
|
413 |
///is emitted for each property displaying the given map.
|
hegyi@1
|
414 |
///\param itisarc whether the map an arcmap or nodemap
|
hegyi@1
|
415 |
///\param mapname name of map to visualize
|
hegyi@1
|
416 |
void mapChanged(bool itisarc, std::string mapname);
|
hegyi@1
|
417 |
|
hegyi@1
|
418 |
///Read datas from the given filename.
|
hegyi@1
|
419 |
int readFromFile(const std::string &);
|
hegyi@1
|
420 |
|
hegyi@1
|
421 |
///Save datas to the given filename.
|
hegyi@1
|
422 |
void writeToFile(const std::string &);
|
hegyi@1
|
423 |
|
hegyi@1
|
424 |
///Deletes all datastructures stored here.
|
hegyi@1
|
425 |
void clear();
|
hegyi@1
|
426 |
|
hegyi@1
|
427 |
void get_design_data(double &, double &, int &);
|
hegyi@1
|
428 |
void set_attraction(double);
|
hegyi@1
|
429 |
void set_propulsation(double);
|
hegyi@1
|
430 |
void set_iteration(int);
|
hegyi@1
|
431 |
|
hegyi@1
|
432 |
void redesign_data_changed();
|
hegyi@1
|
433 |
|
hegyi@1
|
434 |
XY getNodeCoords(Node n) const;
|
hegyi@1
|
435 |
void setNodeCoords(Node n, XY c);
|
hegyi@1
|
436 |
XY getArrowCoords(Arc e) const;
|
hegyi@1
|
437 |
void setArrowCoords(Arc e, XY c);
|
hegyi@1
|
438 |
|
hegyi@1
|
439 |
MapValue get(const std::string& name, Node node) const;
|
hegyi@1
|
440 |
void set(const std::string& name, Node node, MapValue val);
|
hegyi@1
|
441 |
MapValue get(const std::string& name, Arc arc) const;
|
hegyi@1
|
442 |
void set(const std::string& name, Arc arc, MapValue val);
|
hegyi@1
|
443 |
|
hegyi@1
|
444 |
const std::string& getFileName() const;
|
hegyi@1
|
445 |
void setFileName(const std::string& fn);
|
hegyi@1
|
446 |
|
hegyi@1
|
447 |
bool getModified() const;
|
hegyi@1
|
448 |
void setModified(bool m = true);
|
hegyi@1
|
449 |
|
hegyi@1
|
450 |
Node addNode(XY);
|
hegyi@1
|
451 |
Arc addArc(Node, Node);
|
hegyi@1
|
452 |
|
hegyi@1
|
453 |
NumericNodeMap& getNumericNodeMap(const std::string& name);
|
hegyi@1
|
454 |
StringNodeMap& getStringNodeMap(const std::string& name);
|
hegyi@1
|
455 |
NumericArcMap& getNumericArcMap(const std::string& name);
|
hegyi@1
|
456 |
StringArcMap& getStringArcMap(const std::string& name);
|
hegyi@1
|
457 |
|
hegyi@1
|
458 |
MapValueArcMap getArcMap(const std::string& name);
|
hegyi@1
|
459 |
MapValueNodeMap getNodeMap(const std::string& name);
|
hegyi@1
|
460 |
|
hegyi@1
|
461 |
int getLabel(Node) const;
|
hegyi@1
|
462 |
int getLabel(Arc) const;
|
hegyi@1
|
463 |
|
hegyi@1
|
464 |
GuiSectSaveDest getGUIDataSaveLocation();
|
hegyi@1
|
465 |
void setGUIDataSaveLocation(GuiSectSaveDest dest);
|
hegyi@1
|
466 |
|
hegyi@1
|
467 |
MapSaveDest getNodeMapSaveDest(std::string name) const;
|
hegyi@1
|
468 |
MapSaveDest getArcMapSaveDest(std::string name) const;
|
hegyi@1
|
469 |
void setNodeMapSaveDest(std::string name, MapSaveDest dest);
|
hegyi@1
|
470 |
void setArcMapSaveDest(std::string name, MapSaveDest dest);
|
hegyi@1
|
471 |
|
hegyi@1
|
472 |
SpecMapSaveOpts::Dest getNodeCoordsSaveDest();
|
hegyi@1
|
473 |
SpecMapSaveOpts::Dest getArrowCoordsSaveDest();
|
hegyi@1
|
474 |
void setNodeCoordsSaveDest(SpecMapSaveOpts::Dest dest);
|
hegyi@1
|
475 |
void setArrowCoordsSaveDest(SpecMapSaveOpts::Dest dest);
|
hegyi@1
|
476 |
|
hegyi@1
|
477 |
SpecMapSaveOpts::MapNum getNodeCoordsSaveMapNum();
|
hegyi@1
|
478 |
SpecMapSaveOpts::MapNum getArrowCoordsSaveMapNum();
|
hegyi@1
|
479 |
void setNodeCoordsSaveMapNum(SpecMapSaveOpts::MapNum num);
|
hegyi@1
|
480 |
void setArrowCoordsSaveMapNum(SpecMapSaveOpts::MapNum num);
|
hegyi@1
|
481 |
|
hegyi@1
|
482 |
MapValue::Type getNodeMapElementType(std::string name) const;
|
hegyi@1
|
483 |
MapValue::Type getArcMapElementType(std::string name) const;
|
hegyi@1
|
484 |
|
hegyi@1
|
485 |
const NodeLabelMap& getNodeLabelMap();
|
hegyi@1
|
486 |
const ArcLabelMap& getArcLabelMap();
|
hegyi@1
|
487 |
|
hegyi@1
|
488 |
bool nodeMapExists(std::string name);
|
hegyi@1
|
489 |
bool arcMapExists(std::string name);
|
hegyi@1
|
490 |
|
hegyi@1
|
491 |
std::vector<std::string> getArcMaps(MapType type = ALL);
|
hegyi@1
|
492 |
std::vector<std::string> getNodeMaps(MapType type = ALL);
|
hegyi@1
|
493 |
|
hegyi@1
|
494 |
NodeCoordMap& getNodeCoordMap();
|
hegyi@1
|
495 |
ArrowCoordMap& getArrowCoordMap();
|
hegyi@1
|
496 |
|
hegyi@1
|
497 |
const std::string& getNodeCoordsOneMapName();
|
hegyi@1
|
498 |
const std::string& getNodeCoordsTwoMaps1Name();
|
hegyi@1
|
499 |
const std::string& getNodeCoordsTwoMaps2Name();
|
hegyi@1
|
500 |
void setNodeCoordsOneMapName(const std::string& name);
|
hegyi@1
|
501 |
void setNodeCoordsTwoMaps1Name(const std::string& name);
|
hegyi@1
|
502 |
void setNodeCoordsTwoMaps2Name(const std::string& name);
|
hegyi@1
|
503 |
|
hegyi@1
|
504 |
const std::string& getArrowCoordsOneMapName();
|
hegyi@1
|
505 |
const std::string& getArrowCoordsTwoMaps1Name();
|
hegyi@1
|
506 |
const std::string& getArrowCoordsTwoMaps2Name();
|
hegyi@1
|
507 |
void setArrowCoordsOneMapName(const std::string& name);
|
hegyi@1
|
508 |
void setArrowCoordsTwoMaps1Name(const std::string& name);
|
hegyi@1
|
509 |
void setArrowCoordsTwoMaps2Name(const std::string& name);
|
hegyi@1
|
510 |
|
hegyi@1
|
511 |
private:
|
hegyi@1
|
512 |
ArcMapData* getArcMapData(std::string name) const;
|
hegyi@1
|
513 |
NodeMapData* getNodeMapData(std::string name) const;
|
hegyi@1
|
514 |
void readLGF(
|
hegyi@1
|
515 |
const std::string& filename,
|
hegyi@1
|
516 |
bool read_arc_label,
|
hegyi@1
|
517 |
const std::vector<std::string>& node_map_names,
|
hegyi@1
|
518 |
const std::vector<std::string>& arc_map_names,
|
hegyi@1
|
519 |
const std::map<std::string, MapValue::Type>& node_map_types,
|
hegyi@1
|
520 |
const std::map<std::string, MapValue::Type>& arc_map_types,
|
hegyi@1
|
521 |
const std::string& node_coord_xmap_name,
|
hegyi@1
|
522 |
const std::string& node_coord_ymap_name,
|
hegyi@1
|
523 |
const std::string& arrow_coord_xmap_name,
|
hegyi@1
|
524 |
const std::string& arrow_coord_ymap_name);
|
hegyi@1
|
525 |
|
hegyi@1
|
526 |
public:
|
hegyi@1
|
527 |
void exportDigraphToEPS(std::vector<bool>, std::string, std::string);
|
hegyi@1
|
528 |
};
|
hegyi@1
|
529 |
|
hegyi@1
|
530 |
#endif //MAPSTORAGE_H
|