comparison layer/LayerFactory.cpp @ 782:ddae586bc47b

Restore commit:6a8d922f991d which was apparently reverted in error as commit:c2291e22bf0c
author Chris Cannam
date Tue, 03 Jun 2014 11:10:52 +0100
parents c2291e22bf0c
children 1d526ba11a24
comparison
equal deleted inserted replaced
781:052cbaad991e 782:ddae586bc47b
162 162
163 if (dynamic_cast<NoteModel *>(model)) { 163 if (dynamic_cast<NoteModel *>(model)) {
164 types.insert(Notes); 164 types.insert(Notes);
165 } 165 }
166 166
167 // NOTE: GF: types is a set, so order of insertion does not matter 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 } 170 }
171 171
172 if (dynamic_cast<RegionModel *>(model)) { 172 if (dynamic_cast<RegionModel *>(model)) {
195 LayerFactory::getValidEmptyLayerTypes() 195 LayerFactory::getValidEmptyLayerTypes()
196 { 196 {
197 LayerTypeSet types; 197 LayerTypeSet types;
198 types.insert(TimeInstants); 198 types.insert(TimeInstants);
199 types.insert(TimeValues); 199 types.insert(TimeValues);
200 types.insert(FlexiNotes); 200 types.insert(FlexiNotes);
201 types.insert(Notes); 201 types.insert(Notes);
202 types.insert(Regions); 202 types.insert(Regions);
203 types.insert(Text); 203 types.insert(Text);
204 types.insert(Image); 204 types.insert(Image);
205 //!!! and in principle Colour3DPlot -- now that's a challenge 205 //!!! and in principle Colour3DPlot -- now that's a challenge
212 if (dynamic_cast<const WaveformLayer *>(layer)) return Waveform; 212 if (dynamic_cast<const WaveformLayer *>(layer)) return Waveform;
213 if (dynamic_cast<const SpectrogramLayer *>(layer)) return Spectrogram; 213 if (dynamic_cast<const SpectrogramLayer *>(layer)) return Spectrogram;
214 if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; 214 if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler;
215 if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; 215 if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants;
216 if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; 216 if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues;
217 if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; 217 if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes;
218 if (dynamic_cast<const NoteLayer *>(layer)) return Notes; 218 if (dynamic_cast<const NoteLayer *>(layer)) return Notes;
219 if (dynamic_cast<const RegionLayer *>(layer)) return Regions; 219 if (dynamic_cast<const RegionLayer *>(layer)) return Regions;
220 if (dynamic_cast<const TextLayer *>(layer)) return Text; 220 if (dynamic_cast<const TextLayer *>(layer)) return Text;
221 if (dynamic_cast<const ImageLayer *>(layer)) return Image; 221 if (dynamic_cast<const ImageLayer *>(layer)) return Image;
222 if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; 222 if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot;
233 case Spectrogram: return "spectrogram"; 233 case Spectrogram: return "spectrogram";
234 case TimeRuler: return "timeruler"; 234 case TimeRuler: return "timeruler";
235 case TimeInstants: return "instants"; 235 case TimeInstants: return "instants";
236 case TimeValues: return "values"; 236 case TimeValues: return "values";
237 case Notes: return "notes"; 237 case Notes: return "notes";
238 case FlexiNotes: return "flexible notes"; 238 case FlexiNotes: return "flexinotes";
239 case Regions: return "regions"; 239 case Regions: return "regions";
240 case Text: return "text"; 240 case Text: return "text";
241 case Image: return "image"; 241 case Image: return "image";
242 case Colour3DPlot: return "colour3d"; 242 case Colour3DPlot: return "colour3d";
243 case Spectrum: return "spectrum"; 243 case Spectrum: return "spectrum";
314 return; 314 return;
315 315
316 if (trySetModel<NoteLayer, NoteModel>(layer, model)) 316 if (trySetModel<NoteLayer, NoteModel>(layer, model))
317 return; 317 return;
318 318
319 // GF: added FlexiNoteLayer 319 // GF: added FlexiNoteLayer
320 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) 320 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model))
321 return; 321 return;
322 322
323 if (trySetModel<RegionLayer, RegionModel>(layer, model)) 323 if (trySetModel<RegionLayer, RegionModel>(layer, model))
324 return; 324 return;
347 { 347 {
348 if (layerType == TimeInstants) { 348 if (layerType == TimeInstants) {
349 return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1); 349 return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1);
350 } else if (layerType == TimeValues) { 350 } else if (layerType == TimeValues) {
351 return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true); 351 return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true);
352 } else if (layerType == FlexiNotes) { 352 } else if (layerType == FlexiNotes) {
353 return new FlexiNoteModel(baseModel->getSampleRate(), 1, true); 353 return new FlexiNoteModel(baseModel->getSampleRate(), 1, true);
354 } else if (layerType == Notes) { 354 } else if (layerType == Notes) {
355 return new NoteModel(baseModel->getSampleRate(), 1, true); 355 return new NoteModel(baseModel->getSampleRate(), 1, true);
356 } else if (layerType == Regions) { 356 } else if (layerType == Regions) {
357 return new RegionModel(baseModel->getSampleRate(), 1, true); 357 return new RegionModel(baseModel->getSampleRate(), 1, true);