Mercurial > hg > svgui
diff layer/LayerFactory.cpp @ 1522:d5ef91dc2ea7
Merge from branch time-frequency-boxes
author | Chris Cannam |
---|---|
date | Wed, 25 Sep 2019 13:48:04 +0100 |
parents | 2e94c268f7a0 |
children | 1acd7be4df9a |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Tue Sep 17 12:50:58 2019 +0100 +++ b/layer/LayerFactory.cpp Wed Sep 25 13:48:04 2019 +0100 @@ -23,6 +23,7 @@ #include "NoteLayer.h" #include "FlexiNoteLayer.h" #include "RegionLayer.h" +#include "BoxLayer.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/BoxModel.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 Boxes: return Layer::tr("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<BoxModel>(modelId)) { + types.insert(Boxes); + } + if (ModelById::getAs<TextModel>(modelId)) { types.insert(Text); } @@ -203,6 +210,7 @@ // types.insert(FlexiNotes); types.insert(Notes); types.insert(Regions); + types.insert(Boxes); types.insert(Text); types.insert(Image); //!!! and in principle Colour3DPlot -- now that's a challenge @@ -220,6 +228,7 @@ if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; if (dynamic_cast<const NoteLayer *>(layer)) return Notes; if (dynamic_cast<const RegionLayer *>(layer)) return Regions; + if (dynamic_cast<const BoxLayer *>(layer)) return Boxes; if (dynamic_cast<const TextLayer *>(layer)) return Text; if (dynamic_cast<const ImageLayer *>(layer)) return Image; if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; @@ -240,6 +249,7 @@ case Notes: return "notes"; case FlexiNotes: return "flexinotes"; case Regions: return "regions"; + case Boxes: return "boxes"; 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 Boxes: return "boxes"; 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 == "boxes" || name == "timefrequencybox") return Boxes; if (name == "text") return Text; if (name == "image") return Image; if (name == "colour3dplot") return Colour3DPlot; @@ -329,6 +341,9 @@ if (trySetModel<RegionLayer, RegionModel>(layer, model)) return; + if (trySetModel<BoxLayer, BoxModel>(layer, model)) + return; + if (trySetModel<TextLayer, TextModel>(layer, model)) return; @@ -360,6 +375,8 @@ return std::make_shared<NoteModel>(rate, 1, true); } else if (layerType == Regions) { return std::make_shared<RegionModel>(rate, 1, true); + } else if (layerType == Boxes) { + return std::make_shared<BoxModel>(rate, 1, true); } else if (layerType == Text) { return std::make_shared<TextModel>(rate, 1, true); } else if (layerType == Image) { @@ -437,6 +454,10 @@ layer = new RegionLayer; break; + case Boxes: + layer = new BoxLayer; + break; + case Text: layer = new TextLayer; break;