hegyi@1
|
1 |
#include "file_import_dialog.h"
|
hegyi@1
|
2 |
#include <gtkmm/dialog.h>
|
hegyi@1
|
3 |
#include <gtkmm/stock.h>
|
hegyi@1
|
4 |
#include <gtkmm/notebook.h>
|
hegyi@1
|
5 |
#include <gtkmm/messagedialog.h>
|
hegyi@1
|
6 |
#include <gtkmm/frame.h>
|
hegyi@1
|
7 |
#include <iostream>
|
hegyi@1
|
8 |
|
hegyi@1
|
9 |
FileImportDialog::FileImportDialog(ImportData* d) :
|
hegyi@1
|
10 |
p_data(d)
|
hegyi@1
|
11 |
{
|
hegyi@1
|
12 |
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
hegyi@1
|
13 |
add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
hegyi@1
|
14 |
|
hegyi@1
|
15 |
Gtk::VBox* pVBox = get_vbox();
|
hegyi@1
|
16 |
|
hegyi@1
|
17 |
Gtk::Notebook* nb = Gtk::manage(new Gtk::Notebook);
|
hegyi@1
|
18 |
pVBox->pack_start(*nb, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
19 |
|
hegyi@1
|
20 |
Gtk::VBox* vblueMaps = Gtk::manage(new Gtk::VBox(false, 18));
|
hegyi@1
|
21 |
vblueMaps->set_border_width(12);
|
hegyi@1
|
22 |
|
hegyi@1
|
23 |
Gtk::VBox* vbArcMaps = Gtk::manage(new Gtk::VBox(false, 18));
|
hegyi@1
|
24 |
vbArcMaps->set_border_width(12);
|
hegyi@1
|
25 |
|
hegyi@1
|
26 |
Gtk::VBox* vbSpecMaps = Gtk::manage(new Gtk::VBox(false, 18));
|
hegyi@1
|
27 |
vbSpecMaps->set_border_width(12);
|
hegyi@1
|
28 |
|
hegyi@1
|
29 |
nb->append_page(*vbSpecMaps, "Special Maps");
|
hegyi@1
|
30 |
nb->append_page(*vblueMaps, "Node Maps");
|
hegyi@1
|
31 |
nb->append_page(*vbArcMaps, "Arc Maps");
|
hegyi@1
|
32 |
|
hegyi@1
|
33 |
// child widgets of vbSpecMaps
|
hegyi@1
|
34 |
{
|
hegyi@1
|
35 |
Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
|
hegyi@1
|
36 |
vbSpecMaps->pack_start(*box1, Gtk::PACK_SHRINK);
|
hegyi@1
|
37 |
|
hegyi@1
|
38 |
{
|
hegyi@1
|
39 |
Gtk::Label* label1 =
|
hegyi@1
|
40 |
Gtk::manage(new Gtk::Label("<b>Node Coordinates</b>"));
|
hegyi@1
|
41 |
label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
|
hegyi@1
|
42 |
label1->set_use_markup();
|
hegyi@1
|
43 |
box1->pack_start(*label1);
|
hegyi@1
|
44 |
|
hegyi@1
|
45 |
Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
46 |
box1->pack_start(*box2);
|
hegyi@1
|
47 |
|
hegyi@1
|
48 |
Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
49 |
box2->pack_start(*fill1, Gtk::PACK_SHRINK);
|
hegyi@1
|
50 |
|
hegyi@1
|
51 |
Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
52 |
box2->pack_start(*box3);
|
hegyi@1
|
53 |
|
hegyi@1
|
54 |
Gtk::VBox* box13 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
55 |
box3->pack_start(*box13);
|
hegyi@1
|
56 |
|
hegyi@1
|
57 |
rblueCoordNone.set_label("None");
|
hegyi@1
|
58 |
Gtk::RadioButtonGroup group = rblueCoordNone.get_group();
|
hegyi@1
|
59 |
box13->pack_start(rblueCoordNone);
|
hegyi@1
|
60 |
|
hegyi@1
|
61 |
Gtk::VBox* box4 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
62 |
box3->pack_start(*box4);
|
hegyi@1
|
63 |
|
hegyi@1
|
64 |
rblueCoordOneMap.set_label("One Map");
|
hegyi@1
|
65 |
rblueCoordOneMap.set_group(group);
|
hegyi@1
|
66 |
box4->pack_start(rblueCoordOneMap);
|
hegyi@1
|
67 |
|
hegyi@1
|
68 |
Gtk::HBox* box5 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
69 |
box4->pack_start(*box5);
|
hegyi@1
|
70 |
|
hegyi@1
|
71 |
Gtk::Label* fill2 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
72 |
box5->pack_start(*fill2, Gtk::PACK_SHRINK);
|
hegyi@1
|
73 |
|
hegyi@1
|
74 |
Gtk::VBox* box6 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
75 |
box5->pack_start(*box6);
|
hegyi@1
|
76 |
|
hegyi@1
|
77 |
Gtk::HBox* box7 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
78 |
box6->pack_start(*box7);
|
hegyi@1
|
79 |
|
hegyi@1
|
80 |
Gtk::Label* label2 = Gtk::manage(new Gtk::Label("(X, Y)"));
|
hegyi@1
|
81 |
box7->pack_start(*label2, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
82 |
|
hegyi@1
|
83 |
box7->pack_start(cblueCoordOneMap, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
84 |
|
hegyi@1
|
85 |
|
hegyi@1
|
86 |
Gtk::VBox* box8 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
87 |
box3->pack_start(*box8);
|
hegyi@1
|
88 |
|
hegyi@1
|
89 |
rblueCoordTwoMaps.set_label("Two Maps");
|
hegyi@1
|
90 |
rblueCoordTwoMaps.set_group(group);
|
hegyi@1
|
91 |
box8->pack_start(rblueCoordTwoMaps);
|
hegyi@1
|
92 |
|
hegyi@1
|
93 |
Gtk::HBox* box9 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
94 |
box8->pack_start(*box9);
|
hegyi@1
|
95 |
|
hegyi@1
|
96 |
Gtk::Label* fill3 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
97 |
box9->pack_start(*fill3, Gtk::PACK_SHRINK);
|
hegyi@1
|
98 |
|
hegyi@1
|
99 |
Gtk::VBox* box10 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
100 |
box9->pack_start(*box10);
|
hegyi@1
|
101 |
|
hegyi@1
|
102 |
Gtk::HBox* box11 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
103 |
box10->pack_start(*box11);
|
hegyi@1
|
104 |
|
hegyi@1
|
105 |
Gtk::Label* label3 = Gtk::manage(new Gtk::Label("X"));
|
hegyi@1
|
106 |
box11->pack_start(*label3, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
107 |
|
hegyi@1
|
108 |
box11->pack_start(cblueCoordTwoMaps1, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
109 |
|
hegyi@1
|
110 |
Gtk::HBox* box12 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
111 |
box10->pack_start(*box12);
|
hegyi@1
|
112 |
|
hegyi@1
|
113 |
Gtk::Label* label4 = Gtk::manage(new Gtk::Label("Y"));
|
hegyi@1
|
114 |
box12->pack_start(*label4, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
115 |
|
hegyi@1
|
116 |
box12->pack_start(cblueCoordTwoMaps2, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
117 |
|
hegyi@1
|
118 |
cblueCoordOneMap.signal_changed().connect(
|
hegyi@1
|
119 |
sigc::mem_fun(*this, &FileImportDialog::onNodeCoordOneMapChanged));
|
hegyi@1
|
120 |
cblueCoordTwoMaps1.signal_changed().connect(
|
hegyi@1
|
121 |
sigc::mem_fun(*this, &FileImportDialog::onNodeCoordTwoMaps1Changed));
|
hegyi@1
|
122 |
cblueCoordTwoMaps2.signal_changed().connect(
|
hegyi@1
|
123 |
sigc::mem_fun(*this, &FileImportDialog::onNodeCoordTwoMaps2Changed));
|
hegyi@1
|
124 |
}
|
hegyi@1
|
125 |
|
hegyi@1
|
126 |
{
|
hegyi@1
|
127 |
Gtk::Label* label1 =
|
hegyi@1
|
128 |
Gtk::manage(new Gtk::Label("<b>Arrow Coordinates</b>"));
|
hegyi@1
|
129 |
label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
|
hegyi@1
|
130 |
label1->set_use_markup();
|
hegyi@1
|
131 |
box1->pack_start(*label1);
|
hegyi@1
|
132 |
|
hegyi@1
|
133 |
Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
134 |
box1->pack_start(*box2);
|
hegyi@1
|
135 |
|
hegyi@1
|
136 |
Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
137 |
box2->pack_start(*fill1, Gtk::PACK_SHRINK);
|
hegyi@1
|
138 |
|
hegyi@1
|
139 |
Gtk::VBox* box3 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
140 |
box2->pack_start(*box3);
|
hegyi@1
|
141 |
|
hegyi@1
|
142 |
Gtk::VBox* box13 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
143 |
box3->pack_start(*box13);
|
hegyi@1
|
144 |
|
hegyi@1
|
145 |
rbArrowCoordNone.set_label("None");
|
hegyi@1
|
146 |
Gtk::RadioButtonGroup group = rbArrowCoordNone.get_group();
|
hegyi@1
|
147 |
box13->pack_start(rbArrowCoordNone);
|
hegyi@1
|
148 |
|
hegyi@1
|
149 |
Gtk::VBox* box4 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
150 |
box3->pack_start(*box4);
|
hegyi@1
|
151 |
|
hegyi@1
|
152 |
rbArrowCoordOneMap.set_label("One Map");
|
hegyi@1
|
153 |
rbArrowCoordOneMap.set_group(group);
|
hegyi@1
|
154 |
box4->pack_start(rbArrowCoordOneMap);
|
hegyi@1
|
155 |
|
hegyi@1
|
156 |
Gtk::HBox* box5 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
157 |
box4->pack_start(*box5);
|
hegyi@1
|
158 |
|
hegyi@1
|
159 |
Gtk::Label* fill2 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
160 |
box5->pack_start(*fill2, Gtk::PACK_SHRINK);
|
hegyi@1
|
161 |
|
hegyi@1
|
162 |
Gtk::VBox* box6 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
163 |
box5->pack_start(*box6);
|
hegyi@1
|
164 |
|
hegyi@1
|
165 |
Gtk::HBox* box7 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
166 |
box6->pack_start(*box7);
|
hegyi@1
|
167 |
|
hegyi@1
|
168 |
Gtk::Label* label2 = Gtk::manage(new Gtk::Label("(X, Y)"));
|
hegyi@1
|
169 |
box7->pack_start(*label2, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
170 |
|
hegyi@1
|
171 |
box7->pack_start(cbArrowCoordOneMap, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
172 |
|
hegyi@1
|
173 |
|
hegyi@1
|
174 |
Gtk::VBox* box8 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
175 |
box3->pack_start(*box8);
|
hegyi@1
|
176 |
|
hegyi@1
|
177 |
rbArrowCoordTwoMaps.set_label("Two Maps");
|
hegyi@1
|
178 |
rbArrowCoordTwoMaps.set_group(group);
|
hegyi@1
|
179 |
box8->pack_start(rbArrowCoordTwoMaps);
|
hegyi@1
|
180 |
|
hegyi@1
|
181 |
Gtk::HBox* box9 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
182 |
box8->pack_start(*box9);
|
hegyi@1
|
183 |
|
hegyi@1
|
184 |
Gtk::Label* fill3 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
185 |
box9->pack_start(*fill3, Gtk::PACK_SHRINK);
|
hegyi@1
|
186 |
|
hegyi@1
|
187 |
Gtk::VBox* box10 = Gtk::manage(new Gtk::VBox);
|
hegyi@1
|
188 |
box9->pack_start(*box10);
|
hegyi@1
|
189 |
|
hegyi@1
|
190 |
Gtk::HBox* box11 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
191 |
box10->pack_start(*box11);
|
hegyi@1
|
192 |
|
hegyi@1
|
193 |
Gtk::Label* label3 = Gtk::manage(new Gtk::Label("X"));
|
hegyi@1
|
194 |
box11->pack_start(*label3, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
195 |
|
hegyi@1
|
196 |
box11->pack_start(cbArrowCoordTwoMaps1, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
197 |
|
hegyi@1
|
198 |
Gtk::HBox* box12 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
199 |
box10->pack_start(*box12);
|
hegyi@1
|
200 |
|
hegyi@1
|
201 |
Gtk::Label* label4 = Gtk::manage(new Gtk::Label("Y"));
|
hegyi@1
|
202 |
box12->pack_start(*label4, Gtk::PACK_SHRINK, 4);
|
hegyi@1
|
203 |
|
hegyi@1
|
204 |
box12->pack_start(cbArrowCoordTwoMaps2, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
205 |
|
hegyi@1
|
206 |
cbArrowCoordOneMap.signal_changed().connect(
|
hegyi@1
|
207 |
sigc::mem_fun(*this, &FileImportDialog::onArrowCoordOneMapChanged));
|
hegyi@1
|
208 |
cbArrowCoordTwoMaps1.signal_changed().connect(
|
hegyi@1
|
209 |
sigc::mem_fun(*this, &FileImportDialog::onArrowCoordTwoMaps1Changed));
|
hegyi@1
|
210 |
cbArrowCoordTwoMaps2.signal_changed().connect(
|
hegyi@1
|
211 |
sigc::mem_fun(*this, &FileImportDialog::onArrowCoordTwoMaps2Changed));
|
hegyi@1
|
212 |
}
|
hegyi@1
|
213 |
}
|
hegyi@1
|
214 |
|
hegyi@1
|
215 |
// child widgets of vblueMaps
|
hegyi@1
|
216 |
{
|
hegyi@1
|
217 |
Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
|
hegyi@1
|
218 |
vblueMaps->pack_start(*box1, Gtk::PACK_SHRINK);
|
hegyi@1
|
219 |
|
hegyi@1
|
220 |
Gtk::Label* label1 =
|
hegyi@1
|
221 |
Gtk::manage(new Gtk::Label("<b>Element type</b>"));
|
hegyi@1
|
222 |
label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
|
hegyi@1
|
223 |
label1->set_use_markup();
|
hegyi@1
|
224 |
box1->pack_start(*label1, Gtk::PACK_SHRINK);
|
hegyi@1
|
225 |
|
hegyi@1
|
226 |
Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
227 |
box1->pack_start(*box2, Gtk::PACK_SHRINK);
|
hegyi@1
|
228 |
|
hegyi@1
|
229 |
Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
230 |
box2->pack_start(*fill1, Gtk::PACK_SHRINK);
|
hegyi@1
|
231 |
|
hegyi@1
|
232 |
Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);
|
hegyi@1
|
233 |
box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
234 |
|
hegyi@1
|
235 |
Gtk::ScrolledWindow* swNodeMaps = Gtk::manage(new Gtk::ScrolledWindow);
|
hegyi@1
|
236 |
frame->add(*swNodeMaps);
|
hegyi@1
|
237 |
|
hegyi@1
|
238 |
swNodeMaps->add(twNodeMaps);
|
hegyi@1
|
239 |
|
hegyi@1
|
240 |
refNodeMapStore = Gtk::ListStore::create(NodeMapColumns);
|
hegyi@1
|
241 |
|
hegyi@1
|
242 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
243 |
p_data->node_map_names.begin(); it != p_data->node_map_names.end();
|
hegyi@1
|
244 |
++it)
|
hegyi@1
|
245 |
{
|
hegyi@1
|
246 |
node_tree_view_records.push_back(
|
hegyi@1
|
247 |
tree_view_record(*it, false, false, true));
|
hegyi@1
|
248 |
}
|
hegyi@1
|
249 |
|
hegyi@1
|
250 |
twNodeMaps.set_model(refNodeMapStore);
|
hegyi@1
|
251 |
twNodeMaps.append_column("Name", NodeMapColumns.colName);
|
hegyi@1
|
252 |
{
|
hegyi@1
|
253 |
int col = twNodeMaps.append_column_editable("Numeric",
|
hegyi@1
|
254 |
NodeMapColumns.colReadAsNumeric);
|
hegyi@1
|
255 |
Gtk::CellRendererToggle* pRenderer =
|
hegyi@1
|
256 |
static_cast<Gtk::CellRendererToggle*>(
|
hegyi@1
|
257 |
twNodeMaps.get_column_cell_renderer(col-1));
|
hegyi@1
|
258 |
pRenderer->signal_toggled().connect(
|
hegyi@1
|
259 |
sigc::mem_fun(*this, &FileImportDialog::onNodeMapNumericToggled));
|
hegyi@1
|
260 |
}
|
hegyi@1
|
261 |
{
|
hegyi@1
|
262 |
int col = twNodeMaps.append_column_editable("String",
|
hegyi@1
|
263 |
NodeMapColumns.colReadAsString);
|
hegyi@1
|
264 |
Gtk::CellRendererToggle* pRenderer =
|
hegyi@1
|
265 |
static_cast<Gtk::CellRendererToggle*>(
|
hegyi@1
|
266 |
twNodeMaps.get_column_cell_renderer(col-1));
|
hegyi@1
|
267 |
pRenderer->signal_toggled().connect(
|
hegyi@1
|
268 |
sigc::mem_fun(*this, &FileImportDialog::onNodeMapStringToggled));
|
hegyi@1
|
269 |
}
|
hegyi@1
|
270 |
|
hegyi@1
|
271 |
swNodeMaps->set_size_request(-1, 200);
|
hegyi@1
|
272 |
swNodeMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
hegyi@1
|
273 |
}
|
hegyi@1
|
274 |
|
hegyi@1
|
275 |
// child widgets of vbArcMaps
|
hegyi@1
|
276 |
{
|
hegyi@1
|
277 |
Gtk::VBox* box1 = Gtk::manage(new Gtk::VBox(false, 6));
|
hegyi@1
|
278 |
vbArcMaps->pack_start(*box1, Gtk::PACK_SHRINK);
|
hegyi@1
|
279 |
|
hegyi@1
|
280 |
Gtk::Label* label1 =
|
hegyi@1
|
281 |
Gtk::manage(new Gtk::Label("<b>Element type</b>"));
|
hegyi@1
|
282 |
label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
|
hegyi@1
|
283 |
label1->set_use_markup();
|
hegyi@1
|
284 |
box1->pack_start(*label1, Gtk::PACK_SHRINK);
|
hegyi@1
|
285 |
|
hegyi@1
|
286 |
Gtk::HBox* box2 = Gtk::manage(new Gtk::HBox);
|
hegyi@1
|
287 |
box1->pack_start(*box2, Gtk::PACK_SHRINK);
|
hegyi@1
|
288 |
|
hegyi@1
|
289 |
Gtk::Label* fill1 = Gtk::manage(new Gtk::Label(" "));
|
hegyi@1
|
290 |
box2->pack_start(*fill1, Gtk::PACK_SHRINK);
|
hegyi@1
|
291 |
|
hegyi@1
|
292 |
Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);
|
hegyi@1
|
293 |
box2->pack_start(*frame, Gtk::PACK_EXPAND_WIDGET);
|
hegyi@1
|
294 |
|
hegyi@1
|
295 |
Gtk::ScrolledWindow* swArcMaps = Gtk::manage(new Gtk::ScrolledWindow);
|
hegyi@1
|
296 |
frame->add(*swArcMaps);
|
hegyi@1
|
297 |
|
hegyi@1
|
298 |
swArcMaps->add(twArcMaps);
|
hegyi@1
|
299 |
|
hegyi@1
|
300 |
refArcMapStore = Gtk::ListStore::create(ArcMapColumns);
|
hegyi@1
|
301 |
|
hegyi@1
|
302 |
for (std::vector<std::string>::const_iterator it =
|
hegyi@1
|
303 |
p_data->arc_map_names.begin(); it != p_data->arc_map_names.end();
|
hegyi@1
|
304 |
++it)
|
hegyi@1
|
305 |
{
|
hegyi@1
|
306 |
arc_tree_view_records.push_back(
|
hegyi@1
|
307 |
tree_view_record(*it, false, false, true));
|
hegyi@1
|
308 |
}
|
hegyi@1
|
309 |
|
hegyi@1
|
310 |
twArcMaps.set_model(refArcMapStore);
|
hegyi@1
|
311 |
twArcMaps.append_column("Name", ArcMapColumns.colName);
|
hegyi@1
|
312 |
{
|
hegyi@1
|
313 |
int col = twArcMaps.append_column_editable("Numeric",
|
hegyi@1
|
314 |
ArcMapColumns.colReadAsNumeric);
|
hegyi@1
|
315 |
Gtk::CellRendererToggle* pRenderer =
|
hegyi@1
|
316 |
static_cast<Gtk::CellRendererToggle*>(
|
hegyi@1
|
317 |
twArcMaps.get_column_cell_renderer(col-1));
|
hegyi@1
|
318 |
pRenderer->signal_toggled().connect(
|
hegyi@1
|
319 |
sigc::mem_fun(*this, &FileImportDialog::onArcMapNumericToggled));
|
hegyi@1
|
320 |
}
|
hegyi@1
|
321 |
{
|
hegyi@1
|
322 |
int col = twArcMaps.append_column_editable("String",
|
hegyi@1
|
323 |
ArcMapColumns.colReadAsString);
|
hegyi@1
|
324 |
Gtk::CellRendererToggle* pRenderer =
|
hegyi@1
|
325 |
static_cast<Gtk::CellRendererToggle*>(
|
hegyi@1
|
326 |
twArcMaps.get_column_cell_renderer(col-1));
|
hegyi@1
|
327 |
pRenderer->signal_toggled().connect(
|
hegyi@1
|
328 |
sigc::mem_fun(*this, &FileImportDialog::onArcMapStringToggled));
|
hegyi@1
|
329 |
}
|
hegyi@1
|
330 |
|
hegyi@1
|
331 |
swArcMaps->set_size_request(-1, 200);
|
hegyi@1
|
332 |
swArcMaps->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
hegyi@1
|
333 |
}
|
hegyi@1
|
334 |
|
hegyi@1
|
335 |
// fill in the ComboBoxes
|
hegyi@1
|
336 |
typedef std::vector<std::string> StrVec;
|
hegyi@1
|
337 |
for (StrVec::const_iterator it = p_data->node_map_names.begin();
|
hegyi@1
|
338 |
it != p_data->node_map_names.end(); ++it)
|
hegyi@1
|
339 |
{
|
hegyi@1
|
340 |
cblueCoordTwoMaps1.append_text(*it);
|
hegyi@1
|
341 |
cblueCoordTwoMaps2.append_text(*it);
|
hegyi@1
|
342 |
}
|
hegyi@1
|
343 |
for (StrVec::const_iterator it = p_data->arc_map_names.begin();
|
hegyi@1
|
344 |
it != p_data->arc_map_names.end(); ++it)
|
hegyi@1
|
345 |
{
|
hegyi@1
|
346 |
cbArrowCoordTwoMaps1.append_text(*it);
|
hegyi@1
|
347 |
cbArrowCoordTwoMaps2.append_text(*it);
|
hegyi@1
|
348 |
}
|
hegyi@1
|
349 |
for (StrVec::const_iterator it = p_data->xy_node_map_names.begin();
|
hegyi@1
|
350 |
it != p_data->xy_node_map_names.end(); ++it)
|
hegyi@1
|
351 |
{
|
hegyi@1
|
352 |
cblueCoordOneMap.append_text(*it);
|
hegyi@1
|
353 |
}
|
hegyi@1
|
354 |
for (StrVec::const_iterator it = p_data->xy_arc_map_names.begin();
|
hegyi@1
|
355 |
it != p_data->xy_arc_map_names.end(); ++it)
|
hegyi@1
|
356 |
{
|
hegyi@1
|
357 |
cbArrowCoordOneMap.append_text(*it);
|
hegyi@1
|
358 |
}
|
hegyi@1
|
359 |
|
hegyi@1
|
360 |
if (p_data->isXYNodeMap("coord"))
|
hegyi@1
|
361 |
{
|
hegyi@1
|
362 |
cblueCoordOneMap.set_active_text("coord");
|
hegyi@1
|
363 |
}
|
hegyi@1
|
364 |
else if (p_data->isXYNodeMap("coords"))
|
hegyi@1
|
365 |
{
|
hegyi@1
|
366 |
cblueCoordOneMap.set_active_text("coords");
|
hegyi@1
|
367 |
}
|
hegyi@1
|
368 |
else if (p_data->isNodeMap("coord_x") &&
|
hegyi@1
|
369 |
p_data->isNodeMap("coord_y"))
|
hegyi@1
|
370 |
{
|
hegyi@1
|
371 |
cblueCoordTwoMaps1.set_active_text("coord_x");
|
hegyi@1
|
372 |
cblueCoordTwoMaps2.set_active_text("coord_y");
|
hegyi@1
|
373 |
}
|
hegyi@1
|
374 |
else if (p_data->isNodeMap("coords_x") &&
|
hegyi@1
|
375 |
p_data->isNodeMap("coords_y"))
|
hegyi@1
|
376 |
{
|
hegyi@1
|
377 |
cblueCoordTwoMaps1.set_active_text("coords_x");
|
hegyi@1
|
378 |
cblueCoordTwoMaps2.set_active_text("coords_y");
|
hegyi@1
|
379 |
}
|
hegyi@1
|
380 |
else if (p_data->isNodeMap("x") &&
|
hegyi@1
|
381 |
p_data->isNodeMap("y"))
|
hegyi@1
|
382 |
{
|
hegyi@1
|
383 |
cblueCoordTwoMaps1.set_active_text("x");
|
hegyi@1
|
384 |
cblueCoordTwoMaps2.set_active_text("y");
|
hegyi@1
|
385 |
}
|
hegyi@1
|
386 |
|
hegyi@1
|
387 |
if (p_data->isXYArcMap("arrow"))
|
hegyi@1
|
388 |
{
|
hegyi@1
|
389 |
cbArrowCoordOneMap.set_active_text("arrow");
|
hegyi@1
|
390 |
}
|
hegyi@1
|
391 |
else if (p_data->isXYArcMap("arrows"))
|
hegyi@1
|
392 |
{
|
hegyi@1
|
393 |
cbArrowCoordOneMap.set_active_text("arrows");
|
hegyi@1
|
394 |
}
|
hegyi@1
|
395 |
else if (p_data->isXYArcMap("midpoint"))
|
hegyi@1
|
396 |
{
|
hegyi@1
|
397 |
cbArrowCoordOneMap.set_active_text("midpoint");
|
hegyi@1
|
398 |
}
|
hegyi@1
|
399 |
else if (p_data->isXYArcMap("midpoints"))
|
hegyi@1
|
400 |
{
|
hegyi@1
|
401 |
cbArrowCoordOneMap.set_active_text("midpoints");
|
hegyi@1
|
402 |
}
|
hegyi@1
|
403 |
else if (p_data->isXYArcMap("mid"))
|
hegyi@1
|
404 |
{
|
hegyi@1
|
405 |
cbArrowCoordOneMap.set_active_text("mid");
|
hegyi@1
|
406 |
}
|
hegyi@1
|
407 |
else if (p_data->isXYArcMap("mids"))
|
hegyi@1
|
408 |
{
|
hegyi@1
|
409 |
cbArrowCoordOneMap.set_active_text("mids");
|
hegyi@1
|
410 |
}
|
hegyi@1
|
411 |
else if (p_data->isArcMap("arrow_x") &&
|
hegyi@1
|
412 |
p_data->isArcMap("arrow_y"))
|
hegyi@1
|
413 |
{
|
hegyi@1
|
414 |
cbArrowCoordTwoMaps1.set_active_text("arrow_x");
|
hegyi@1
|
415 |
cbArrowCoordTwoMaps2.set_active_text("arrow_y");
|
hegyi@1
|
416 |
}
|
hegyi@1
|
417 |
else if (p_data->isArcMap("arrows_x") &&
|
hegyi@1
|
418 |
p_data->isArcMap("arrows_y"))
|
hegyi@1
|
419 |
{
|
hegyi@1
|
420 |
cbArrowCoordTwoMaps1.set_active_text("arrows_x");
|
hegyi@1
|
421 |
cbArrowCoordTwoMaps2.set_active_text("arrows_y");
|
hegyi@1
|
422 |
}
|
hegyi@1
|
423 |
else if (p_data->isArcMap("midpoint_x") &&
|
hegyi@1
|
424 |
p_data->isArcMap("midpoint_y"))
|
hegyi@1
|
425 |
{
|
hegyi@1
|
426 |
cbArrowCoordTwoMaps1.set_active_text("midpoint_x");
|
hegyi@1
|
427 |
cbArrowCoordTwoMaps2.set_active_text("midpoint_y");
|
hegyi@1
|
428 |
}
|
hegyi@1
|
429 |
else if (p_data->isArcMap("midpoints_x") &&
|
hegyi@1
|
430 |
p_data->isArcMap("midpoints_y"))
|
hegyi@1
|
431 |
{
|
hegyi@1
|
432 |
cbArrowCoordTwoMaps1.set_active_text("midpoints_x");
|
hegyi@1
|
433 |
cbArrowCoordTwoMaps2.set_active_text("midpoints_y");
|
hegyi@1
|
434 |
}
|
hegyi@1
|
435 |
else if (p_data->isArcMap("mid_x") &&
|
hegyi@1
|
436 |
p_data->isArcMap("mid_y"))
|
hegyi@1
|
437 |
{
|
hegyi@1
|
438 |
cbArrowCoordTwoMaps1.set_active_text("mid_x");
|
hegyi@1
|
439 |
cbArrowCoordTwoMaps2.set_active_text("mid_y");
|
hegyi@1
|
440 |
}
|
hegyi@1
|
441 |
else if (p_data->isArcMap("mids_x") &&
|
hegyi@1
|
442 |
p_data->isArcMap("mids_y"))
|
hegyi@1
|
443 |
{
|
hegyi@1
|
444 |
cbArrowCoordTwoMaps1.set_active_text("mids_x");
|
hegyi@1
|
445 |
cbArrowCoordTwoMaps2.set_active_text("mids_y");
|
hegyi@1
|
446 |
}
|
hegyi@1
|
447 |
|
hegyi@1
|
448 |
{
|
hegyi@1
|
449 |
if (cblueCoordOneMap.get_active_text() != "")
|
hegyi@1
|
450 |
rblueCoordOneMap.set_active();
|
hegyi@1
|
451 |
else if (cblueCoordTwoMaps1.get_active_text() != "")
|
hegyi@1
|
452 |
rblueCoordTwoMaps.set_active();
|
hegyi@1
|
453 |
else
|
hegyi@1
|
454 |
rblueCoordNone.set_active();
|
hegyi@1
|
455 |
|
hegyi@1
|
456 |
if (cbArrowCoordOneMap.get_active_text() != "")
|
hegyi@1
|
457 |
rbArrowCoordOneMap.set_active();
|
hegyi@1
|
458 |
else if (cbArrowCoordTwoMaps1.get_active_text() != "")
|
hegyi@1
|
459 |
rbArrowCoordTwoMaps.set_active();
|
hegyi@1
|
460 |
else
|
hegyi@1
|
461 |
rbArrowCoordNone.set_active();
|
hegyi@1
|
462 |
|
hegyi@1
|
463 |
onNodeCoordMapNumToggled();
|
hegyi@1
|
464 |
onArrowCoordMapNumToggled();
|
hegyi@1
|
465 |
|
hegyi@1
|
466 |
rblueCoordOneMap.signal_toggled().connect(
|
hegyi@1
|
467 |
sigc::mem_fun(*this, &FileImportDialog::onNodeCoordMapNumToggled));
|
hegyi@1
|
468 |
rblueCoordTwoMaps.signal_toggled().connect(
|
hegyi@1
|
469 |
sigc::mem_fun(*this, &FileImportDialog::onNodeCoordMapNumToggled));
|
hegyi@1
|
470 |
rbArrowCoordOneMap.signal_toggled().connect(
|
hegyi@1
|
471 |
sigc::mem_fun(*this, &FileImportDialog::onArrowCoordMapNumToggled));
|
hegyi@1
|
472 |
rbArrowCoordTwoMaps.signal_toggled().connect(
|
hegyi@1
|
473 |
sigc::mem_fun(*this, &FileImportDialog::onArrowCoordMapNumToggled));
|
hegyi@1
|
474 |
}
|
hegyi@1
|
475 |
|
hegyi@1
|
476 |
signal_response().connect(
|
hegyi@1
|
477 |
sigc::mem_fun(*this, &FileImportDialog::onResponse));
|
hegyi@1
|
478 |
|
hegyi@1
|
479 |
update_node_tree_view();
|
hegyi@1
|
480 |
update_arc_tree_view();
|
hegyi@1
|
481 |
|
hegyi@1
|
482 |
show_all_children();
|
hegyi@1
|
483 |
}
|
hegyi@1
|
484 |
|
hegyi@1
|
485 |
void FileImportDialog::onNodeCoordMapNumToggled()
|
hegyi@1
|
486 |
{
|
hegyi@1
|
487 |
if (rblueCoordOneMap.get_active())
|
hegyi@1
|
488 |
{
|
hegyi@1
|
489 |
cblueCoordOneMap.get_parent()->set_sensitive(true);
|
hegyi@1
|
490 |
cblueCoordTwoMaps1.get_parent()->set_sensitive(false);
|
hegyi@1
|
491 |
cblueCoordTwoMaps2.get_parent()->set_sensitive(false);
|
hegyi@1
|
492 |
|
hegyi@1
|
493 |
p_data->node_coord_load_from = ImportData::ONE_MAP;
|
hegyi@1
|
494 |
}
|
hegyi@1
|
495 |
else if (rblueCoordTwoMaps.get_active())
|
hegyi@1
|
496 |
{
|
hegyi@1
|
497 |
cblueCoordOneMap.get_parent()->set_sensitive(false);
|
hegyi@1
|
498 |
cblueCoordTwoMaps1.get_parent()->set_sensitive(true);
|
hegyi@1
|
499 |
cblueCoordTwoMaps2.get_parent()->set_sensitive(true);
|
hegyi@1
|
500 |
|
hegyi@1
|
501 |
p_data->node_coord_load_from = ImportData::TWO_MAPS;
|
hegyi@1
|
502 |
}
|
hegyi@1
|
503 |
else if (rblueCoordNone.get_active())
|
hegyi@1
|
504 |
{
|
hegyi@1
|
505 |
cblueCoordOneMap.get_parent()->set_sensitive(false);
|
hegyi@1
|
506 |
cblueCoordTwoMaps1.get_parent()->set_sensitive(false);
|
hegyi@1
|
507 |
cblueCoordTwoMaps2.get_parent()->set_sensitive(false);
|
hegyi@1
|
508 |
|
hegyi@1
|
509 |
p_data->node_coord_load_from = ImportData::DONT_READ;
|
hegyi@1
|
510 |
}
|
hegyi@1
|
511 |
update_node_tree_view();
|
hegyi@1
|
512 |
}
|
hegyi@1
|
513 |
|
hegyi@1
|
514 |
void FileImportDialog::onArrowCoordMapNumToggled()
|
hegyi@1
|
515 |
{
|
hegyi@1
|
516 |
if (rbArrowCoordOneMap.get_active())
|
hegyi@1
|
517 |
{
|
hegyi@1
|
518 |
cbArrowCoordOneMap.get_parent()->set_sensitive(true);
|
hegyi@1
|
519 |
cbArrowCoordTwoMaps1.get_parent()->set_sensitive(false);
|
hegyi@1
|
520 |
cbArrowCoordTwoMaps2.get_parent()->set_sensitive(false);
|
hegyi@1
|
521 |
|
hegyi@1
|
522 |
p_data->arrow_coord_load_from = ImportData::ONE_MAP;
|
hegyi@1
|
523 |
}
|
hegyi@1
|
524 |
else if (rbArrowCoordTwoMaps.get_active())
|
hegyi@1
|
525 |
{
|
hegyi@1
|
526 |
cbArrowCoordOneMap.get_parent()->set_sensitive(false);
|
hegyi@1
|
527 |
cbArrowCoordTwoMaps1.get_parent()->set_sensitive(true);
|
hegyi@1
|
528 |
cbArrowCoordTwoMaps2.get_parent()->set_sensitive(true);
|
hegyi@1
|
529 |
|
hegyi@1
|
530 |
p_data->arrow_coord_load_from = ImportData::TWO_MAPS;
|
hegyi@1
|
531 |
}
|
hegyi@1
|
532 |
else if (rbArrowCoordNone.get_active())
|
hegyi@1
|
533 |
{
|
hegyi@1
|
534 |
cbArrowCoordOneMap.get_parent()->set_sensitive(false);
|
hegyi@1
|
535 |
cbArrowCoordTwoMaps1.get_parent()->set_sensitive(false);
|
hegyi@1
|
536 |
cbArrowCoordTwoMaps2.get_parent()->set_sensitive(false);
|
hegyi@1
|
537 |
|
hegyi@1
|
538 |
p_data->arrow_coord_load_from = ImportData::DONT_READ;
|
hegyi@1
|
539 |
}
|
hegyi@1
|
540 |
update_arc_tree_view();
|
hegyi@1
|
541 |
}
|
hegyi@1
|
542 |
|
hegyi@1
|
543 |
FileImportDialog::~FileImportDialog()
|
hegyi@1
|
544 |
{
|
hegyi@1
|
545 |
}
|
hegyi@1
|
546 |
|
hegyi@1
|
547 |
void FileImportDialog::onResponse(int id)
|
hegyi@1
|
548 |
{
|
hegyi@1
|
549 |
if (id == Gtk::RESPONSE_OK)
|
hegyi@1
|
550 |
{
|
hegyi@1
|
551 |
if ((rblueCoordOneMap.get_active() &&
|
hegyi@1
|
552 |
cblueCoordOneMap.get_active_text() == "") ||
|
hegyi@1
|
553 |
(rblueCoordTwoMaps.get_active() &&
|
hegyi@1
|
554 |
(cblueCoordTwoMaps1.get_active_text() == "" ||
|
hegyi@1
|
555 |
cblueCoordTwoMaps2.get_active_text() == "")))
|
hegyi@1
|
556 |
{
|
hegyi@1
|
557 |
Gtk::MessageDialog mdialog("No node map selected.",
|
hegyi@1
|
558 |
false, Gtk::MESSAGE_ERROR);
|
hegyi@1
|
559 |
mdialog.run();
|
hegyi@1
|
560 |
return;
|
hegyi@1
|
561 |
}
|
hegyi@1
|
562 |
else if (rblueCoordTwoMaps.get_active() &&
|
hegyi@1
|
563 |
cblueCoordTwoMaps1.get_active_text() ==
|
hegyi@1
|
564 |
cblueCoordTwoMaps2.get_active_text())
|
hegyi@1
|
565 |
{
|
hegyi@1
|
566 |
Gtk::MessageDialog mdialog(
|
hegyi@1
|
567 |
"Same node map selected for both coordinates.",
|
hegyi@1
|
568 |
false, Gtk::MESSAGE_ERROR);
|
hegyi@1
|
569 |
mdialog.run();
|
hegyi@1
|
570 |
return;
|
hegyi@1
|
571 |
}
|
hegyi@1
|
572 |
if ((rbArrowCoordOneMap.get_active() &&
|
hegyi@1
|
573 |
cbArrowCoordOneMap.get_active_text() == "") ||
|
hegyi@1
|
574 |
(rbArrowCoordTwoMaps.get_active() &&
|
hegyi@1
|
575 |
(cbArrowCoordTwoMaps1.get_active_text() == "" ||
|
hegyi@1
|
576 |
cbArrowCoordTwoMaps2.get_active_text() == "")))
|
hegyi@1
|
577 |
{
|
hegyi@1
|
578 |
Gtk::MessageDialog mdialog("No arc map selected.",
|
hegyi@1
|
579 |
false, Gtk::MESSAGE_ERROR);
|
hegyi@1
|
580 |
mdialog.run();
|
hegyi@1
|
581 |
return;
|
hegyi@1
|
582 |
}
|
hegyi@1
|
583 |
else if (rbArrowCoordTwoMaps.get_active() &&
|
hegyi@1
|
584 |
cbArrowCoordTwoMaps1.get_active_text() ==
|
hegyi@1
|
585 |
cbArrowCoordTwoMaps2.get_active_text())
|
hegyi@1
|
586 |
{
|
hegyi@1
|
587 |
Gtk::MessageDialog mdialog(
|
hegyi@1
|
588 |
"Same arc map selected for both coordinates.",
|
hegyi@1
|
589 |
false, Gtk::MESSAGE_ERROR);
|
hegyi@1
|
590 |
mdialog.run();
|
hegyi@1
|
591 |
return;
|
hegyi@1
|
592 |
}
|
hegyi@1
|
593 |
|
hegyi@1
|
594 |
for (std::vector<tree_view_record>::const_iterator it =
|
hegyi@1
|
595 |
node_tree_view_records.begin(); it != node_tree_view_records.end();
|
hegyi@1
|
596 |
++it)
|
hegyi@1
|
597 |
{
|
hegyi@1
|
598 |
if (it->visible)
|
hegyi@1
|
599 |
{
|
hegyi@1
|
600 |
if (it->numeric)
|
hegyi@1
|
601 |
p_data->numeric_node_map_names.push_back(it->name);
|
hegyi@1
|
602 |
if (it->string)
|
hegyi@1
|
603 |
p_data->string_node_map_names.push_back(it->name);
|
hegyi@1
|
604 |
}
|
hegyi@1
|
605 |
}
|
hegyi@1
|
606 |
|
hegyi@1
|
607 |
for (std::vector<tree_view_record>::const_iterator it =
|
hegyi@1
|
608 |
arc_tree_view_records.begin(); it != arc_tree_view_records.end();
|
hegyi@1
|
609 |
++it)
|
hegyi@1
|
610 |
{
|
hegyi@1
|
611 |
if (it->visible)
|
hegyi@1
|
612 |
{
|
hegyi@1
|
613 |
if (it->numeric)
|
hegyi@1
|
614 |
p_data->numeric_arc_map_names.push_back(it->name);
|
hegyi@1
|
615 |
if (it->string)
|
hegyi@1
|
616 |
p_data->string_arc_map_names.push_back(it->name);
|
hegyi@1
|
617 |
}
|
hegyi@1
|
618 |
}
|
hegyi@1
|
619 |
}
|
hegyi@1
|
620 |
}
|
hegyi@1
|
621 |
|
hegyi@1
|
622 |
FileImportDialog::ImportData::ImportData(
|
hegyi@1
|
623 |
const std::vector<std::string>& _node_map_names,
|
hegyi@1
|
624 |
const std::vector<std::string>& _arc_map_names) :
|
hegyi@1
|
625 |
node_map_names(_node_map_names),
|
hegyi@1
|
626 |
arc_map_names(_arc_map_names)
|
hegyi@1
|
627 |
{
|
hegyi@1
|
628 |
typedef std::vector<std::string> StrVec;
|
hegyi@1
|
629 |
{
|
hegyi@1
|
630 |
StrVec xMaps;
|
hegyi@1
|
631 |
StrVec yMaps;
|
hegyi@1
|
632 |
// collect map names ending with ":x" and ":y"
|
hegyi@1
|
633 |
for (StrVec::const_iterator it = node_map_names.begin();
|
hegyi@1
|
634 |
it != node_map_names.end(); ++it)
|
hegyi@1
|
635 |
{
|
hegyi@1
|
636 |
if ((it->length() >= 3) &&
|
hegyi@1
|
637 |
(it->substr(it->length()-2, it->length()) == ":x"))
|
hegyi@1
|
638 |
{
|
hegyi@1
|
639 |
xMaps.push_back(it->substr(0, it->length()-2));
|
hegyi@1
|
640 |
}
|
hegyi@1
|
641 |
if ((it->length() >= 3) &&
|
hegyi@1
|
642 |
(it->substr(it->length()-2, it->length()) == ":y"))
|
hegyi@1
|
643 |
{
|
hegyi@1
|
644 |
yMaps.push_back(it->substr(0, it->length()-2));
|
hegyi@1
|
645 |
}
|
hegyi@1
|
646 |
}
|
hegyi@1
|
647 |
|
hegyi@1
|
648 |
for (StrVec::const_iterator it1 = xMaps.begin();
|
hegyi@1
|
649 |
it1 != xMaps.end(); ++it1)
|
hegyi@1
|
650 |
{
|
hegyi@1
|
651 |
for (StrVec::const_iterator it2 = yMaps.begin();
|
hegyi@1
|
652 |
it2 != yMaps.end(); ++it2)
|
hegyi@1
|
653 |
{
|
hegyi@1
|
654 |
if (*it1 == *it2) xy_node_map_names.push_back(*it1);
|
hegyi@1
|
655 |
}
|
hegyi@1
|
656 |
}
|
hegyi@1
|
657 |
}
|
hegyi@1
|
658 |
{
|
hegyi@1
|
659 |
StrVec xMaps;
|
hegyi@1
|
660 |
StrVec yMaps;
|
hegyi@1
|
661 |
// collect map names ending with ":x" and ":y"
|
hegyi@1
|
662 |
for (StrVec::const_iterator it = arc_map_names.begin();
|
hegyi@1
|
663 |
it != arc_map_names.end(); ++it)
|
hegyi@1
|
664 |
{
|
hegyi@1
|
665 |
if ((it->length() >= 3) &&
|
hegyi@1
|
666 |
(it->substr(it->length()-2, it->length()) == ":x"))
|
hegyi@1
|
667 |
{
|
hegyi@1
|
668 |
xMaps.push_back(it->substr(0, it->length()-2));
|
hegyi@1
|
669 |
}
|
hegyi@1
|
670 |
if ((it->length() >= 3) &&
|
hegyi@1
|
671 |
(it->substr(it->length()-2, it->length()) == ":y"))
|
hegyi@1
|
672 |
{
|
hegyi@1
|
673 |
yMaps.push_back(it->substr(0, it->length()-2));
|
hegyi@1
|
674 |
}
|
hegyi@1
|
675 |
}
|
hegyi@1
|
676 |
|
hegyi@1
|
677 |
for (StrVec::const_iterator it1 = xMaps.begin();
|
hegyi@1
|
678 |
it1 != xMaps.end(); ++it1)
|
hegyi@1
|
679 |
{
|
hegyi@1
|
680 |
for (StrVec::const_iterator it2 = yMaps.begin();
|
hegyi@1
|
681 |
it2 != yMaps.end(); ++it2)
|
hegyi@1
|
682 |
{
|
hegyi@1
|
683 |
if (*it1 == *it2) xy_arc_map_names.push_back(*it1);
|
hegyi@1
|
684 |
}
|
hegyi@1
|
685 |
}
|
hegyi@1
|
686 |
}
|
hegyi@1
|
687 |
}
|
hegyi@1
|
688 |
|
hegyi@1
|
689 |
FileImportDialog::ImportData::~ImportData()
|
hegyi@1
|
690 |
{
|
hegyi@1
|
691 |
}
|
hegyi@1
|
692 |
|
hegyi@1
|
693 |
bool FileImportDialog::ImportData::isXYNodeMap(const std::string& name)
|
hegyi@1
|
694 |
{
|
hegyi@1
|
695 |
if (isNodeMap(name + ":x") && isNodeMap(name + ":y")) return true;
|
hegyi@1
|
696 |
return false;
|
hegyi@1
|
697 |
}
|
hegyi@1
|
698 |
|
hegyi@1
|
699 |
bool FileImportDialog::ImportData::isXYArcMap(const std::string& name)
|
hegyi@1
|
700 |
{
|
hegyi@1
|
701 |
if (isArcMap(name + ":x") && isArcMap(name + ":y")) return true;
|
hegyi@1
|
702 |
return false;
|
hegyi@1
|
703 |
}
|
hegyi@1
|
704 |
|
hegyi@1
|
705 |
bool FileImportDialog::ImportData::isNodeMap(const std::string& name)
|
hegyi@1
|
706 |
{
|
hegyi@1
|
707 |
if (contains(node_map_names, name)) return true;
|
hegyi@1
|
708 |
return false;
|
hegyi@1
|
709 |
}
|
hegyi@1
|
710 |
|
hegyi@1
|
711 |
bool FileImportDialog::ImportData::isArcMap(const std::string& name)
|
hegyi@1
|
712 |
{
|
hegyi@1
|
713 |
if (contains(arc_map_names, name)) return true;
|
hegyi@1
|
714 |
return false;
|
hegyi@1
|
715 |
}
|
hegyi@1
|
716 |
|
hegyi@1
|
717 |
bool FileImportDialog::ImportData::contains(const std::vector<std::string>& vec,
|
hegyi@1
|
718 |
const std::string& str)
|
hegyi@1
|
719 |
{
|
hegyi@1
|
720 |
for (std::vector<std::string>::const_iterator it = vec.begin();
|
hegyi@1
|
721 |
it != vec.end(); ++it)
|
hegyi@1
|
722 |
{
|
hegyi@1
|
723 |
if (*it == str) return true;
|
hegyi@1
|
724 |
}
|
hegyi@1
|
725 |
return false;
|
hegyi@1
|
726 |
}
|
hegyi@1
|
727 |
|
hegyi@1
|
728 |
void FileImportDialog::onNodeCoordOneMapChanged()
|
hegyi@1
|
729 |
{
|
hegyi@1
|
730 |
p_data->node_coord_one_map_name = cblueCoordOneMap.get_active_text();
|
hegyi@1
|
731 |
update_node_tree_view();
|
hegyi@1
|
732 |
}
|
hegyi@1
|
733 |
|
hegyi@1
|
734 |
void FileImportDialog::onNodeCoordTwoMaps1Changed()
|
hegyi@1
|
735 |
{
|
hegyi@1
|
736 |
p_data->node_coord_two_maps_1_name = cblueCoordTwoMaps1.get_active_text();
|
hegyi@1
|
737 |
update_node_tree_view();
|
hegyi@1
|
738 |
}
|
hegyi@1
|
739 |
|
hegyi@1
|
740 |
void FileImportDialog::onNodeCoordTwoMaps2Changed()
|
hegyi@1
|
741 |
{
|
hegyi@1
|
742 |
p_data->node_coord_two_maps_2_name = cblueCoordTwoMaps2.get_active_text();
|
hegyi@1
|
743 |
update_node_tree_view();
|
hegyi@1
|
744 |
}
|
hegyi@1
|
745 |
|
hegyi@1
|
746 |
void FileImportDialog::onArrowCoordOneMapChanged()
|
hegyi@1
|
747 |
{
|
hegyi@1
|
748 |
p_data->arrow_coord_one_map_name = cbArrowCoordOneMap.get_active_text();
|
hegyi@1
|
749 |
update_arc_tree_view();
|
hegyi@1
|
750 |
}
|
hegyi@1
|
751 |
|
hegyi@1
|
752 |
void FileImportDialog::onArrowCoordTwoMaps1Changed()
|
hegyi@1
|
753 |
{
|
hegyi@1
|
754 |
p_data->arrow_coord_two_maps_1_name = cbArrowCoordTwoMaps1.get_active_text();
|
hegyi@1
|
755 |
update_arc_tree_view();
|
hegyi@1
|
756 |
}
|
hegyi@1
|
757 |
|
hegyi@1
|
758 |
void FileImportDialog::onArrowCoordTwoMaps2Changed()
|
hegyi@1
|
759 |
{
|
hegyi@1
|
760 |
p_data->arrow_coord_two_maps_2_name = cbArrowCoordTwoMaps2.get_active_text();
|
hegyi@1
|
761 |
update_arc_tree_view();
|
hegyi@1
|
762 |
}
|
hegyi@1
|
763 |
|
hegyi@1
|
764 |
void FileImportDialog::onNodeMapNumericToggled(const Glib::ustring& path)
|
hegyi@1
|
765 |
{
|
hegyi@1
|
766 |
Gtk::TreeModel::iterator iter = refNodeMapStore->get_iter(
|
hegyi@1
|
767 |
Gtk::TreeModel::Path(path));
|
hegyi@1
|
768 |
Gtk::TreeModel::Row row = *iter;
|
hegyi@1
|
769 |
std::vector<tree_view_record>::iterator it;
|
hegyi@1
|
770 |
for (it = node_tree_view_records.begin();
|
hegyi@1
|
771 |
it != node_tree_view_records.end(); ++it)
|
hegyi@1
|
772 |
{
|
hegyi@1
|
773 |
if (it->name == row[NodeMapColumns.colName]) break;
|
hegyi@1
|
774 |
}
|
hegyi@1
|
775 |
if (row[NodeMapColumns.colReadAsNumeric])
|
hegyi@1
|
776 |
{
|
hegyi@1
|
777 |
row[NodeMapColumns.colReadAsString] = false;
|
hegyi@1
|
778 |
it->string = false;
|
hegyi@1
|
779 |
it->numeric = true;
|
hegyi@1
|
780 |
}
|
hegyi@1
|
781 |
}
|
hegyi@1
|
782 |
|
hegyi@1
|
783 |
void FileImportDialog::onNodeMapStringToggled(const Glib::ustring& path)
|
hegyi@1
|
784 |
{
|
hegyi@1
|
785 |
Gtk::TreeModel::iterator iter = refNodeMapStore->get_iter(
|
hegyi@1
|
786 |
Gtk::TreeModel::Path(path));
|
hegyi@1
|
787 |
Gtk::TreeModel::Row row = *iter;
|
hegyi@1
|
788 |
std::vector<tree_view_record>::iterator it;
|
hegyi@1
|
789 |
for (it = node_tree_view_records.begin();
|
hegyi@1
|
790 |
it != node_tree_view_records.end(); ++it)
|
hegyi@1
|
791 |
{
|
hegyi@1
|
792 |
if (it->name == row[NodeMapColumns.colName]) break;
|
hegyi@1
|
793 |
}
|
hegyi@1
|
794 |
if (row[NodeMapColumns.colReadAsString])
|
hegyi@1
|
795 |
{
|
hegyi@1
|
796 |
row[NodeMapColumns.colReadAsNumeric] = false;
|
hegyi@1
|
797 |
it->string = true;
|
hegyi@1
|
798 |
it->numeric = false;
|
hegyi@1
|
799 |
}
|
hegyi@1
|
800 |
}
|
hegyi@1
|
801 |
|
hegyi@1
|
802 |
void FileImportDialog::update_node_tree_view()
|
hegyi@1
|
803 |
{
|
hegyi@1
|
804 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
805 |
node_tree_view_records.begin(); it != node_tree_view_records.end(); ++it)
|
hegyi@1
|
806 |
{
|
hegyi@1
|
807 |
it->visible = true;
|
hegyi@1
|
808 |
}
|
hegyi@1
|
809 |
switch (p_data->node_coord_load_from)
|
hegyi@1
|
810 |
{
|
hegyi@1
|
811 |
case ImportData::ONE_MAP:
|
hegyi@1
|
812 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
813 |
node_tree_view_records.begin(); it !=
|
hegyi@1
|
814 |
node_tree_view_records.end(); ++it)
|
hegyi@1
|
815 |
{
|
hegyi@1
|
816 |
if (it->name == p_data->node_coord_one_map_name)
|
hegyi@1
|
817 |
it->visible = false;
|
hegyi@1
|
818 |
}
|
hegyi@1
|
819 |
break;
|
hegyi@1
|
820 |
case ImportData::TWO_MAPS:
|
hegyi@1
|
821 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
822 |
node_tree_view_records.begin(); it !=
|
hegyi@1
|
823 |
node_tree_view_records.end(); ++it)
|
hegyi@1
|
824 |
{
|
hegyi@1
|
825 |
if ((it->name == p_data->node_coord_two_maps_1_name) ||
|
hegyi@1
|
826 |
(it->name == p_data->node_coord_two_maps_2_name))
|
hegyi@1
|
827 |
it->visible = false;
|
hegyi@1
|
828 |
}
|
hegyi@1
|
829 |
break;
|
hegyi@1
|
830 |
case ImportData::DONT_READ:
|
hegyi@1
|
831 |
break;
|
hegyi@1
|
832 |
}
|
hegyi@1
|
833 |
refNodeMapStore->clear();
|
hegyi@1
|
834 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
835 |
node_tree_view_records.begin(); it != node_tree_view_records.end(); ++it)
|
hegyi@1
|
836 |
{
|
hegyi@1
|
837 |
if (it->visible)
|
hegyi@1
|
838 |
{
|
hegyi@1
|
839 |
Gtk::TreeModel::Row row = *(refNodeMapStore->append());
|
hegyi@1
|
840 |
row[NodeMapColumns.colName] = it->name;
|
hegyi@1
|
841 |
row[NodeMapColumns.colReadAsNumeric] = it->numeric;
|
hegyi@1
|
842 |
row[NodeMapColumns.colReadAsString] = it->string;
|
hegyi@1
|
843 |
}
|
hegyi@1
|
844 |
}
|
hegyi@1
|
845 |
}
|
hegyi@1
|
846 |
|
hegyi@1
|
847 |
void FileImportDialog::onArcMapNumericToggled(const Glib::ustring& path)
|
hegyi@1
|
848 |
{
|
hegyi@1
|
849 |
Gtk::TreeModel::iterator iter = refArcMapStore->get_iter(
|
hegyi@1
|
850 |
Gtk::TreeModel::Path(path));
|
hegyi@1
|
851 |
Gtk::TreeModel::Row row = *iter;
|
hegyi@1
|
852 |
std::vector<tree_view_record>::iterator it;
|
hegyi@1
|
853 |
for (it = arc_tree_view_records.begin();
|
hegyi@1
|
854 |
it != arc_tree_view_records.end(); ++it)
|
hegyi@1
|
855 |
{
|
hegyi@1
|
856 |
if (it->name == row[ArcMapColumns.colName]) break;
|
hegyi@1
|
857 |
}
|
hegyi@1
|
858 |
if (row[ArcMapColumns.colReadAsNumeric])
|
hegyi@1
|
859 |
{
|
hegyi@1
|
860 |
row[ArcMapColumns.colReadAsString] = false;
|
hegyi@1
|
861 |
it->string = false;
|
hegyi@1
|
862 |
it->numeric = true;
|
hegyi@1
|
863 |
}
|
hegyi@1
|
864 |
}
|
hegyi@1
|
865 |
|
hegyi@1
|
866 |
void FileImportDialog::onArcMapStringToggled(const Glib::ustring& path)
|
hegyi@1
|
867 |
{
|
hegyi@1
|
868 |
Gtk::TreeModel::iterator iter = refArcMapStore->get_iter(
|
hegyi@1
|
869 |
Gtk::TreeModel::Path(path));
|
hegyi@1
|
870 |
Gtk::TreeModel::Row row = *iter;
|
hegyi@1
|
871 |
std::vector<tree_view_record>::iterator it;
|
hegyi@1
|
872 |
for (it = arc_tree_view_records.begin();
|
hegyi@1
|
873 |
it != arc_tree_view_records.end(); ++it)
|
hegyi@1
|
874 |
{
|
hegyi@1
|
875 |
if (it->name == row[ArcMapColumns.colName]) break;
|
hegyi@1
|
876 |
}
|
hegyi@1
|
877 |
if (row[ArcMapColumns.colReadAsString])
|
hegyi@1
|
878 |
{
|
hegyi@1
|
879 |
row[ArcMapColumns.colReadAsNumeric] = false;
|
hegyi@1
|
880 |
it->string = true;
|
hegyi@1
|
881 |
it->numeric = false;
|
hegyi@1
|
882 |
}
|
hegyi@1
|
883 |
}
|
hegyi@1
|
884 |
|
hegyi@1
|
885 |
void FileImportDialog::update_arc_tree_view()
|
hegyi@1
|
886 |
{
|
hegyi@1
|
887 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
888 |
arc_tree_view_records.begin(); it != arc_tree_view_records.end(); ++it)
|
hegyi@1
|
889 |
{
|
hegyi@1
|
890 |
it->visible = true;
|
hegyi@1
|
891 |
}
|
hegyi@1
|
892 |
switch (p_data->arrow_coord_load_from)
|
hegyi@1
|
893 |
{
|
hegyi@1
|
894 |
case ImportData::ONE_MAP:
|
hegyi@1
|
895 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
896 |
arc_tree_view_records.begin(); it !=
|
hegyi@1
|
897 |
arc_tree_view_records.end(); ++it)
|
hegyi@1
|
898 |
{
|
hegyi@1
|
899 |
if (it->name == p_data->arrow_coord_one_map_name)
|
hegyi@1
|
900 |
it->visible = false;
|
hegyi@1
|
901 |
}
|
hegyi@1
|
902 |
break;
|
hegyi@1
|
903 |
case ImportData::TWO_MAPS:
|
hegyi@1
|
904 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
905 |
arc_tree_view_records.begin(); it !=
|
hegyi@1
|
906 |
arc_tree_view_records.end(); ++it)
|
hegyi@1
|
907 |
{
|
hegyi@1
|
908 |
if ((it->name == p_data->arrow_coord_two_maps_1_name) ||
|
hegyi@1
|
909 |
(it->name == p_data->arrow_coord_two_maps_2_name))
|
hegyi@1
|
910 |
it->visible = false;
|
hegyi@1
|
911 |
}
|
hegyi@1
|
912 |
break;
|
hegyi@1
|
913 |
case ImportData::DONT_READ:
|
hegyi@1
|
914 |
break;
|
hegyi@1
|
915 |
}
|
hegyi@1
|
916 |
refArcMapStore->clear();
|
hegyi@1
|
917 |
for (std::vector<tree_view_record>::iterator it =
|
hegyi@1
|
918 |
arc_tree_view_records.begin(); it != arc_tree_view_records.end(); ++it)
|
hegyi@1
|
919 |
{
|
hegyi@1
|
920 |
if (it->visible)
|
hegyi@1
|
921 |
{
|
hegyi@1
|
922 |
Gtk::TreeModel::Row row = *(refArcMapStore->append());
|
hegyi@1
|
923 |
row[ArcMapColumns.colName] = it->name;
|
hegyi@1
|
924 |
row[ArcMapColumns.colReadAsNumeric] = it->numeric;
|
hegyi@1
|
925 |
row[ArcMapColumns.colReadAsString] = it->string;
|
hegyi@1
|
926 |
}
|
hegyi@1
|
927 |
}
|
hegyi@1
|
928 |
}
|