Mercurial > hg > svgui
comparison layer/TimeInstantLayer.cpp @ 1470:696e569ff21b by-id
Further layer updates for ById
author | Chris Cannam |
---|---|
date | Fri, 28 Jun 2019 17:37:22 +0100 |
parents | e561f0a8d75b |
children | f2525e6cbdf1 |
comparison
equal
deleted
inserted
replaced
1469:11a150e65ee1 | 1470:696e569ff21b |
---|---|
51 | 51 |
52 TimeInstantLayer::~TimeInstantLayer() | 52 TimeInstantLayer::~TimeInstantLayer() |
53 { | 53 { |
54 } | 54 } |
55 | 55 |
56 void | 56 int |
57 TimeInstantLayer::setModel(SparseOneDimensionalModel *model) | 57 TimeInstantLayer::getCompletion(LayerGeometryProvider *) const |
58 { | 58 { |
59 if (m_model == model) return; | 59 auto model = ModelById::get(m_model); |
60 m_model = model; | 60 if (model) return model->getCompletion(); |
61 | 61 else return 0; |
62 } | |
63 | |
64 void | |
65 TimeInstantLayer::setModel(ModelId modelId) | |
66 { | |
67 if (m_model == modelId) return; | |
68 m_model = modelId; | |
69 | |
70 auto newModel = ModelById::getAs<SparseOneDimensionalModel>(modelId); | |
71 | |
62 connectSignals(m_model); | 72 connectSignals(m_model); |
63 | 73 |
64 #ifdef DEBUG_TIME_INSTANT_LAYER | 74 #ifdef DEBUG_TIME_INSTANT_LAYER |
65 cerr << "TimeInstantLayer::setModel(" << model << ")" << endl; | 75 cerr << "TimeInstantLayer::setModel(" << modelId << ")" << endl; |
66 #endif | 76 #endif |
67 | 77 |
68 if (m_model && m_model->getRDFTypeURI().endsWith("Segment")) { | 78 if (newModel && newModel->getRDFTypeURI().endsWith("Segment")) { |
69 setPlotStyle(PlotSegmentation); | 79 setPlotStyle(PlotSegmentation); |
70 } | 80 } |
71 | 81 |
72 emit modelReplaced(); | 82 emit modelReplaced(); |
73 } | 83 } |
144 TimeInstantLayer::setPlotStyle(PlotStyle style) | 154 TimeInstantLayer::setPlotStyle(PlotStyle style) |
145 { | 155 { |
146 if (m_plotStyle == style) return; | 156 if (m_plotStyle == style) return; |
147 m_plotStyle = style; | 157 m_plotStyle = style; |
148 emit layerParametersChanged(); | 158 emit layerParametersChanged(); |
159 } | |
160 | |
161 bool | |
162 TimeInstantLayer::needsTextLabelHeight() const | |
163 { | |
164 auto model = ModelById::getAs<SparseOneDimensionalModel>(m_model); | |
165 if (model) return m_model->hasTextLabels(); | |
166 else return false; | |
149 } | 167 } |
150 | 168 |
151 bool | 169 bool |
152 TimeInstantLayer::isLayerScrollable(const LayerGeometryProvider *v) const | 170 TimeInstantLayer::isLayerScrollable(const LayerGeometryProvider *v) const |
153 { | 171 { |