Mercurial > hg > svgui
diff layer/TimeValueLayer.cpp @ 1470:696e569ff21b by-id
Further layer updates for ById
author | Chris Cannam |
---|---|
date | Fri, 28 Jun 2019 17:37:22 +0100 |
parents | 9abddbd57667 |
children | f2525e6cbdf1 |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Thu Jun 27 13:16:25 2019 +0100 +++ b/layer/TimeValueLayer.cpp Fri Jun 28 17:37:22 2019 +0100 @@ -71,21 +71,31 @@ } +int +TimeValueLayer::getCompletion(LayerGeometryProvider *) const +{ + auto model = ModelById::get(m_model); + if (model) return model->getCompletion(); + else return 0; +} + void -TimeValueLayer::setModel(SparseTimeValueModel *model) +TimeValueLayer::setModel(ModelId modelId) { - if (m_model == model) return; - m_model = model; + if (m_model == modelId) return; + m_model = modelId; + + auto newModel = ModelById::getAs<SparseOneDimensionalModel>(modelId); connectSignals(m_model); m_scaleMinimum = 0; m_scaleMaximum = 0; - if (m_model && m_model->getRDFTypeURI().endsWith("Segment")) { + if (newModel && newModel->getRDFTypeURI().endsWith("Segment")) { setPlotStyle(PlotSegmentation); } - if (m_model && m_model->getRDFTypeURI().endsWith("Change")) { + if (newModel && m_model->getRDFTypeURI().endsWith("Change")) { setPlotStyle(PlotSegmentation); } @@ -152,6 +162,14 @@ return SingleColourLayer::getPropertyGroupName(name); } +bool +TimeValueLayer::needsTextLabelHeight() const +{ + auto model = ModelById::get(m_model); + if (!model) return false; + return m_plotStyle == PlotSegmentation && model->hasTextLabels(); +} + QString TimeValueLayer::getScaleUnits() const {