Mercurial > hg > svgui
diff layer/TimeInstantLayer.cpp @ 1471:f2525e6cbdf1 by-id
More layer updates
author | Chris Cannam |
---|---|
date | Mon, 01 Jul 2019 14:17:13 +0100 |
parents | 696e569ff21b |
children | 36ad3cdabf55 |
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp Fri Jun 28 17:37:22 2019 +0100 +++ b/layer/TimeInstantLayer.cpp Mon Jul 01 14:17:13 2019 +0100 @@ -64,19 +64,19 @@ void TimeInstantLayer::setModel(ModelId modelId) { + auto newModel = ModelById::getAs<SparseOneDimensionalModel>(modelId); + if (!modelId.isNone() && !newModel) { + throw std::logic_error("Not a SparseOneDimensionalModel"); + } + if (m_model == modelId) return; m_model = modelId; - auto newModel = ModelById::getAs<SparseOneDimensionalModel>(modelId); - - connectSignals(m_model); - -#ifdef DEBUG_TIME_INSTANT_LAYER - cerr << "TimeInstantLayer::setModel(" << modelId << ")" << endl; -#endif - - if (newModel && newModel->getRDFTypeURI().endsWith("Segment")) { - setPlotStyle(PlotSegmentation); + if (newModel) { + connectSignals(m_model); + if (newModel->getRDFTypeURI().endsWith("Segment")) { + setPlotStyle(PlotSegmentation); + } } emit modelReplaced();