I'm having a hard time working out the following problem efficiently.
I have a 15000x15000
xy matrix. I'm storing element locations in this matrix by defining a x,y coordinate for the element. I want to display a part of the matrix in a so called viewport. The viewport dimensions are e.g. 1600x1000
Consider the following db structure:
Element (element_id, image, width, height)
Globe_Element (ge_id, x, y, element_id)
With the only input
being a x,y coordinate somehwere in the grid (500x500) how can I select all the Globe_Element
rows which are visible in the viewport (6x4)?
The above image demonstrates the issues. The small orange squares are elements which should be included, small red squares shouldn't (looking at the nearest viewport). The big colored blocks (blue, yellow, green and red (yes again, sorry for confusion) are viewports. One color is one viewport. Gray circles define the input coordinates.