Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 1471:f2525e6cbdf1 by-id
More layer updates
author | Chris Cannam |
---|---|
date | Mon, 01 Jul 2019 14:17:13 +0100 |
parents | 696e569ff21b |
children | 36ad3cdabf55 |
comparison
equal
deleted
inserted
replaced
1470:696e569ff21b | 1471:f2525e6cbdf1 |
---|---|
80 } | 80 } |
81 | 81 |
82 void | 82 void |
83 TimeValueLayer::setModel(ModelId modelId) | 83 TimeValueLayer::setModel(ModelId modelId) |
84 { | 84 { |
85 auto newModel = ModelById::getAs<SparseTimeValueModel>(modelId); | |
86 | |
87 if (!modelId.isNone() && !newModel) { | |
88 throw std::logic_error("Not a SparseTimeValueModel"); | |
89 } | |
90 | |
85 if (m_model == modelId) return; | 91 if (m_model == modelId) return; |
86 m_model = modelId; | 92 m_model = modelId; |
87 | 93 |
88 auto newModel = ModelById::getAs<SparseOneDimensionalModel>(modelId); | 94 if (newModel) { |
89 | 95 |
90 connectSignals(m_model); | 96 connectSignals(m_model); |
91 | 97 |
92 m_scaleMinimum = 0; | 98 m_scaleMinimum = 0; |
93 m_scaleMaximum = 0; | 99 m_scaleMaximum = 0; |
94 | 100 |
95 if (newModel && newModel->getRDFTypeURI().endsWith("Segment")) { | 101 if (newModel->getRDFTypeURI().endsWith("Segment")) { |
96 setPlotStyle(PlotSegmentation); | 102 setPlotStyle(PlotSegmentation); |
97 } | 103 } |
98 if (newModel && m_model->getRDFTypeURI().endsWith("Change")) { | 104 if (newModel->getRDFTypeURI().endsWith("Change")) { |
99 setPlotStyle(PlotSegmentation); | 105 setPlotStyle(PlotSegmentation); |
100 } | 106 } |
101 | 107 } |
102 #ifdef DEBUG_TIME_VALUE_LAYER | 108 |
103 cerr << "TimeValueLayer::setModel(" << model << ")" << endl; | |
104 #endif | |
105 | |
106 emit modelReplaced(); | 109 emit modelReplaced(); |
107 } | 110 } |
108 | 111 |
109 Layer::PropertyList | 112 Layer::PropertyList |
110 TimeValueLayer::getProperties() const | 113 TimeValueLayer::getProperties() const |