comparison view/AlignmentView.cpp @ 1475:84c4ddb38415 by-id

Further layer updates
author Chris Cannam
date Tue, 02 Jul 2019 15:29:17 +0100
parents 9abddbd57667
children c5589d94b731
comparison
equal deleted inserted replaced
1474:36ad3cdabf55 1475:84c4ddb38415
145 { 145 {
146 if (!m_above) { 146 if (!m_above) {
147 return getDefaultKeyFrames(); 147 return getDefaultKeyFrames();
148 } 148 }
149 149
150 SparseOneDimensionalModel *m = nullptr; 150 ModelId m;
151 151
152 // get the topmost such 152 // get the topmost such
153 for (int i = 0; i < m_above->getLayerCount(); ++i) { 153 for (int i = 0; i < m_above->getLayerCount(); ++i) {
154 if (qobject_cast<TimeInstantLayer *>(m_above->getLayer(i))) { 154 if (qobject_cast<TimeInstantLayer *>(m_above->getLayer(i))) {
155 SparseOneDimensionalModel *mm = 155 ModelId mm = m_above->getLayer(i)->getModel();
156 qobject_cast<SparseOneDimensionalModel *> 156 if (ModelById::isa<SparseOneDimensionalModel>(mm)) {
157 (m_above->getLayer(i)->getModel()); 157 m = mm;
158 if (mm) m = mm; 158 }
159 } 159 }
160 } 160 }
161 161
162 if (!m) { 162 auto model = ModelById::getAs<SparseOneDimensionalModel>(m);
163 if (!model) {
163 return getDefaultKeyFrames(); 164 return getDefaultKeyFrames();
164 } 165 }
165 166
166 vector<sv_frame_t> keyFrames; 167 vector<sv_frame_t> keyFrames;
167 168
168 EventVector pp = m->getAllEvents(); 169 EventVector pp = model->getAllEvents();
169 for (EventVector::const_iterator pi = pp.begin(); pi != pp.end(); ++pi) { 170 for (EventVector::const_iterator pi = pp.begin(); pi != pp.end(); ++pi) {
170 keyFrames.push_back(pi->getFrame()); 171 keyFrames.push_back(pi->getFrame());
171 } 172 }
172 173
173 return keyFrames; 174 return keyFrames;