Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 625:1336439dc055 tonioni
fixed flexi note layer and propagated model selection to analyser
author | gyorgyf |
---|---|
date | Sat, 13 Apr 2013 13:39:17 +0100 |
parents | 49afde2dd704 |
children | 7256926d3af1 |
comparison
equal
deleted
inserted
replaced
623:49afde2dd704 | 625:1336439dc055 |
---|---|
73 case Spectrogram: return Layer::tr("Spectrogram"); | 73 case Spectrogram: return Layer::tr("Spectrogram"); |
74 case TimeRuler: return Layer::tr("Ruler"); | 74 case TimeRuler: return Layer::tr("Ruler"); |
75 case TimeInstants: return Layer::tr("Time Instants"); | 75 case TimeInstants: return Layer::tr("Time Instants"); |
76 case TimeValues: return Layer::tr("Time Values"); | 76 case TimeValues: return Layer::tr("Time Values"); |
77 case Notes: return Layer::tr("Notes"); | 77 case Notes: return Layer::tr("Notes"); |
78 case FlexiNotes: return Layer::tr("flexible Notes"); | 78 case FlexiNotes: return Layer::tr("Flexible Notes"); |
79 case Regions: return Layer::tr("Regions"); | 79 case Regions: return Layer::tr("Regions"); |
80 case Text: return Layer::tr("Text"); | 80 case Text: return Layer::tr("Text"); |
81 case Image: return Layer::tr("Images"); | 81 case Image: return Layer::tr("Images"); |
82 case Colour3DPlot: return Layer::tr("Colour 3D Plot"); | 82 case Colour3DPlot: return Layer::tr("Colour 3D Plot"); |
83 case Spectrum: return Layer::tr("Spectrum"); | 83 case Spectrum: return Layer::tr("Spectrum"); |
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); | 164 // types.insert(FlexiNotes); |
165 types.insert(Notes); | 165 types.insert(Notes); |
166 } | 166 } |
167 | 167 |
168 if (dynamic_cast<FlexiNoteModel *>(model)) { | 168 if (dynamic_cast<FlexiNoteModel *>(model)) { |
169 types.insert(FlexiNotes); | 169 types.insert(FlexiNotes); |
170 types.insert(Notes); | 170 // types.insert(Notes); |
171 } | 171 } |
172 | 172 |
173 if (dynamic_cast<RegionModel *>(model)) { | 173 if (dynamic_cast<RegionModel *>(model)) { |
174 types.insert(Regions); | 174 types.insert(Regions); |
175 } | 175 } |
293 void | 293 void |
294 LayerFactory::setModel(Layer *layer, Model *model) | 294 LayerFactory::setModel(Layer *layer, Model *model) |
295 { | 295 { |
296 // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model)) | 296 // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model)) |
297 // return; | 297 // return; |
298 | |
299 std::cerr << "LayerFactory::setModel called... " << std::endl; | |
298 | 300 |
299 if (trySetModel<WaveformLayer, WaveFileModel>(layer, model)) | 301 if (trySetModel<WaveformLayer, WaveFileModel>(layer, model)) |
300 return; | 302 return; |
301 | 303 |
302 if (trySetModel<WaveformLayer, WritableWaveFileModel>(layer, model)) | 304 if (trySetModel<WaveformLayer, WritableWaveFileModel>(layer, model)) |
312 return; | 314 return; |
313 | 315 |
314 if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) | 316 if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) |
315 return; | 317 return; |
316 | 318 |
317 if (trySetModel<NoteLayer, NoteModel>(layer, model)) | 319 if (trySetModel<NoteLayer, NoteModel>(layer, model)) { |
318 return; | 320 std::cerr << "trying to set note layer model" << std::endl; |
319 | 321 return; } |
320 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) | 322 |
321 return; | 323 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) { |
324 std::cerr << "trying to set flexi note layer model" << std::endl; | |
325 return; } | |
326 | |
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); | |
322 | 332 |
323 if (trySetModel<RegionLayer, RegionModel>(layer, model)) | 333 if (trySetModel<RegionLayer, RegionModel>(layer, model)) |
324 return; | 334 return; |
325 | 335 |
326 if (trySetModel<TextLayer, TextModel>(layer, model)) | 336 if (trySetModel<TextLayer, TextModel>(layer, model)) |
338 if (trySetModel<SpectrumLayer, DenseTimeValueModel>(layer, model)) | 348 if (trySetModel<SpectrumLayer, DenseTimeValueModel>(layer, model)) |
339 return; | 349 return; |
340 | 350 |
341 // if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model)) | 351 // if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model)) |
342 // return; | 352 // return; |
353 std::cerr << "LayerFactory::setModel done... " << std::endl; | |
343 } | 354 } |
344 | 355 |
345 Model * | 356 Model * |
346 LayerFactory::createEmptyModel(LayerType layerType, Model *baseModel) | 357 LayerFactory::createEmptyModel(LayerType layerType, Model *baseModel) |
347 { | 358 { |