Mercurial > hg > svgui
comparison layer/Layer.cpp @ 1324:13d9b422f7fe zoom
Merge from default branch
| author | Chris Cannam |
|---|---|
| date | Mon, 17 Sep 2018 13:51:31 +0100 |
| parents | 1d7921b1852f |
| children | c8a6fd3f9dff |
comparison
equal
deleted
inserted
replaced
| 1183:57d192e26331 | 1324:13d9b422f7fe |
|---|---|
| 50 { | 50 { |
| 51 connect(model, SIGNAL(modelChanged()), | 51 connect(model, SIGNAL(modelChanged()), |
| 52 this, SIGNAL(modelChanged())); | 52 this, SIGNAL(modelChanged())); |
| 53 | 53 |
| 54 connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), | 54 connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), |
| 55 this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t))); | 55 this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t))); |
| 56 | 56 |
| 57 connect(model, SIGNAL(completionChanged()), | 57 connect(model, SIGNAL(completionChanged()), |
| 58 this, SIGNAL(modelCompletionChanged())); | 58 this, SIGNAL(modelCompletionChanged())); |
| 59 | 59 |
| 60 connect(model, SIGNAL(alignmentCompletionChanged()), | 60 connect(model, SIGNAL(alignmentCompletionChanged()), |
| 61 this, SIGNAL(modelAlignmentCompletionChanged())); | 61 this, SIGNAL(modelAlignmentCompletionChanged())); |
| 62 } | 62 } |
| 63 | 63 |
| 64 QString | 64 QString |
| 65 Layer::getPropertyContainerIconName() const | 65 Layer::getPropertyContainerIconName() const |
| 66 { | 66 { |
| 67 return LayerFactory::getInstance()->getLayerIconName | 67 return LayerFactory::getInstance()->getLayerIconName |
| 68 (LayerFactory::getInstance()->getLayerType(this)); | 68 (LayerFactory::getInstance()->getLayerType(this)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void | 71 void |
| 72 Layer::setPresentationName(QString name) | 72 Layer::setPresentationName(QString name) |
| 73 { | 73 { |
| 83 QString layerName = factory->getLayerPresentationName | 83 QString layerName = factory->getLayerPresentationName |
| 84 (factory->getLayerType(this)); | 84 (factory->getLayerType(this)); |
| 85 | 85 |
| 86 QString modelName; | 86 QString modelName; |
| 87 if (getModel()) modelName = getModel()->objectName(); | 87 if (getModel()) modelName = getModel()->objectName(); |
| 88 | 88 |
| 89 QString text; | 89 QString text; |
| 90 if (modelName != "") { | 90 if (modelName != "") { |
| 91 text = QString("%1: %2").arg(modelName).arg(layerName); | 91 text = QString("%1: %2").arg(modelName).arg(layerName); |
| 92 } else { | 92 } else { |
| 93 text = layerName; | 93 text = layerName; |
| 94 } | 94 } |
| 95 | 95 |
| 96 return text; | 96 return text; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void | 99 void |
| 100 Layer::setObjectName(const QString &name) | 100 Layer::setObjectName(const QString &name) |
| 107 Layer::getPlayParameters() | 107 Layer::getPlayParameters() |
| 108 { | 108 { |
| 109 // cerr << "Layer (" << this << ", " << objectName() << ")::getPlayParameters: model is "<< getModel() << endl; | 109 // cerr << "Layer (" << this << ", " << objectName() << ")::getPlayParameters: model is "<< getModel() << endl; |
| 110 const Model *model = getModel(); | 110 const Model *model = getModel(); |
| 111 if (model) { | 111 if (model) { |
| 112 return PlayParameterRepository::getInstance()->getPlayParameters(model); | 112 return PlayParameterRepository::getInstance()->getPlayParameters(model); |
| 113 } | 113 } |
| 114 return 0; | 114 return 0; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void | 117 void |
| 586 } | 586 } |
| 587 | 587 |
| 588 v->drawMeasurementRect(paint, this, r.pixrect.normalized(), focus); | 588 v->drawMeasurementRect(paint, this, r.pixrect.normalized(), focus); |
| 589 } | 589 } |
| 590 | 590 |
| 591 bool | |
| 592 Layer::valueExtentsMatchMine(LayerGeometryProvider *v) const | |
| 593 { | |
| 594 double min, min_; | |
| 595 double max, max_; | |
| 596 bool logarithmic, logarithmic_; | |
| 597 QString unit; | |
| 598 | |
| 599 if (!getValueExtents(min_, max_, logarithmic_, unit)) { | |
| 600 return false; | |
| 601 } | |
| 602 | |
| 603 if (!v->getValueExtents(unit, min, max, logarithmic)) { | |
| 604 return false; | |
| 605 } | |
| 606 | |
| 607 if (min != min_ || | |
| 608 max != max_ || | |
| 609 logarithmic != logarithmic_) { | |
| 610 return false; | |
| 611 } | |
| 612 | |
| 613 return true; | |
| 614 } | |
| 615 | |
| 591 void | 616 void |
| 592 Layer::toXml(QTextStream &stream, | 617 Layer::toXml(QTextStream &stream, |
| 593 QString indent, QString extraAttributes) const | 618 QString indent, QString extraAttributes) const |
| 594 { | 619 { |
| 595 stream << indent; | 620 stream << indent; |
| 598 extraAttributes = QString("%1 presentationName=\"%2\"") | 623 extraAttributes = QString("%1 presentationName=\"%2\"") |
| 599 .arg(extraAttributes).arg(encodeEntities(m_presentationName)); | 624 .arg(extraAttributes).arg(encodeEntities(m_presentationName)); |
| 600 } | 625 } |
| 601 | 626 |
| 602 stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5") | 627 stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5") |
| 603 .arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName | 628 .arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName |
| 604 (LayerFactory::getInstance()->getLayerType(this)))) | 629 (LayerFactory::getInstance()->getLayerType(this)))) |
| 605 .arg(getObjectExportId(this)) | 630 .arg(getObjectExportId(this)) |
| 606 .arg(encodeEntities(objectName())) | 631 .arg(encodeEntities(objectName())) |
| 607 .arg(getObjectExportId(getModel())) | 632 .arg(getObjectExportId(getModel())) |
| 608 .arg(extraAttributes); | 633 .arg(extraAttributes); |
| 609 | 634 |
| 610 if (m_measureRects.empty()) { | 635 if (m_measureRects.empty()) { |
| 611 stream << QString("/>\n"); | 636 stream << QString("/>\n"); |
| 612 return; | 637 return; |
| 613 } | 638 } |
| 632 extraAttributes = QString("%1 presentationName=\"%2\"") | 657 extraAttributes = QString("%1 presentationName=\"%2\"") |
| 633 .arg(extraAttributes).arg(encodeEntities(m_presentationName)); | 658 .arg(extraAttributes).arg(encodeEntities(m_presentationName)); |
| 634 } | 659 } |
| 635 | 660 |
| 636 stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5/>\n") | 661 stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5/>\n") |
| 637 .arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName | 662 .arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName |
| 638 (LayerFactory::getInstance()->getLayerType(this)))) | 663 (LayerFactory::getInstance()->getLayerType(this)))) |
| 639 .arg(getObjectExportId(this)) | 664 .arg(getObjectExportId(this)) |
| 640 .arg(encodeEntities(objectName())) | 665 .arg(encodeEntities(objectName())) |
| 641 .arg(getObjectExportId(getModel())) | 666 .arg(getObjectExportId(getModel())) |
| 642 .arg(extraAttributes); | 667 .arg(extraAttributes); |
| 643 } | 668 } |
| 644 | 669 |
