| 569 | } |
| 570 | |
| 571 | void init(const QString &description) |
| 572 | { |
| 573 | if (loadOrExpand(description)) { |
| 574 | simplifyTransform(); |
| 575 | return; |
| 576 | } |
| 577 | |
| 578 | // check if the description is an abbreviation or model file with additional arguments supplied |
| 579 | File parsed("."+description); |
| 580 | if (loadOrExpand(parsed.suffix())) { |
| 581 | applyAdditionalProperties(parsed, transform.data()); |
| 582 | simplifyTransform(); |
| 583 | return; |
| 584 | } |
| 585 | |
| 586 | const bool compareTransform = description.contains('!'); |
| 587 | QStringList words = QtUtils::parse(description, compareTransform ? '!' : ':'); |
| 588 | |
| 589 | if ((words.size() < 1) || (words.size() > 2)) qFatal("Invalid algorithm format."); |
| 590 | |
| 591 | transform = QSharedPointer<Transform>(Transform::make(words[0], NULL)); |
| 592 | simplifyTransform(); |
| 593 | |
| 594 | if (words.size() > 1) { |
| 595 | if (!compareTransform) { |
| 596 | distance = QSharedPointer<Distance>(Distance::make(words[1], NULL)); |
| 597 | comparison = QSharedPointer<Transform>(Transform::make("GalleryCompare", NULL)); |
| 598 | comparison->setPropertyRecursive("distance", QVariant::fromValue(distance.data())); |
| 599 | } |
| 600 | else |
| 601 | comparison = QSharedPointer<Transform>(Transform::make(words[1], NULL)); |
| 602 | } |
| 603 | } |
| 604 | }; |
| 605 | |
| 606 | } // namespace br |