Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 621:e7352a4c0a05 tonioni
added references to new layer type FlexiNoteLayer and corresponding FlexiNoteModel
author | matthiasm |
---|---|
date | Tue, 26 Mar 2013 14:46:06 +0000 |
parents | 4806715f7a19 |
children | 49afde2dd704 |
comparison
equal
deleted
inserted
replaced
620:fde7e2fae256 | 621:e7352a4c0a05 |
---|---|
19 #include "SpectrogramLayer.h" | 19 #include "SpectrogramLayer.h" |
20 #include "TimeRulerLayer.h" | 20 #include "TimeRulerLayer.h" |
21 #include "TimeInstantLayer.h" | 21 #include "TimeInstantLayer.h" |
22 #include "TimeValueLayer.h" | 22 #include "TimeValueLayer.h" |
23 #include "NoteLayer.h" | 23 #include "NoteLayer.h" |
24 #include "FlexiNoteLayer.h" | |
24 #include "RegionLayer.h" | 25 #include "RegionLayer.h" |
25 #include "TextLayer.h" | 26 #include "TextLayer.h" |
26 #include "ImageLayer.h" | 27 #include "ImageLayer.h" |
27 #include "Colour3DPlotLayer.h" | 28 #include "Colour3DPlotLayer.h" |
28 #include "SpectrumLayer.h" | 29 #include "SpectrumLayer.h" |
34 #include "data/model/RangeSummarisableTimeValueModel.h" | 35 #include "data/model/RangeSummarisableTimeValueModel.h" |
35 #include "data/model/DenseTimeValueModel.h" | 36 #include "data/model/DenseTimeValueModel.h" |
36 #include "data/model/SparseOneDimensionalModel.h" | 37 #include "data/model/SparseOneDimensionalModel.h" |
37 #include "data/model/SparseTimeValueModel.h" | 38 #include "data/model/SparseTimeValueModel.h" |
38 #include "data/model/NoteModel.h" | 39 #include "data/model/NoteModel.h" |
40 #include "data/model/FlexiNoteModel.h" | |
39 #include "data/model/RegionModel.h" | 41 #include "data/model/RegionModel.h" |
40 #include "data/model/TextModel.h" | 42 #include "data/model/TextModel.h" |
41 #include "data/model/ImageModel.h" | 43 #include "data/model/ImageModel.h" |
42 #include "data/model/DenseThreeDimensionalModel.h" | 44 #include "data/model/DenseThreeDimensionalModel.h" |
43 #include "data/model/WaveFileModel.h" | 45 #include "data/model/WaveFileModel.h" |
71 case Spectrogram: return Layer::tr("Spectrogram"); | 73 case Spectrogram: return Layer::tr("Spectrogram"); |
72 case TimeRuler: return Layer::tr("Ruler"); | 74 case TimeRuler: return Layer::tr("Ruler"); |
73 case TimeInstants: return Layer::tr("Time Instants"); | 75 case TimeInstants: return Layer::tr("Time Instants"); |
74 case TimeValues: return Layer::tr("Time Values"); | 76 case TimeValues: return Layer::tr("Time Values"); |
75 case Notes: return Layer::tr("Notes"); | 77 case Notes: return Layer::tr("Notes"); |
78 case FlexiNotes: return Layer::tr("flexible Notes"); | |
76 case Regions: return Layer::tr("Regions"); | 79 case Regions: return Layer::tr("Regions"); |
77 case Text: return Layer::tr("Text"); | 80 case Text: return Layer::tr("Text"); |
78 case Image: return Layer::tr("Images"); | 81 case Image: return Layer::tr("Images"); |
79 case Colour3DPlot: return Layer::tr("Colour 3D Plot"); | 82 case Colour3DPlot: return Layer::tr("Colour 3D Plot"); |
80 case Spectrum: return Layer::tr("Spectrum"); | 83 case Spectrum: return Layer::tr("Spectrum"); |
159 | 162 |
160 if (dynamic_cast<NoteModel *>(model)) { | 163 if (dynamic_cast<NoteModel *>(model)) { |
161 types.insert(Notes); | 164 types.insert(Notes); |
162 } | 165 } |
163 | 166 |
167 if (dynamic_cast<FlexiNoteModel *>(model)) { | |
168 types.insert(FlexiNotes); | |
169 } | |
170 | |
164 if (dynamic_cast<RegionModel *>(model)) { | 171 if (dynamic_cast<RegionModel *>(model)) { |
165 types.insert(Regions); | 172 types.insert(Regions); |
166 } | 173 } |
167 | 174 |
168 if (dynamic_cast<TextModel *>(model)) { | 175 if (dynamic_cast<TextModel *>(model)) { |
188 { | 195 { |
189 LayerTypeSet types; | 196 LayerTypeSet types; |
190 types.insert(TimeInstants); | 197 types.insert(TimeInstants); |
191 types.insert(TimeValues); | 198 types.insert(TimeValues); |
192 types.insert(Notes); | 199 types.insert(Notes); |
200 types.insert(FlexiNotes); | |
193 types.insert(Regions); | 201 types.insert(Regions); |
194 types.insert(Text); | 202 types.insert(Text); |
195 types.insert(Image); | 203 types.insert(Image); |
196 //!!! and in principle Colour3DPlot -- now that's a challenge | 204 //!!! and in principle Colour3DPlot -- now that's a challenge |
197 return types; | 205 return types; |
204 if (dynamic_cast<const SpectrogramLayer *>(layer)) return Spectrogram; | 212 if (dynamic_cast<const SpectrogramLayer *>(layer)) return Spectrogram; |
205 if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; | 213 if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; |
206 if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; | 214 if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; |
207 if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; | 215 if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; |
208 if (dynamic_cast<const NoteLayer *>(layer)) return Notes; | 216 if (dynamic_cast<const NoteLayer *>(layer)) return Notes; |
217 if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; | |
209 if (dynamic_cast<const RegionLayer *>(layer)) return Regions; | 218 if (dynamic_cast<const RegionLayer *>(layer)) return Regions; |
210 if (dynamic_cast<const TextLayer *>(layer)) return Text; | 219 if (dynamic_cast<const TextLayer *>(layer)) return Text; |
211 if (dynamic_cast<const ImageLayer *>(layer)) return Image; | 220 if (dynamic_cast<const ImageLayer *>(layer)) return Image; |
212 if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; | 221 if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; |
213 if (dynamic_cast<const SpectrumLayer *>(layer)) return Spectrum; | 222 if (dynamic_cast<const SpectrumLayer *>(layer)) return Spectrum; |
223 case Spectrogram: return "spectrogram"; | 232 case Spectrogram: return "spectrogram"; |
224 case TimeRuler: return "timeruler"; | 233 case TimeRuler: return "timeruler"; |
225 case TimeInstants: return "instants"; | 234 case TimeInstants: return "instants"; |
226 case TimeValues: return "values"; | 235 case TimeValues: return "values"; |
227 case Notes: return "notes"; | 236 case Notes: return "notes"; |
237 case FlexiNotes: return "flexible notes"; | |
228 case Regions: return "regions"; | 238 case Regions: return "regions"; |
229 case Text: return "text"; | 239 case Text: return "text"; |
230 case Image: return "image"; | 240 case Image: return "image"; |
231 case Colour3DPlot: return "colour3d"; | 241 case Colour3DPlot: return "colour3d"; |
232 case Spectrum: return "spectrum"; | 242 case Spectrum: return "spectrum"; |
245 case Spectrogram: return "spectrogram"; | 255 case Spectrogram: return "spectrogram"; |
246 case TimeRuler: return "timeruler"; | 256 case TimeRuler: return "timeruler"; |
247 case TimeInstants: return "timeinstants"; | 257 case TimeInstants: return "timeinstants"; |
248 case TimeValues: return "timevalues"; | 258 case TimeValues: return "timevalues"; |
249 case Notes: return "notes"; | 259 case Notes: return "notes"; |
260 case FlexiNotes: return "flexible notes"; | |
250 case Regions: return "regions"; | 261 case Regions: return "regions"; |
251 case Text: return "text"; | 262 case Text: return "text"; |
252 case Image: return "image"; | 263 case Image: return "image"; |
253 case Colour3DPlot: return "colour3dplot"; | 264 case Colour3DPlot: return "colour3dplot"; |
254 case Spectrum: return "spectrum"; | 265 case Spectrum: return "spectrum"; |
265 if (name == "waveform") return Waveform; | 276 if (name == "waveform") return Waveform; |
266 if (name == "spectrogram") return Spectrogram; | 277 if (name == "spectrogram") return Spectrogram; |
267 if (name == "timeruler") return TimeRuler; | 278 if (name == "timeruler") return TimeRuler; |
268 if (name == "timeinstants") return TimeInstants; | 279 if (name == "timeinstants") return TimeInstants; |
269 if (name == "timevalues") return TimeValues; | 280 if (name == "timevalues") return TimeValues; |
270 if (name == "notes") return Notes; | 281 if (name == "flexible notes") return FlexiNotes; |
271 if (name == "regions") return Regions; | 282 if (name == "regions") return Regions; |
272 if (name == "text") return Text; | 283 if (name == "text") return Text; |
273 if (name == "image") return Image; | 284 if (name == "image") return Image; |
274 if (name == "colour3dplot") return Colour3DPlot; | 285 if (name == "colour3dplot") return Colour3DPlot; |
275 if (name == "spectrum") return Spectrum; | 286 if (name == "spectrum") return Spectrum; |
302 return; | 313 return; |
303 | 314 |
304 if (trySetModel<NoteLayer, NoteModel>(layer, model)) | 315 if (trySetModel<NoteLayer, NoteModel>(layer, model)) |
305 return; | 316 return; |
306 | 317 |
318 if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) | |
319 return; | |
320 | |
307 if (trySetModel<RegionLayer, RegionModel>(layer, model)) | 321 if (trySetModel<RegionLayer, RegionModel>(layer, model)) |
308 return; | 322 return; |
309 | 323 |
310 if (trySetModel<TextLayer, TextModel>(layer, model)) | 324 if (trySetModel<TextLayer, TextModel>(layer, model)) |
311 return; | 325 return; |
332 if (layerType == TimeInstants) { | 346 if (layerType == TimeInstants) { |
333 return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1); | 347 return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1); |
334 } else if (layerType == TimeValues) { | 348 } else if (layerType == TimeValues) { |
335 return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true); | 349 return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true); |
336 } else if (layerType == Notes) { | 350 } else if (layerType == Notes) { |
351 return new NoteModel(baseModel->getSampleRate(), 1, true); | |
352 } else if (layerType == FlexiNotes) { | |
337 return new NoteModel(baseModel->getSampleRate(), 1, true); | 353 return new NoteModel(baseModel->getSampleRate(), 1, true); |
338 } else if (layerType == Regions) { | 354 } else if (layerType == Regions) { |
339 return new RegionModel(baseModel->getSampleRate(), 1, true); | 355 return new RegionModel(baseModel->getSampleRate(), 1, true); |
340 } else if (layerType == Text) { | 356 } else if (layerType == Text) { |
341 return new TextModel(baseModel->getSampleRate(), 1, true); | 357 return new TextModel(baseModel->getSampleRate(), 1, true); |
402 layer = new TimeValueLayer; | 418 layer = new TimeValueLayer; |
403 break; | 419 break; |
404 | 420 |
405 case Notes: | 421 case Notes: |
406 layer = new NoteLayer; | 422 layer = new NoteLayer; |
423 break; | |
424 | |
425 case FlexiNotes: | |
426 layer = new FlexiNoteLayer; | |
407 break; | 427 break; |
408 | 428 |
409 case Regions: | 429 case Regions: |
410 layer = new RegionLayer; | 430 layer = new RegionLayer; |
411 break; | 431 break; |