comparison layer/SpectrumLayer.cpp @ 350:3a55cd576334

* Further model lifecycle fixes
author Chris Cannam
date Thu, 24 Jan 2008 11:03:59 +0000
parents 369a197737c7
children e1a9e478b7f2
comparison
equal deleted inserted replaced
349:369a197737c7 350:3a55cd576334
60 std::cerr << "SpectrumLayer::setModel(" << model << ") from " << m_originModel << std::endl; 60 std::cerr << "SpectrumLayer::setModel(" << model << ") from " << m_originModel << std::endl;
61 61
62 if (m_originModel == model) return; 62 if (m_originModel == model) return;
63 63
64 m_originModel = model; 64 m_originModel = model;
65
66 if (m_sliceableModel) {
67 Model *m = const_cast<Model *>
68 (static_cast<const Model *>(m_sliceableModel));
69 m->aboutToDelete();
70 setSliceableModel(0);
71 delete m;
72 }
65 73
66 m_newFFTNeeded = true; 74 m_newFFTNeeded = true;
67 75
68 emit layerParametersChanged(); 76 emit layerParametersChanged();
69 } 77 }
644 void 652 void
645 SpectrumLayer::paint(View *v, QPainter &paint, QRect rect) const 653 SpectrumLayer::paint(View *v, QPainter &paint, QRect rect) const
646 { 654 {
647 if (!m_originModel || !m_originModel->isOK() || 655 if (!m_originModel || !m_originModel->isOK() ||
648 !m_originModel->isReady()) { 656 !m_originModel->isReady()) {
649 std::cerr << "SpectrumLayer::paint: no origin model" << std::endl; 657 std::cerr << "SpectrumLayer::paint: no origin model, or origin model not OK or not ready" << std::endl;
650 return; 658 return;
651 } 659 }
652 660
653 if (m_newFFTNeeded) { 661 if (m_newFFTNeeded) {
654 std::cerr << "SpectrumLayer::paint: new FFT needed, calling setupFFT" << std::endl; 662 std::cerr << "SpectrumLayer::paint: new FFT needed, calling setupFFT" << std::endl;