# HG changeset patch # User Chris Cannam # Date 1568909736 -3600 # Node ID 0fa155b84bac3db071a1b7fe797b47bbf74a8e95 # Parent a473b73fb04571882fd19b662664139475344902 Add TimeFrequencyBoxes to layer factory diff -r a473b73fb045 -r 0fa155b84bac layer/LayerFactory.cpp --- a/layer/LayerFactory.cpp Thu Sep 19 15:18:28 2019 +0100 +++ b/layer/LayerFactory.cpp Thu Sep 19 17:15:36 2019 +0100 @@ -23,6 +23,7 @@ #include "NoteLayer.h" #include "FlexiNoteLayer.h" #include "RegionLayer.h" +#include "TimeFrequencyBoxLayer.h" #include "TextLayer.h" #include "ImageLayer.h" #include "Colour3DPlotLayer.h" @@ -38,6 +39,7 @@ #include "data/model/SparseTimeValueModel.h" #include "data/model/NoteModel.h" #include "data/model/RegionModel.h" +#include "data/model/TimeFrequencyBoxModel.h" #include "data/model/TextModel.h" #include "data/model/ImageModel.h" #include "data/model/DenseThreeDimensionalModel.h" @@ -76,6 +78,7 @@ case Notes: return Layer::tr("Notes"); case FlexiNotes: return Layer::tr("Flexible Notes"); case Regions: return Layer::tr("Regions"); + case TimeFrequencyBoxes: return Layer::tr("Time-Frequency Boxes"); case Text: return Layer::tr("Text"); case Image: return Layer::tr("Images"); case Colour3DPlot: return Layer::tr("Colour 3D Plot"); @@ -173,6 +176,10 @@ types.insert(Regions); } + if (ModelById::getAs(modelId)) { + types.insert(TimeFrequencyBoxes); + } + if (ModelById::getAs(modelId)) { types.insert(Text); } @@ -203,6 +210,7 @@ // types.insert(FlexiNotes); types.insert(Notes); types.insert(Regions); + types.insert(TimeFrequencyBoxes); types.insert(Text); types.insert(Image); //!!! and in principle Colour3DPlot -- now that's a challenge @@ -220,6 +228,7 @@ if (dynamic_cast(layer)) return FlexiNotes; if (dynamic_cast(layer)) return Notes; if (dynamic_cast(layer)) return Regions; + if (dynamic_cast(layer)) return TimeFrequencyBoxes; if (dynamic_cast(layer)) return Text; if (dynamic_cast(layer)) return Image; if (dynamic_cast(layer)) return Colour3DPlot; @@ -240,6 +249,7 @@ case Notes: return "notes"; case FlexiNotes: return "flexinotes"; case Regions: return "regions"; + case TimeFrequencyBoxes: return "timefrequencyboxes"; case Text: return "text"; case Image: return "image"; case Colour3DPlot: return "colour3d"; @@ -266,6 +276,7 @@ case Notes: return "notes"; case FlexiNotes: return "flexinotes"; case Regions: return "regions"; + case TimeFrequencyBoxes: return "timefrequencyboxes"; case Text: return "text"; case Image: return "image"; case Colour3DPlot: return "colour3dplot"; @@ -291,6 +302,7 @@ if (name == "notes") return Notes; if (name == "flexinotes") return FlexiNotes; if (name == "regions") return Regions; + if (name == "timefrequencyboxes") return TimeFrequencyBoxes; if (name == "text") return Text; if (name == "image") return Image; if (name == "colour3dplot") return Colour3DPlot; @@ -329,6 +341,9 @@ if (trySetModel(layer, model)) return; + if (trySetModel(layer, model)) + return; + if (trySetModel(layer, model)) return; @@ -360,6 +375,8 @@ return std::make_shared(rate, 1, true); } else if (layerType == Regions) { return std::make_shared(rate, 1, true); + } else if (layerType == TimeFrequencyBoxes) { + return std::make_shared(rate, 1, true); } else if (layerType == Text) { return std::make_shared(rate, 1, true); } else if (layerType == Image) { @@ -437,6 +454,10 @@ layer = new RegionLayer; break; + case TimeFrequencyBoxes: + layer = new TimeFrequencyBoxLayer; + break; + case Text: layer = new TextLayer; break; diff -r a473b73fb045 -r 0fa155b84bac layer/LayerFactory.h --- a/layer/LayerFactory.h Thu Sep 19 15:18:28 2019 +0100 +++ b/layer/LayerFactory.h Thu Sep 19 17:15:36 2019 +0100 @@ -38,6 +38,7 @@ Notes, FlexiNotes, Regions, + TimeFrequencyBoxes, Text, Image, Colour3DPlot,