+
+bool
+OptimizingLookupTable::has_item_at_point (Duple const & point) const
+{
+ int x;
+ int y;
+ point_to_indices (point, x, y);
+
+ if (x >= _dimension) {
+ cout << "WARNING: x=" << x << ", dim=" << _dimension << ", px=" << point.x << " cellsize=" << _cell_size << "\n";
+ }
+
+ if (y >= _dimension) {
+ cout << "WARNING: y=" << y << ", dim=" << _dimension << ", py=" << point.y << " cellsize=" << _cell_size << "\n";
+ }
+
+ /* XXX: hmm */
+ x = min (_dimension - 1, x);
+ y = min (_dimension - 1, y);
+
+ assert (x >= 0);
+ assert (y >= 0);
+
+ Cell const & cell = _cells[x][y];
+ vector<Item*> items;
+ for (Cell::const_iterator i = cell.begin(); i != cell.end(); ++i) {
+ boost::optional<Rect> const item_bbox = (*i)->bounding_box ();
+ if (item_bbox) {
+ Rect parent_bbox = (*i)->item_to_parent (item_bbox.get ());
+ if (parent_bbox.contains (point)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/** @param area Area in our owning item's coordinates */