@brief Check if a point is contained in a region. * This function object checks if a point is contained inside a region. */
| 1523 | * This function object checks if a point is contained inside a region. |
| 1524 | */ |
| 1525 | class ContainsPoint: public std::unary_function<const Region *, bool> |
| 1526 | { |
| 1527 | public: |
| 1528 | /// Remember the coordinates. |
| 1529 | ContainsPoint(double lon, double lat) : _lon(lon), _lat(lat) { /* Empty by design. */ } |
| 1530 | /// Check is the region contains the stored point. |
| 1531 | bool operator()(const Region *region) const { return region->getRules()->insideRegion(_lon, _lat); } |
| 1532 | private: |
| 1533 | double _lon, _lat; |
| 1534 | }; |
| 1535 | |
| 1536 | /** |
| 1537 | * Find the region containing this location. |