Get the observer object of a direction vector definition. Return an empty selection if it's missing or refers to an object that doesn't exist.
| 1440 | // Get the observer object of a direction vector definition. Return an |
| 1441 | // empty selection if it's missing or refers to an object that doesn't exist. |
| 1442 | static Selection |
| 1443 | getVectorObserver(const Universe& universe, Hash* vectorData) |
| 1444 | { |
| 1445 | string obsName; |
| 1446 | if (!vectorData->getString("Observer", obsName)) |
| 1447 | { |
| 1448 | // Omission of observer is permitted; it will default to the |
| 1449 | // frame center. |
| 1450 | return Selection(); |
| 1451 | } |
| 1452 | |
| 1453 | Selection obsObject = universe.findPath(obsName, NULL, 0); |
| 1454 | if (obsObject.empty()) |
| 1455 | { |
| 1456 | clog << "Bad two-vector frame: observer object '" << obsObject.getName() << "' of vector not found.\n"; |
| 1457 | return Selection(); |
| 1458 | } |
| 1459 | |
| 1460 | return obsObject; |
| 1461 | } |
| 1462 | |
| 1463 | |
| 1464 | static FrameVector* |