comparison layer/LayerFactory.cpp @ 626:7256926d3af1 tonioni

cleanup
author gyorgyf
date Sat, 13 Apr 2013 15:36:54 +0100
parents 1336439dc055
children 917039d333bb
comparison
equal deleted inserted replaced
625:1336439dc055 626:7256926d3af1
159 if (dynamic_cast<SparseTimeValueModel *>(model)) { 159 if (dynamic_cast<SparseTimeValueModel *>(model)) {
160 types.insert(TimeValues); 160 types.insert(TimeValues);
161 } 161 }
162 162
163 if (dynamic_cast<NoteModel *>(model)) { 163 if (dynamic_cast<NoteModel *>(model)) {
164 // types.insert(FlexiNotes);
165 types.insert(Notes); 164 types.insert(Notes);
166 } 165 }
167 166
167 // NOTE: GF: types is a set, so order of insertion does not matter
168 if (dynamic_cast<FlexiNoteModel *>(model)) { 168 if (dynamic_cast<FlexiNoteModel *>(model)) {
169 types.insert(FlexiNotes); 169 types.insert(FlexiNotes);
170 // types.insert(Notes);
171 } 170 }
172 171
173 if (dynamic_cast<RegionModel *>(model)) { 172 if (dynamic_cast<RegionModel *>(model)) {
174 types.insert(Regions); 173 types.insert(Regions);
175 } 174 }
294 LayerFactory::setModel(Layer *layer, Model *model) 293 LayerFactory::setModel(Layer *layer, Model *model)
295 { 294 {
296 // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model)) 295 // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model))
297 // return; 296 // return;
298 297
299 std::cerr << "LayerFactory::setModel called... " << std::endl;
300
301 if (trySetModel<WaveformLayer, WaveFileModel>(layer, model)) 298 if (trySetModel<WaveformLayer, WaveFileModel>(layer, model))
302 return; 299 return;
303 300
304 if (trySetModel<WaveformLayer, WritableWaveFileModel>(layer, model)) 301 if (trySetModel<WaveformLayer, WritableWaveFileModel>(layer, model))
305 return; 302 return;
314 return; 311 return;
315 312
316 if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) 313 if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model))
317 return; 314 return;
318 315
319 if (trySetModel<NoteLayer, NoteModel>(layer, model)) { 316 if (trySetModel<NoteLayer, NoteModel>(layer, model))
320 std::cerr << "trying to set note layer model" << std::endl; 317 return;
321 return; } 318
322 319 // GF: added FlexiNoteLayer
323 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) { 320 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model))
324 std::cerr << "trying to set flexi note layer model" << std::endl; 321 return;
325 return; }
326 322
327 FlexiNoteLayer *clayer = dynamic_cast<FlexiNoteLayer *>(layer);
328 if (!clayer) { std::cerr << "layer cast failed" << std::endl; return; }
329 FlexiNoteModel *cmodel = dynamic_cast<FlexiNoteModel *>(model);
330 if (!cmodel) { std::cerr << "model cast failed" << std::endl; return; }
331 clayer->setModel(cmodel);
332
333 if (trySetModel<RegionLayer, RegionModel>(layer, model)) 323 if (trySetModel<RegionLayer, RegionModel>(layer, model))
334 return; 324 return;
335 325
336 if (trySetModel<TextLayer, TextModel>(layer, model)) 326 if (trySetModel<TextLayer, TextModel>(layer, model))
337 return; 327 return;
348 if (trySetModel<SpectrumLayer, DenseTimeValueModel>(layer, model)) 338 if (trySetModel<SpectrumLayer, DenseTimeValueModel>(layer, model))
349 return; 339 return;
350 340
351 // if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model)) 341 // if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model))
352 // return; 342 // return;
353 std::cerr << "LayerFactory::setModel done... " << std::endl;
354 } 343 }
355 344
356 Model * 345 Model *
357 LayerFactory::createEmptyModel(LayerType layerType, Model *baseModel) 346 LayerFactory::createEmptyModel(LayerType layerType, Model *baseModel)
358 { 347 {